Setup
Install the three navigation packages from npm.
npm install navigation navigation-react navigation-react-mobile
Replace the code in index.js
(or equivalent) with the following:
import {createRoot} from 'react-dom/client';
import {StateNavigator} from 'navigation';
import {NavigationHandler} from 'navigation-react';
import {NavigationStack} from 'navigation-react-mobile';
const stateNavigator = new StateNavigator([
]);
stateNavigator.start();
const App = () => (
<NavigationHandler stateNavigator={stateNavigator}>
<NavigationStack style={sceneStyle}>
</NavigationStack>
</NavigationHandler>
);
const sceneStyle = {
position: 'fixed',
overflow: 'auto',
backgroundColor: '#fff',
top: 0, right: 0, bottom: 0, left: 0
}
const rootElement = document.getElementById('root');
const root = createRoot(rootElement);
root.render(<App />);