-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Description
I'm currently trying to get a new page to pop up outside of the scope of NavigatorIOS/react-native-router when a TouchableHighlight is pressed. Similar to how the compose new tweet view pops up from the bottom on the Twitter iOS app and how other apps handle resource creation views. I've read that I can use the Navigator component to do this, but after reading the documentation and looking at some examples, it is not working.
Here is the code I have:
var NewDeckIcon = React.createClass({
nextPage() {
return (
<Navigator
initialRoute={{component: NewDeck}}
configureScene={(route) => {
return Navigator.SceneConfigs.FloatFromBottom;
}}
renderScene={(route, navigator) => {
if (route.component) {
return React.createElement(route.component);
}
}}
/>
);
},
render() {
return (
<TouchableHighlight underlayColor='transparent'
onPress={this.nextPage}>
<Icon
name='ion|plus'
size={24}
color='#E6E6E6'
style={styles.newDeckIcon} />
</TouchableHighlight>
);
}
});
var NewDeck = React.createClass({
render() {
return (
<View style={styles.container}>
<Text style={styles.contain}>WOW IT WORKS!</Text>
</View>
);
}
});
I know that the nextPage
function is called correctly because if I insert a console.log
call before the return, it gets logged out. I'm not getting any sort of error from React when pressing the icon. The Navigator works if I don't try to create one via onPress and just have it called inside a render
function. Not sure if I'm missing anything, getting the syntax wrong, or if this is a bug.