When I try to get a state of an element from renderScene function (Navigator), I have an error. It seems I couldn't get any state from that function.
For instance:
constructor(props) {
super(props);
this.state = {
test: 'test ok'
};
}
renderScene(route, navigator) {
console.log('test ok'); // test ok
console.log(this.state.test); // Cannot read property 'test' of undefined
...
}
render() {
return (
<Navigator
...
renderScene={this.renderScene}
...
/>
)
}
use
renderScene={this.renderScene.bind(this)}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With