-
-
Save spencercarli/a2ebb59f339ee4fe767f44c011e0aa92 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
// app/components/Container.js | |
import React from 'react'; | |
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'; | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
alignItems: 'center', | |
justifyContent: 'center', | |
}, | |
text: { | |
color: '#fff', | |
fontSize: 30, | |
fontWeight: '500', | |
}, | |
}); | |
const Container = ({ backgroundColor, onPress, children }) => ( | |
<View style={[styles.container, { backgroundColor }]}> | |
<TouchableOpacity onPress={onPress}> | |
<Text style={styles.text}>{backgroundColor}</Text> | |
</TouchableOpacity> | |
{children} | |
</View> | |
); | |
export default Container; |
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
// index.ios.js, index.android.js | |
import { AppRegistry } from 'react-native'; | |
import App from './app/index'; | |
AppRegistry.registerComponent('GettingStartedReactNativeNav', () => 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
// app/index.js | |
import React from 'react'; | |
import Screen from './screens/Screen1'; | |
export default Screen; |
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
// app/screens/Screen1.js | |
import React, { Component } from 'react'; | |
import { Text } from 'react-native'; | |
import Container from '../components/Container'; | |
class Screen extends Component { | |
render() { | |
return ( | |
<Container | |
backgroundColor="#F44336" | |
onPress={() => console.log('press')} | |
/> | |
); | |
} | |
} | |
export default Screen; |
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
// app/screens/Screen2.js | |
import React, { Component } from 'react'; | |
import { Text } from 'react-native'; | |
import Container from '../components/Container'; | |
class Screen extends Component { | |
render() { | |
return ( | |
<Container | |
backgroundColor="#c95e0c" | |
onPress={() => console.log('press')} | |
/> | |
); | |
} | |
} | |
export default Screen; |
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
// app/screens/Screen3.js | |
import React, { Component } from 'react'; | |
import { Text } from 'react-native'; | |
import Container from '../components/Container'; | |
class Screen extends Component { | |
render() { | |
return ( | |
<Container | |
backgroundColor="#067a46" | |
onPress={() => console.log('press')} | |
/> | |
); | |
} | |
} | |
export default Screen; |
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
// app/screens/Screen4.js | |
import React, { Component } from 'react'; | |
import { Text } from 'react-native'; | |
import Container from '../components/Container'; | |
class Screen extends Component { | |
render() { | |
return ( | |
<Container | |
backgroundColor="#01446b" | |
onPress={() => console.log('press')} | |
/> | |
); | |
} | |
} | |
export default Screen; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment