mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-24 04:25:34 +08:00
Introducing flat options (#984)
* Initial commit * Remove HybridExample (#985) * Remove HybridExample * Remove last mention of HelloHybrid * Remove console log * Fix flow and example * Fix routers api docs * Keep options in single place * chore * Fix styling * Organise miscs * Better flow type for screen options * Flow test website and add more types to options * navigationOptions instead of prevOptions makes more sense * Fixes * Fix up docs * Fix * Update route decl * Provide error when removed API is used * Remove lock * Add validators * Make StacksOverTabs config valid again * Do not return * Fix redbox
This commit is contained in:
committed by
Eric Vicenti
parent
fb2a0ad33d
commit
93976d358e
@@ -59,18 +59,22 @@ const MyProfileScreen = ({ navigation }) => (
|
||||
navigation={navigation}
|
||||
/>
|
||||
);
|
||||
MyProfileScreen.navigationOptions = {
|
||||
header: ({ state, setParams }) => ({
|
||||
title: `${state.params.name}'s Profile!`,
|
||||
|
||||
MyProfileScreen.navigationOptions = props => {
|
||||
const {navigation} = props;
|
||||
const {state, setParams} = navigation;
|
||||
const {params} = state;
|
||||
return {
|
||||
headerTitle: `${params.name}'s Profile!`,
|
||||
// Render a button on the right side of the header.
|
||||
// When pressed switches the screen to edit mode.
|
||||
right: (
|
||||
headerRight: (
|
||||
<Button
|
||||
title={state.params.mode === 'edit' ? 'Done' : 'Edit'}
|
||||
onPress={() => setParams({ mode: state.params.mode === 'edit' ? '' : 'edit' })}
|
||||
title={params.mode === 'edit' ? 'Done' : 'Edit'}
|
||||
onPress={() => setParams({ mode: params.mode === 'edit' ? '' : 'edit' })}
|
||||
/>
|
||||
),
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
||||
const SimpleStack = StackNavigator({
|
||||
|
||||
Reference in New Issue
Block a user