Skip to content

Instantly share code, notes, and snippets.

@ustun
Created April 14, 2015 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ustun/5670b7480569fbb784a4 to your computer and use it in GitHub Desktop.
Save ustun/5670b7480569fbb784a4 to your computer and use it in GitHub Desktop.
NavigatorIOS bug
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
Navigator,
NavigatorIOS,
ScrollView,
TabBarIOS,
Text,
View,
StyleSheet,
} = React;
var HelloWorld = React.createClass({
render: function () {
return <View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
</View>;
}
});
var NavigatorBug = React.createClass({
getInitialState: function () {
return {'navigationBarHidden': false};
},
componentDidMount: function () {
setInterval(()=> {
this.setState({navigationBarHidden: !this.state.navigationBarHidden})
}, 1000)
},
render: function() {
return <NavigatorIOS
style={{flex: 1}}
navigationBarHidden={this.state.navigationBarHidden}
initialRoute={{component: HelloWorld}}/>
}
});
var 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,
},
});
AppRegistry.registerComponent('NavigatorBug', () => NavigatorBug);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment