import { StateNavigator } from 'navigation';
import { NavigationHandler, NavigationLink, NavigationContext, SceneView } from 'navigation-react';
const stateNavigator = new StateNavigator([
{ key: 'hello', route: '' },
{ key: 'world' }
]);
stateNavigator.start();
const Hello = () => (
<NavigationLink
stateKey="world"
navigationData={{ size: 20 }}>
Hello
</NavigationLink>
);
const World = () => {
const { data } = useContext(NavigationContext);
return (
<div style={{ fontSize: data.size }}>World</div>
);
};
const App = () => (
<NavigationHandler stateNavigator={stateNavigator}>
<SceneView active="hello"><Hello /></SceneView>
<SceneView active="world"><World /></SceneView>
</NavigationHandler>
);
navigation-react
4.8.0 • Public • Published Dependents (3)
Package Sidebar
Install
npm i navigation-react
Repository
Weekly Downloads
122
Version
4.8.0
License
Apache-2.0
Unpacked Size
81.2 kB
Total Files
45