How to use the react-native-navigation.ScreenVisibilityListener function in react-native-navigation

To help you get started, we’ve selected a few react-native-navigation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uport-project / uport-mobile / lib / start.ts View on Github external
const isIOS = Platform.OS === 'ios' ? true : false

export function start() {
  registerScreens(store, Provider)
  UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true)
}

// Actual initialization is done by startupSaga during initialization of `store`.
// When DB is ready it calls one of these.
export function startMain() {
  startAppModernUI()
  //startLegacyApp()
}

export const screenVisibilityListener = new RNNScreenVisibilityListener({
  didAppear: async (event: any) => {
    store.dispatch(screen(event.screen, event))
  },
})

// Add GUI startup tasks here for already onboarded user
export async function startAppModernUI() {
  /** Ask for notificatiosn on startup */
  store.dispatch(registerDeviceForNotifications())

  const accountsIcon = await FeatherIcons.getImageSource('check-circle', 26)
  const contactsIcon = await FeatherIcons.getImageSource('users', 26)
  const contactIcon = await FeatherIcons.getImageSource('user', 26)
  const settingsIcon = await FeatherIcons.getImageSource('settings', 26)
  const notificationsIcon = await FeatherIcons.getImageSource('bell', 26)
  const AndroidOptions = {
github WalletConnect / walletconnect-demo-app / src / navigation / index.js View on Github external
export function registerScreenVisibilityListener() {
  new ScreenVisibilityListener({
    willAppear: ({ screen }) => console.log(`Displaying screen ${screen}`),
    didAppear: ({
      screen, startTime, endTime, commandType,
    }) =>
      console.log('screenVisibility', `Screen ${screen} displayed in ${endTime - startTime} millis [${commandType}]`),
    willDisappear: ({ screen }) => console.log(`Screen will disappear ${screen}`),
    didDisappear: ({ screen }) => console.log(`Screen disappeared ${screen}`),
  }).register();
}
github mrarronz / react-native-blog-examples / Chapter15-AnimExample / RNAnimationDemo / src / IndexPage.js View on Github external
export function registerScreenVisibilityListener() {
  new ScreenVisibilityListener({
    willAppear: ({screen}) => console.log(`Displaying screen ${screen}`),
    didAppear: ({screen, startTime, endTime, commandType}) => console.log('screenVisibility', `Screen ${screen} displayed in ${endTime - startTime} millis [${commandType}]`),
    willDisappear: ({screen}) => console.log(`Screen will disappear ${screen}`),
    didDisappear: ({screen}) => console.log(`Screen disappeared ${screen}`)
  }).register();
}
github doo / scanbot-sdk-example-react-native / Screens / index.js View on Github external
export function registerScreenVisibilityListener() {
  new ScreenVisibilityListener({
    willAppear: ({screen}) => console.log(`Displaying screen ${screen}`),
    didAppear: ({screen, startTime, endTime, commandType}) => console.log('screenVisibility', `Screen ${screen} displayed in ${endTime - startTime} millis [${commandType}]`),
    willDisappear: ({screen}) => console.log(`Screen will disappear ${screen}`),
    didDisappear: ({screen}) => console.log(`Screen disappeared ${screen}`)
  }).register();
}
github mrarronz / react-native-blog-examples / Chapter10-RNInteractionWithNative / RNAddNative / src / screen / IndexPage.js View on Github external
export function registerScreenVisibilityListener() {
  new ScreenVisibilityListener({
    willAppear: ({screen}) => console.log(`Displaying screen ${screen}`),
    didAppear: ({screen, startTime, endTime, commandType}) => console.log('screenVisibility', `Screen ${screen} displayed in ${endTime - startTime} millis [${commandType}]`),
    willDisappear: ({screen}) => console.log(`Screen will disappear ${screen}`),
    didDisappear: ({screen}) => console.log(`Screen disappeared ${screen}`)
  }).register();
}
github wix / react-native-navigation / example / src / screens / index.js View on Github external
export function registerScreenVisibilityListener() {
  new ScreenVisibilityListener({
    willAppear: ({screen}) => console.log(`Displaying screen ${screen}`),
    didAppear: ({screen, startTime, endTime, commandType}) => console.log('screenVisibility', `Screen ${screen} displayed in ${endTime - startTime} millis [${commandType}]`),
    willDisappear: ({screen}) => console.log(`Screen will disappear ${screen}`),
    didDisappear: ({screen}) => console.log(`Screen disappeared ${screen}`)
  }).register();
}
github tipsi / tipsi-router / src / Router.wix.js View on Github external
registerScreenVisibilityListener() {
    new ScreenVisibilityListener({
      didAppear: event => this.parseVisibilityEvent(event),
    }).register()
  }
github demokratie-live / democracy-client / index.js View on Github external
constructor() {
    const observableQuery = client.watchQuery({
      query: IS_INSTRUCTIONS_SHOWN,
    });
    observableQuery.subscribe({
      next: ({ data }) => {
        if (this.isInstructionsShown !== data.isInstructionsShown) {
          this.startApp(data);
        }
        this.isInstructionsShown = data.isInstructionsShown;
      },
    });

    const listener = new RNNScreenVisibilityListener({
      didAppear: args => {
        let { screen } = args;

        if (screen === 'democracy.VoteList.List') {
          screen = 'democracy.VoteList';
        }

        client.mutate({
          mutation: setCurrentScreen,
          variables: {
            screen,
          },
        });
      },
    });
    listener.register();
github staltz / manyverse / src / drivers / navigation.ts View on Github external
constructor() {
    super();

    this._willAppear = xs.create();
    this._didAppear = xs.create();
    this._willDisappear = xs.create();
    this._didDisappear = xs.create();

    this._listener = new ScreenVisibilityListener({
      willAppear: (ev: ScreenVisibilityEvent) => this._willAppear._n(ev),
      didAppear: (ev: ScreenVisibilityEvent) => this._didAppear._n(ev),
      willDisappear: (ev: ScreenVisibilityEvent) => this._willDisappear._n(ev),
      didDisappear: (ev: ScreenVisibilityEvent) => this._didDisappear._n(ev)
    });

    this._listener.register();
  }