How to add navigation to queue in react native?

Viewed 24

This is the docs of React Navigation. How can queue actions when navigation is not ready? (mentioned in else block)

import * as React from 'react';

export const navigationRef = createNavigationContainerRef()

export function navigate(name, params) {
  if (navigationRef.isReady()) {
    // Perform navigation if the react navigation is ready to handle actions
    navigationRef.navigate(name, params);
  } else {
    // You can decide what to do if react navigation is not ready
    // You can ignore this, or add these actions to a queue you can call later
  }
}
0 Answers
Related