Created
February 4, 2019 21:37
-
-
Save dmitryshelomanov/be35f5b03bb29cabb84ea2df87316321 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 * as React from 'react'; | |
import { Text, View, StyleSheet, TouchableOpacity } from 'react-native'; | |
import { Constants } from 'expo'; | |
import { createBottomTabNavigator, createAppContainer, createStackNavigator } from 'react-navigation' | |
const routes = { | |
TodoList: createStackNavigator({ | |
TodoList: { | |
screen: ({ navigation }) => ( | |
<View style={{ flex: 1 }}> | |
{['todo 1', 'todo 2'].map((todo) => ( | |
<TouchableOpacity | |
onPress={() => { | |
navigation.navigate('Todo', { todo }) | |
}} | |
> | |
<Text style={{ padding: 50, backgroundColor: 'red' }}>{todo}</Text> | |
</TouchableOpacity> | |
))} | |
</View> | |
), | |
}, | |
Todo: ({ navigation }) => ( | |
<View style={styles.container}> | |
<Text style={styles.paragraph}>{navigation.getParam('todo')}</Text> | |
</View> | |
), | |
}), | |
Profile: ({ navigation }) => ( | |
<View style={styles.container}> | |
<Text style={styles.paragraph}>profile</Text> | |
</View> | |
), | |
} | |
const App = createBottomTabNavigator(routes) | |
export default createAppContainer(App) | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
paddingTop: Constants.statusBarHeight, | |
backgroundColor: '#ecf0f1', | |
padding: 8, | |
}, | |
paragraph: { | |
margin: 24, | |
fontSize: 18, | |
fontWeight: 'bold', | |
textAlign: 'center', | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment