-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undefined is not an object (evaluating 'Sockets.connect' #6
Comments
which version are you testing? |
react-native 0.29 |
It looks like the linking steps are incorrect for android... Android
...
import com.peel.react.TcpSocketsModule; // <--- import //
public class MainActivity extends ReactActivity {
...
/**
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new TcpSocketsModule() // <- add here
);
}
} |
In the version 0.29.2, this function(getPackages) is moved to MainApplication.java |
thanks @wean, I'll test that out. |
updated the docs and sample code for 0.29.2. |
swansontec
pushed a commit
to EdgeApp/react-native-tcp
that referenced
this issue
Oct 1, 2020
Update build.gradle
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
class pt extends Component {
render() {
return (
<TouchableHighlight onPress={()=> {
var net = require('react-native-tcp');
var client = new net.Socket();
let options = {
host: '192.168.0.100',
port: 9100
};
client.connect(options, function () {
console.log('Connected');
client.write('Testing Print\n');
});
}
The code running fine on IOS but report
"undefined is not an object (evaluating 'Sockets.connect')"
on android
The text was updated successfully, but these errors were encountered: