mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-11 09:20:54 +08:00
Update top-level component nav documentation (#2543)
The code example listed in the current documentation results in a deprecation warning. This update should work.
This commit is contained in:
committed by
Spencer Carli
parent
70785d635a
commit
eeda63fb3e
@@ -24,12 +24,16 @@ To learn how to create screens, read about:
|
||||
|
||||
In case you want to use Navigator from the same level you declare it you can use react's [`ref`](https://facebook.github.io/react/docs/refs-and-the-dom.html#the-ref-callback-attribute) option:
|
||||
```js
|
||||
import { NavigationActions } from 'react-navigation';
|
||||
|
||||
const AppNavigator = StackNavigator(SomeAppRouteConfigs);
|
||||
|
||||
class App extends React.Component {
|
||||
someEvent() {
|
||||
// call navigate for AppNavigator here:
|
||||
this.navigator && this.navigator.dispatch({ type: 'Navigate', routeName, params });
|
||||
this.navigator && this.navigator.dispatch(
|
||||
NavigationActions.navigate({ routeName: someRouteName })
|
||||
);
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user