React native loading page

Hi, @ryantrem @bghgary
I need a solution for loading page on android with babylonjs react native.
I want to open my page more times. The first time I check this:

  useEffect(() => {
    if (engine) {
       SceneLoader.ImportMeshAsync(null, modelsUrl, glbFile, scene).then(result => {
          props.onGalleryLoaded();
         ....
       }
    }

The second time I check the:

  useFocusEffect(
    React.useCallback(() => {
        console.log('Screen was focused');
        if (engine) {
          props.onGalleryLoaded();
        }
        return () => {
            console.log('Screen was unfocused');
        };
    }, [])
  );

But here’s a problem: engine is not always there immediately.
Is there a callback for react native?
Thanks

1 Like

Where does engine come from in this case? I’ll need more context to provide guidance.