Created
September 23, 2016 10:27
-
-
Save anhducbkhn/b3a52348c91e2f4534be78cae3927314 to your computer and use it in GitHub Desktop.
Revisions
-
anhducbkhn created this gist
Sep 23, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,67 @@ /** * Sample React Native App * https://github.com/facebook/react-native * @flow */ import React, { Component, PropTypes } from 'react'; import { AppRegistry, StyleSheet, Text, View, Image, TextInput, NavigatorIOS, TouchableHighlight } from 'react-native'; // import MyScene from './MyScene'; class AwesomeProject extends Component { render() { return ( <NavigatorIOS initialRoute={{ component: MyScene, title: 'My Initial Scene', }} style={{flex: 1}} /> ); } } class MyScene extends Component { constructor(props, context) { super(props, context); this._onForward = this._onForward.bind(this); } _onForward() { this.props.navigator.push({ title: 'Scene ' + nextIndex, }); } render() { return ( <View style={{backgroundColor: '#DAF6FF'}}> <Text>Current Scene: { this.props.title }</Text> <TouchableHighlight onPress={this._onForward}> <Text>Tap me to load the next scene</Text> </TouchableHighlight> </View> ) } } MyScene.propTypes = { title: PropTypes.string.isRequired, navigator: PropTypes.object.isRequired, }; MyScene.defaultProps = { title: '11' }; AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);