Created
July 12, 2016 13:26
-
-
Save fab1an/c13d1887bedc4fe76b6ae3529778f4fb to your computer and use it in GitHub Desktop.
This file contains 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 characters
import View1 from "./View1"; | |
import View2 from "./View2"; | |
import { View } from 'react-native'; | |
export { View1, View2, View }; |
This file contains 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 characters
/** | |
* Sample React Native App | |
* https://github.com/facebook/react-native | |
* @flow | |
*/ | |
import React, { Component } from 'react'; | |
import { AppRegistry } from 'react-native'; | |
import MyNavigator from "./MyNavigator" | |
class App extends Component { | |
state = { | |
currentScene: { | |
name: "View1" | |
} | |
} | |
render() { | |
return ( | |
<MyNavigator | |
{...this.state} | |
onPress={() => { | |
this.setState({ | |
currentScene: { | |
name: "View2" | |
} | |
}) | |
}} | |
/> | |
); | |
} | |
} | |
AppRegistry.registerComponent('rn_test', () => App); |
This file contains 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 characters
import { View, Text, StyleSheet } from 'react-native'; | |
import React from "react"; | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
backgroundColor: '#F5FCFF', | |
}, | |
welcome: { | |
fontSize: 20, | |
textAlign: 'center', | |
margin: 10, | |
}, | |
instructions: { | |
textAlign: 'center', | |
color: '#333333', | |
marginBottom: 5, | |
}, | |
}); | |
class View1 extends React.Component { | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Text style={styles.welcome}> | |
Welcome to React Native! | |
</Text> | |
<Text style={styles.instructions}> | |
To get started, edit index.android.js | |
</Text> | |
<Text style={styles.instructions}> | |
Shake or press menu button for dev menu | |
</Text> | |
</View> | |
) | |
} | |
} | |
export default View1; |
This file contains 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 characters
import { View, Text, StyleSheet } from 'react-native'; | |
import React from "react"; | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
backgroundColor: '#F5FCFF', | |
}, | |
welcome: { | |
fontSize: 20, | |
textAlign: 'center', | |
margin: 10, | |
}, | |
instructions: { | |
textAlign: 'center', | |
color: '#333333', | |
marginBottom: 5, | |
}, | |
}); | |
class View2 extends React.Component { | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Text style={styles.welcome}> | |
Welcome to React Native Second View! | |
</Text> | |
<Text style={styles.instructions}> | |
To get started, edit index.android.js | |
</Text> | |
<Text style={styles.instructions}> | |
Shake or press menu button for dev menu | |
</Text> | |
</View> | |
) | |
} | |
} | |
export default View2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment