Giter Site home page Giter Site logo

Comments (11)

alanjhughes avatar alanjhughes commented on May 10, 2024 1

@cortinico can confirm that I have run into this. I meant to reach out about it but I wanted to investigate myself first as it doesn't repro reliably and I'm not sure of the cause

from react-native.

github-actions avatar github-actions commented on May 10, 2024
⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

from react-native.

cortinico avatar cortinico commented on May 10, 2024

@NiuGuohui Just to confirm, you're on New Architecture right?

from react-native.

NiuGuohui avatar NiuGuohui commented on May 10, 2024

@NiuGuohui Just to confirm, you're on New Architecture right?

I tried again. Now AppState seems to be working properly. But I found that this error still occurs when enable bridgeless, and after disabled bridgeless, it no longer reports an error.

from react-native.

cortinico avatar cortinico commented on May 10, 2024

@cortinico can confirm that I have run into this. I meant to reach out about it but I wanted to investigate myself first as it doesn't repro reliably and I'm not sure of the cause

Great thanks for confirming it 👍

from react-native.

cortinico avatar cortinico commented on May 10, 2024

@alanjhughes @NiuGuohui can we isolate what's the problem here?

I've tried to reproduce, and yes, the:

Unhandled SoftException
  com.facebook.react.bridge.ReactNoCrashSoftException: Tried to access onWindowFocusChange while context is not ready

gets fired but that's unrelated. I was able to successfully use the AppState API with the provided reproducer.

repro.mov

from react-native.

NiuGuohui avatar NiuGuohui commented on May 10, 2024

@alanjhughes @NiuGuohui can we isolate what's the problem here?

I've tried to reproduce, and yes, the:

Unhandled SoftException
  com.facebook.react.bridge.ReactNoCrashSoftException: Tried to access onWindowFocusChange while context is not ready

gets fired but that's unrelated. I was able to successfully use the AppState API with the provided reproducer.

repro.mov

I think AppState works fine now.
But the error still occurred.
I tried to open ReactHostImpl.class (the built-in decompilation tool in Android Studio) and noticed that it seems not quite consistent with the code in the repository. I'm not sure if this decompiled code is reliable for reference.
This is my decompiled ReactHostImpl.class content:

@ThreadConfined("UI")
  public void onWindowFocusChange(boolean hasFocus) {
    String method = "onWindowFocusChange(hasFocus = \"" + hasFocus + "\")";
    this.log(method);
    ReactContext currentContext = this.getCurrentReactContext();
    if (currentContext != null) {
      currentContext.onWindowFocusChange(hasFocus);
    }

    ReactSoftExceptionLogger.logSoftException("ReactHost", new ReactNoCrashSoftException("Tried to access onWindowFocusChange while context is not ready"));
  }

from react-native.

cortinico avatar cortinico commented on May 10, 2024

I tried to open ReactHostImpl.class (the built-in decompilation tool in Android Studio) and noticed that it seems not quite consistent with the code in the repository. I'm not sure if this decompiled code is reliable for reference.

That's because you're looking at the class in main while you should be looking at the same class on the 0.74-stable branch:

https://github.com/facebook/react-native/blob/0.74-stable/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java

@alanjhughes what was the error you were facing?

from react-native.

alanjhughes avatar alanjhughes commented on May 10, 2024

@cortinico its this error but it's only happening on app launch and not every time. Kudo reproduced in a RN project without expo. I'll speak to him today and see if he found a reliable way to reproduce.

from react-native.

NiuGuohui avatar NiuGuohui commented on May 10, 2024

I tried to open ReactHostImpl.class (the built-in decompilation tool in Android Studio) and noticed that it seems not quite consistent with the code in the repository. I'm not sure if this decompiled code is reliable for reference.

That's because you're looking at the class in main while you should be looking at the same class on the 0.74-stable branch:

https://github.com/facebook/react-native/blob/0.74-stable/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java

So, should an else or return statement be added to line 664 in 0.74-stable ReactHostImpl.java

from react-native.

cortinico avatar cortinico commented on May 10, 2024

I tried to open ReactHostImpl.class (the built-in decompilation tool in Android Studio) and noticed that it seems not quite consistent with the code in the repository. I'm not sure if this decompiled code is reliable for reference.

That's because you're looking at the class in main while you should be looking at the same class on the 0.74-stable branch:
0.74-stable/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java

So, should an else or return statement be added to line 664 in 0.74-stable ReactHostImpl.java

We could pick ac3261f on the 0.74 release branch that would solve this

from react-native.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.