Created
April 7, 2015 06:45
-
-
Save kocyigityunus/fa9ae1ef06b5ca00f75f to your computer and use it in GitHub Desktop.
Navgiation Bar Example
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
'use strict'; | |
var React = require('react-native'); | |
var { | |
ActivityIndicatorIOS, | |
ListView, | |
TouchableHighlight, | |
StyleSheet, | |
Text, | |
TextInput, | |
View, | |
} = React; | |
var Screen3 = React.createClass({ | |
componentDidMount : function(){ | |
console.log("screen 3 mounted!"); | |
}, | |
goToScreen4 : function(){ | |
this.props.navigator.push({ id: 'screen4' }); | |
//this.props.navigator.replace({ id: 'screen4' }); | |
//this.props.navigator.jumpTo({ id: 'screen4' }); | |
}, | |
render: function() { | |
return ( | |
<View style={styles.container}> | |
<Text> | |
Screen 3 | |
</Text> | |
<TouchableHighlight onPress={this.goToScreen4}> | |
<Text> | |
Go to Screen 4 | |
</Text> | |
</TouchableHighlight> | |
<TextInput | |
style={styles.default} | |
/> | |
</View> | |
); | |
} | |
}); | |
var styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
backgroundColor: 'red', | |
}, | |
default: { | |
height: 26, | |
borderWidth: 0.5, | |
borderColor: '#0f0f0f', | |
padding: 4, | |
fontSize: 13, | |
} | |
}); | |
module.exports = Screen3; |
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
'use strict'; | |
var React = require('react-native'); | |
var { | |
ActivityIndicatorIOS, | |
ListView, | |
TouchableHighlight, | |
StyleSheet, | |
Text, | |
TextInput, | |
View, | |
} = React; | |
var Screen4 = React.createClass({ | |
componentDidMount : function(){ | |
console.log("screen 4 mounted!"); | |
}, | |
openScreen5Modal : function(){ | |
this.props.navigator.push({ id: 'screen5' }); | |
}, | |
render: function() { | |
return ( | |
<View style={styles.container}> | |
<Text> | |
Screen 4 | |
</Text> | |
<TouchableHighlight onPress={this.openScreen5Modal}> | |
<Text> | |
Open Screen 5 Modal | |
</Text> | |
</TouchableHighlight> | |
</View> | |
); | |
} | |
}); | |
var styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
backgroundColor: 'green', | |
}, | |
}); | |
module.exports = Screen4; |
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
'use strict'; | |
var React = require('react-native'); | |
var { | |
ActivityIndicatorIOS, | |
ListView, | |
TouchableHighlight, | |
StyleSheet, | |
Text, | |
TextInput, | |
View, | |
} = React; | |
var Screen5 = React.createClass({ | |
componentDidMount : function(){ | |
console.log("screen 5 mounted!"); | |
}, | |
closeScreen5Modal : function(){ | |
this.props.navigator.pop(); | |
}, | |
render: function() { | |
return ( | |
<View style={styles.container}> | |
<Text> | |
Screen 5 -- This is a modal | |
</Text> | |
<TouchableHighlight onPress={this.closeScreen5Modal}> | |
<Text> | |
Close Screen 5 Modal | |
</Text> | |
</TouchableHighlight> | |
</View> | |
); | |
} | |
}); | |
var styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
backgroundColor: 'yellow', | |
}, | |
}); | |
module.exports = Screen5; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment