-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to create Navigator via onPress? #1291
Comments
I guest you should create a model view and place a navigator on it |
You're trying to return a component from the You need to have a I have had success creating an interaction similar to what you mentioned by rendering I would recommend playing with some of the
Just taking a quick look at the example you posted, though, it should be more along the lines of this: var NewDeck = React.createClass({
render() {
return (
<View style={styles.container}>
<Text style={styles.contain}>WOW IT WORKS!</Text>
</View>
);
}
});
var NewDeckIcon = React.createClass({
nextPage() {
this.props.nav.push({component: NewDeck});
},
render() {
return (
<TouchableHighlight
underlayColor='transparent'
onPress={this.nextPage}
>
<Icon
name='ion|plus'
size={24}
color='#E6E6E6'
style={styles.newDeckIcon}
/>
</TouchableHighlight>
);
}
});
var App = React.createClass({
renderSceneMethod(route, navigator) {
if (route.component) {
return <route.component nav={navigator}/>;
} else {
return (
<View>
<Text>
This is the default renderScene view, when no route.component is provided.
</Text>
</View>
);
}
},
render() {
return (
<Navigator
style={styles.container}
initialRoute={{component: NewDeckIcon}}
configureScene={(route) => {
return Navigator.SceneConfigs.FloatFromBottom;
}}
renderScene={this.renderSceneMethod}
/>
);
}
}); Hope this helps! |
Wish I could like Github comments. @jmstout is right on the mark. One note - you can actually leave off |
Thank you @jmstout your post cleared up everything. I wasn't aware that there was an example project for the UIExplorer. I appreciate the explanation! |
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:
I know that the
nextPage
function is called correctly because if I insert aconsole.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 arender
function. Not sure if I'm missing anything, getting the syntax wrong, or if this is a bug.The text was updated successfully, but these errors were encountered: