Hello,
EDIT:
After careful testing, it’s a silly mistake. I forgot to bind(this) on the onPress={}.
onPress={this.onButtonPress}
onPress={this.onButtonPress.bind(this)}
Would just like to ask how you solved this problem with refs getting undefined. It’s weird because in some Snack that I have the ref assignments are getting properly defined, but in this case it’s not working. I have also tried the createRef style and it’s still returning undefined. It’s weird cause in some Snack it’s working, sometimes it’s not.
<Animatable.View ref={this.handleViewRef} style={containerStyle}>
handleViewRef = ref => {
//It's working!
ref.flash();
this.view = ref;
};
onButtonPress() {
//undefined is not an object (evaluating 'this.view.flash')
this.view.flash();
};
package.json
"@expo/vector-icons": "^6.3.1",
"expo": "^27.0.0",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-27.0.0.tar.gz",
"react-native-animatable": "^1.3.0",
"react-native-elements": "0.18.5",
"react-native-router-flux": "^4.0.0-beta.31",
"react-native-slider": "0.11.0",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-thunk": "^2.3.0"
Thanks so much.