Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
const LoggedOutStackNavigator = createNavigator(
AppView,
StackRouter(
{...Shim.shim(loggedOutRoutes)},
{
// @ts-ignore TODO add custom nav options somewhere
defaultNavigationOptions: () => ({headerHideBorder: true}),
initialRouteName: 'login',
}
),
{}
)
const RootStackNavigator = createSwitchNavigator(
{
loggedIn: LoggedInStackNavigator,
loggedOut: LoggedOutStackNavigator,
},
{initialRouteName: 'loggedOut'}
)
type Subscriber = (data: {action: Object | null; lastState: Object | null; state: any; type: string}) => void
const createElectronApp = Component => {
// Based on https://github.com/react-navigation/react-navigation-native/blob/master/src/createAppContainer.js
class ElectronApp extends React.PureComponent {
private navState: any = null // always use this value and not whats in state since thats async
private actionEventSubscribers = new Set()
private navigation: any
private initialAction: any = null
{}
)
const LoggedOutStackNavigator = createNavigator(
AppView,
StackRouter(
{...Shim.shim(loggedOutRoutes)},
{
defaultNavigationOptions: p => ({headerHideBorder: true}),
initialRouteName: 'login',
}
),
{}
)
const RootStackNavigator = createSwitchNavigator(
{
loggedIn: LoggedInStackNavigator,
loggedOut: LoggedOutStackNavigator,
},
{initialRouteName: 'loggedOut'}
)
const createElectronApp = Component => {
// Based on https://github.com/react-navigation/react-navigation-native/blob/master/src/createAppContainer.js
class ElectronApp extends React.PureComponent {
_navState: any = null // always use this value and not whats in state since thats async
_actionEventSubscribers = new Set()
_navigation: any
_initialAction = null
constructor(props: any) {
onPress={() => navigation.navigate(exampleName)}
title={exampleName}
/>
))}
);
const EXAMPLES = {
Fade,
Modal,
Gesture,
CardStack,
SharedEl,
};
const AppNavigator = createSwitchNavigator({
Examples,
...EXAMPLES,
});
const StatefulAppNavigator = createAppContainer(AppNavigator);
// const StatefulAppNavigator = createAppContainer(Fade);
// const StatefulAppNavigator = createAppContainer(Modal);
// const StatefulAppNavigator = createAppContainer(Gesture);
// const StatefulAppNavigator = createAppContainer(CardStack);
// const StatefulAppNavigator = createAppContainer(SharedEl);
const App = () => (
navigation={childNav}
component={descriptor.getComponent()}
screenProps={this.props.screenProps || noScreenProps}
/>
)
}
}
const WalletsSubNavigator = createNavigator(
WalletsSubNav,
StackRouter(Shim.shim(walletsSubRoutes), {initialRouteName: 'wallet'}),
{}
)
const OnboardingOrWalletsNavigator = createSwitchNavigator(
{
onboarding: RoutedOnboarding,
walletsubnav: WalletsSubNavigator,
},
{initialRouteName: 'onboarding'}
)
type OnboardingOrWalletsProps = NavigationViewProps & {acceptedDisclaimer: boolean}
class _OnboardingOrWallets extends React.Component {
static router = OnboardingOrWalletsNavigator.router
static navigationOptions = ({navigation}) => {
return {
header: undefined,
headerExpandable: true,
// index 0 means we're on the onboarding page, so hide the header
initialRouteParams: undefined,
}
)
const SimpleLoading = () => (
)
const RootStackNavigator = createSwitchNavigator(
{
loading: {screen: SimpleLoading},
loggedIn: LoggedInStackNavigator,
loggedOut: LoggedOutStackNavigator,
},
{initialRouteName: 'loading'}
)
const AppContainer = createAppContainer(RootStackNavigator)
class RNApp extends React.PureComponent {
private nav: any = null
// TODO remove this eventually, just so we can handle the old style actions
dispatchOldAction = (old: any) => {
const nav = this.nav
initialRouteParams: undefined,
}
)
const SimpleLoading = () => (
)
const RootStackNavigator = createSwitchNavigator(
{
loading: {screen: SimpleLoading},
loggedIn: LoggedInStackNavigator,
loggedOut: LoggedOutStackNavigator,
},
{initialRouteName: 'loading'}
)
const AppContainer = createAppContainer(RootStackNavigator)
class RNApp extends React.PureComponent {
private nav: any = null
// TODO remove this eventually, just so we can handle the old style actions
dispatchOldAction = (old: any) => {
const nav = this.nav
const SwitchNavigator = (routeConfigs, config = {}) => {
const navigator = createSwitchNavigator(routeConfigs, config);
return createNavigationContainer(navigator);
};
const createNavigator = (screens, menu) => {
Menu = menu;
return createSwitchNavigator(screens);
};