navigation-react-native
v9.24.0
Published
React Native plugin for the Navigation router
Downloads
1,335
Maintainers
Readme
Hello World
import { StateNavigator } from 'navigation';
import { NavigationHandler, NavigationContext } from 'navigation-react';
import { NavigationStack,. Scene } from 'navigation-react-native';
const stateNavigator = new StateNavigator([
{ key: 'hello' },
{ key: 'world', trackCrumbTrail: true },
]);
const Hello = () => {
const { stateNavigator } = useContext(NavigationContext);
return (
<Button
title="Hello"
onPress={() => {
stateNavigator.navigate('world', { size: 20 });
}} />
);
};
const World = () => {
const { data } = useContext(NavigationContext);
return <Text style={{ fontSize: data.size }}>World</Text>;
};
const App = () => (
<NavigationHandler stateNavigator={stateNavigator}>
<NavigationStack>
<Scene stateKey="hello"><Hello /></Scene>
<Scene stateKey="world"><World /></Scene>
</NavigationStack>
</NavigationHandler>
);