I am trying to invoke my React Element but I think that constructor is not invoked. I am using class like this:
"use strict";
var MyManager = require("NativeModules").MyManager,
React = require("react-native");
class MyElement extends React.Component {
"constructor"(props) {
super(props);
React.AlertIOS("hello", "world");
this.state = {
"isSomethingOk": false
};
}
"componentWillMount"() {
MyManager.onSomethingChanged(isSomethingOk => {
this.onSomethingChanged(isSomethingOk);
});
}
"onSomethingChanged"(isSomethingOk) {
this.setState({
"isSomethingOk": isSomethingOk
});
}
"render"() {
return <React.View>
<React.Text>
{String(this.state.isSomethingOk)}
</React.Text>
</React.View>;
}
};
module.exports = MyElement;
React.AlertIOS("hello", "world"); is never invoked nor initial state is. Are class constructors called during instanciating React Native components?
I am trying to invoke my React Element but I think that constructor is not invoked. I am using class like this:
React.AlertIOS("hello", "world");is never invoked nor initial state is. Are class constructors called during instanciating React Native components?