Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {Navigation} from 'react-native-navigation';
import registerScreens from './example/registerScreens';
registerScreens(); // this is where you register all of your app's screens
// start the app
Navigation.startSingleScreenApp({
screen: {
screen: 'Home', // unique ID registered with Navigation.registerScreen
title: 'Welcome', // title of the screen as appears in the nav bar (optional)
navigatorStyle: {
navBarBackgroundColor: '#f7f7f8'
}, // override the navigator style for the screen, see "Styling the navigator" below (optional)
navigatorButtons: {} // override the nav buttons for the screen, see "Adding buttons to the navigator" below (optional)
},
animationType: 'none'
});
import { Navigation } from 'react-native-navigation'
import registerScreens from './registerScreens'
import routes from './routes'
import { routeNames } from './constants'
// register all the screens
registerScreens(Navigation.registerComponent, routes)
// start the app
Navigation.startSingleScreenApp({
screen: {
screen: routeNames.LANDING
},
appStyle: {
keepStyleAcrossPush: false
}
})
export default Navigation
onLogoutPress() {
{
/* this.props.logoutFromWallet() */
}
this.props.clearTempData();
this.props.setPassword('');
Navigation.startSingleScreenApp({
screen: {
screen: 'login',
navigatorStyle: {
navBarHidden: true,
screenBackgroundImageName: 'bg-green.png',
screenBackgroundColor: '#102e36',
},
},
});
}
// Screens
import AuthScreen from "./src/screens/Auth/Auth";
import SharePlace from "./src/screens/SharePlace/SharePlace";
import FindPlace from "./src/screens/FindPlace/FindPlace";
import PlaceDetail from "./src/screens/PlaceDetail/PlaceDetail";
import SideDrawer from "./src/screens/SideDrawer/SideDrawer";
// Register screens
Navigation.registerComponent("AuthScreen", () => AuthScreen, store, Provider);
Navigation.registerComponent("SharePlace", () => SharePlace, store, Provider);
Navigation.registerComponent("FindPlace", () => FindPlace, store, Provider);
Navigation.registerComponent("PlaceDetail", () => PlaceDetail, store, Provider);
Navigation.registerComponent("SideDrawer", () => SideDrawer, store, Provider);
// Start an App
Navigation.startSingleScreenApp({
screen: {
screen: "AuthScreen",
title: "Login",
navigatorStyle: { navBarHidden: true }
}
});
const screenVNodeMimic$ = xs.create();
const commandMimic$ = xs.create();
const latestVNodes = new Map>();
for (let i = 0, n = screenIDs.length; i < n; i++) {
const screenID = screenIDs[i];
Navigation.registerComponent(
screenID,
makeScreenComponent(
screenID,
latestVNodes,
screenVNodeMimic$,
commandMimic$
)
);
}
Navigation.startSingleScreenApp(config);
function screenVNodeDriver(screenVNode$: Stream) {
screenVNode$.addListener({
next: s => {
latestVNodes.set(s.screen, s.vdom);
}
});
screenVNode$._add(screenVNodeMimic$);
return new ScreensSource();
}
function commandDriver(command$: Stream) {
command$._add(commandMimic$);
}
return {screenVNodeDriver, commandDriver};
}
export function launchLoggedOutFlow(hasAccounts: boolean) {
Navigation.startSingleScreenApp({
screen:
hasAccounts === true
? screen('ACCOUNTS_ACCESS_SCREEN')
: screen('ACCOUNTS_ACCESS_SCREEN'),
appStyle: { ...appStyle },
});
}
store.setup().then(() => {
if (Platform.OS === 'android') {
Navigation.startSingleScreenApp({
screen: Presets.get(IN_THEATERS_SCREEN),
drawer: { left: { screen: DRAWER_SCREEN } },
animationType: 'fade',
});
}
if (Platform.OS === 'ios') {
const navigatorStyle = {
navBarButtonColor: '#FFF',
navBarTextColor: '#FFF',
navBarHideOnScroll: false,
navBarTranslucent: true,
navBarNoBorder: true,
topTabTextColor: '#FFF',
selectedTopTabIndicatorColor: '#FF2244',
goBack() {
Navigation.startSingleScreenApp({
screen: {
screen: 'home',
navigatorStyle: {
navBarHidden: true,
navBarTransparent: true,
screenBackgroundColor: THEMES.getHSL(this.props.backgroundColor),
},
},
appStyle: {
orientation: 'portrait',
},
});
}
startApp(): void {
if (this.appConfig.appType === 'singleScreen' && this.appConfig.screen) {
Navigation.startSingleScreenApp({
screen: this.appConfig.screen,
drawer: this.appConfig.drawer,
animationType: 'fade'
});
} else if (this.appConfig.tabs && this.appConfig.tabs.length) {
Navigation.startTabBasedApp({
tabs: this.appConfig.tabs,
tabsStyle: this.appConfig.tabsStyle,
appStyle: this.appConfig.appStyle,
drawer: this.appConfig.drawer,
animationType: 'fade'
});
} else {
throw new Error('invalide settings for screens and appType in appConfig');
}
}