grid-react-navigation-webview-stack-navigator
v0.0.41
Published
React Navigation components that allow routing with a persistent web view
Downloads
4
Readme
React Navigation WebView Stack Navigator
To be used with React Navigation.
- Install the latest version of React Navigation WebView Stack Navigator.
npm install --save git+ssh://[email protected]/ombori/grid-react-native-webview-router.git
- Install peer dependencies.
npm install --save react react-native react-navigation react-native-view-shot git+ssh://[email protected]/ombori/grid-react-native-webview.git
- Import navigator and screen from React Navigation WebView Stack Navigator, see React Navigation docs for how to use them.
import { WebViewStackNavigator, WebViewScreen } from 'grid-react-navigation-webview-stack-navigator';
- The initial WebView location is set via the
initialWebViewURI
param on the initial route. If using redux to manage nav state this is set in the initialState of the reducer.
const initialState = AppNavigator.router.getStateForAction(
AppNavigator.router.getActionForPathAndParams('Onboarding?initialWebViewURI=https://lekmer.se'),
);
- You can dispatch WebView actions just like any other react navigation actions.
import { WebViewActions } from 'grid-react-navigation-webview-stack-navigator';
props.navigation.dispatch(
WebViewActions.load({ uri: 'https://ombori.com' })
);
NOTE: WebViewActions.replace
still needs work, right now it triggers a new route being pushed to the react navigation history stack.