Skip to content
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

Navigation Demo Error:this.props.navigator undefined #15078

Closed
wangweiwei opened this issue Jul 18, 2017 · 1 comment
Closed

Navigation Demo Error:this.props.navigator undefined #15078

wangweiwei opened this issue Jul 18, 2017 · 1 comment
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@wangweiwei
Copy link

import React from 'react';
import PropTypes from 'prop-types';
import { AppRegistry, Button, NavigatorIOS, Text, View } from 'react-native';

export default class NavigatorIOSApp extends React.Component {
render() {
return (
<NavigatorIOS
initialRoute={{
component: MyScene,
title: 'My Initial Scene',
}}
style={{flex: 1}}
/>
)
}
}

class MyScene extends React.Component {
static propTypes = {
title: PropTypes.string.isRequired,
navigator: PropTypes.object.isRequired,
}

constructor(props, context) {
super(props, context);
this._onForward = this._onForward.bind(this);
}

_onForward() {
this.props.navigator.push({
title: 'Scene ' + nextIndex,
});
}

render() {
return (

Current Scene: { this.props.title }


)
}
}
AppRegistry.registerComponent('Demo', () => MyScene);
[
react-native-cli: 2.0.1
react-native: 0.46.4
]

@hramos hramos closed this as completed Jul 18, 2017
@chenxiaochun
Copy link

chenxiaochun commented Sep 1, 2017

所以,为什么报错,我也遇到了,还是没有解决吗?

@facebook facebook locked as resolved and limited conversation to collaborators Jul 18, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants