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:
Mike Grabowski
2017-04-13 00:49:08 +02:00
committed by Eric Vicenti
parent fb2a0ad33d
commit 93976d358e
59 changed files with 1168 additions and 4727 deletions

View File

@@ -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({