Created
March 14, 2018 14:20
-
-
Save julee/064d1e5bda45ba69f63c56454108635a to your computer and use it in GitHub Desktop.
[ss] hello #react native
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
// @flow | |
'use strict'; | |
import React, {Component} from 'react'; | |
import {StyleSheet, View} from 'react-native'; | |
import {connect} from 'react-redux'; | |
type Props = { | |
dispatch: (action: any) => void, | |
navigation: any, | |
}; | |
class $TemplatePage$ extends Component<Props> { | |
static navigationOptions = ({ navigation, screenProps, navigationOptions }) => { | |
const params = navigation.state.params || {}; | |
return { | |
// set header title text | |
// title: 'Home' | |
// set to null when no header | |
// header: null, | |
// applied to the View that wraps the header | |
// headerStyle: { | |
// elevation: 0, | |
// marginTop: 24, | |
// backgroundColor: '#ffffff', | |
// }, | |
// the back button and title both use this property as their color | |
// headerTintColor: '#fff', | |
// Text style properties for the title | |
// headerTitleStyle: { | |
// fontWeight: 'bold', | |
// }, | |
// Not only change text style of the title, use custom view instead of Text as title | |
// headerTitle: <LogoTitle />, | |
// header right element | |
// headerRight: <Button/> | |
}; | |
}; | |
_navListener: any; | |
componentDidMount() { | |
this._navListener = this.props.navigation.addListener('didFocus', this._onScreenFocus); | |
this.props.navigation.setParams({ onHeaderRightButtonPress: this._onHeaderRightButtonPress }); | |
} | |
componentWillUnmount() { | |
this._navListener.remove(); | |
} | |
_onHeaderRightButtonPress = () => { | |
}; | |
_onScreenFocus = () => { | |
}; | |
_onScreenLostFocus = () => { | |
}; | |
render() { | |
return ( | |
<View style={styles.container}> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
paddingTop: 5, | |
backgroundColor: 'rgba(255, 255, 255, 1)', | |
}, | |
}); | |
export default connect()($TemplatePage$); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment