Skip to content
This repository was archived by the owner on May 20, 2021. It is now read-only.

Rename _dispatch to dispatch for API consistency - #19

Merged
brentvatne merged 1 commit into
react-navigation:masterfrom
morellan:consistent-dispatch-api
Mar 20, 2019
Merged

brentvatne merged 1 commit into
react-navigation:masterfrom
morellan:consistent-dispatch-api

Conversation

@morellan

Copy link
Copy Markdown
Contributor

When navigating without the navigation props, according to the docs the navigator reference has a method dispatch.

In the createAppContainer method of react-navigation-native exists, but in react-navigation-web the method is called _dispatch.

One way to solve it is using the Platform component of react-native/react-native-web like:

const action = NavigationActions.navigate({ routeName, params });

if (Platform.OS === "web") {
  navigatorRef._dispatch(action);
} else {
  navigatorRef.dispatch(action);
}

This PR attempts to maintain consistency between the navigator API and the docs.

@morellan

Copy link
Copy Markdown
Contributor Author

Saw the failed checks and I guess they have to do with the CircleCI config:

  • lint: change require to import
  • unit-tests: install peerDependencies before running the test suite

@ericvicenti

Copy link
Copy Markdown
Contributor

👍 Looks great to me.

@slorber

slorber commented Mar 20, 2019

Copy link
Copy Markdown
Member

LGTM

@brentvatne
brentvatne merged commit 465cb99 into react-navigation:master Mar 20, 2019
@brentvatne

Copy link
Copy Markdown
Member

@ericvicenti - deploy at your leisure :)

@morellan
morellan deleted the consistent-dispatch-api branch March 21, 2019 19:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants