Function To Call Onrightbuttonpress In Navigatorios - React Native
I'm using the onRightButton in a react-native NavigatorIOS. I'd like to be able to call a function which resides into the component I'm pushing, but I can't get how to achieve that
Solution 1:
The ref
callback prop is your friend! https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute
goToResults() {
this.props.navigator.push({
component: SingleResultView,
title: "SomeTitle",
rightButtonIcon: require('image!mapsmarker'),
passProps: {
userPosition: this.props.userPosition,
ref: this.onResultsRef,
},
onRightButtonPress: () => { this._resultsView && this._resultsView.foo(); }
});
}
onResultsRef(resultsViewRef) {
this._resultsView = resultsViewRef;
}
Post a Comment for "Function To Call Onrightbuttonpress In Navigatorios - React Native"