Last active
August 4, 2019 12:29
-
-
Save Yassir4/94e4cf9a6797297fba07b547926ca565 to your computer and use it in GitHub Desktop.
Home/index.js
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 React from 'react'; | |
import {View, Text, TouchableOpacity} from 'react-native'; | |
import {Navigation} from 'react-native-navigation'; | |
import styles from './styles'; | |
const pushScreen = props => { | |
const {componentId} = props; | |
Navigation.push(componentId, { | |
component: { | |
name: 'PushedScreen', | |
}, | |
}); | |
}; | |
const openModal = () => { | |
Navigation.showModal({ | |
stack: { | |
children: [ | |
{ | |
component: { | |
name: 'ModalScreen', | |
passProps: { | |
text: 'This is the modal screen', | |
}, | |
options: { | |
topBar: { | |
title: { | |
text: 'Title text', | |
}, | |
leftButtons: [ | |
{ | |
color: 'skyblue', | |
text: 'button', | |
id: 'leftButton', | |
}, | |
], | |
}, | |
}, | |
}, | |
}, | |
], | |
}, | |
}); | |
}; | |
const Home = props => { | |
return ( | |
<View style={styles.container}> | |
<View style={styles.buttonsSection}> | |
<TouchableOpacity | |
onPress={() => pushScreen(props)} | |
style={styles.buttonWrapper}> | |
<Text style={styles.buttonText}>Push Screen</Text> | |
</TouchableOpacity> | |
<TouchableOpacity onPress={openModal} style={styles.buttonWrapper}> | |
<Text style={styles.buttonText}>open a modal</Text> | |
</TouchableOpacity> | |
</View> | |
</View> | |
); | |
}; | |
export default Home; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment