Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add header.left property #29

Merged
merged 8 commits into from Jan 27, 2017
Merged

Add header.left property #29

merged 8 commits into from Jan 27, 2017

Conversation

grabbou
Copy link

@grabbou grabbou commented Jan 27, 2017

Fixes #14

Also sorted out some eslint issues

@grabbou grabbou requested a review from satya164 January 27, 2017 13:43
@grabbou grabbou requested a review from knowbody January 27, 2017 16:10
Copy link

@knowbody knowbody left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be great to add it to one of our examples: I checked it. You can add this:

MyProfileScreen.navigationOptions = {
  header: ({ state, setParams }) => ({
    title: `${state.params.name}'s Profile!`,

    // Render a button on the left side of the header.
    // When pressed it displays the alert message.
    left: (
      <Button
        title="Alert"
        onPress={() => alert('Welcome to React Navigation!')}
      />
    ),

    // Render a button on the right side of the header.
    // When pressed switches the screen to edit mode.
    right: (
      <Button
        title={state.params.mode === 'edit' ? 'Done' : 'Edit'}
        onPress={() => setParams({ mode: state.params.mode === 'edit' ? '' : 'edit' })}
      />
    ),
  }),
};

to SimpleStack.js example

@knowbody
Copy link

knowbody commented Jan 27, 2017

or maybe you could actually skip that example as we already show how to do it with the right one.

@knowbody
Copy link

thanks @grabbou

@knowbody knowbody merged commit 7c0fcc6 into master Jan 27, 2017
@knowbody knowbody deleted the grabbou/left-render branch January 27, 2017 16:59
sourcecode911 pushed a commit to sourcecode911/react-navigation that referenced this pull request Mar 9, 2020
* Add header.left property

* Add docs

* Updates

* Update

* Remove unused param

* Update'

* fix

* Make sure to guard undefined defaultProps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants