Skip to content

React Native 0.79 iOS regression for RCTWindowFrameDidChangeNotification #50621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jpudysz opened this issue Apr 10, 2025 · 11 comments
Closed

React Native 0.79 iOS regression for RCTWindowFrameDidChangeNotification #50621

jpudysz opened this issue Apr 10, 2025 · 11 comments
Labels
Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Needs: Triage 🔍 Platform: iOS iOS applications.

Comments

@jpudysz
Copy link
Contributor

jpudysz commented Apr 10, 2025

Description

Hello,

I've noticed a regression in the RCTWindowFrameDidChangeNotification event on iOS when using React Native 0.79. The event no longer fires, as reported in #47234

This issue only occurs with the newest release. I also found this PR #49162 which may be related.

Steps to reproduce

  1. Install repro
  2. Run the example on iOS simulator via Xcode
  3. Toggle theme change / content size category change / screen orientation change etc.
  4. Observe no "Called!" log in the console

React Native Version

0.79.0

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info

System:
  OS: macOS 15.3.2
  CPU: (12) arm64 Apple M3 Pro
  Memory: 818.44 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 23.5.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.9.2
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.4
      - iOS 18.4
      - macOS 15.4
      - tvOS 18.4
      - visionOS 2.4
      - watchOS 11.4
  Android SDK:
    API Levels:
      - "23"
      - "28"
      - "29"
      - "30"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.3
      - 34.0.0
      - 35.0.0
    System Images:
      - android-23 | ARM 64 v8a
      - android-24 | Google APIs ARM 64 v8a
      - android-26 | Google APIs ARM 64 v8a
      - android-28 | ARM 64 v8a
      - android-29 | ARM 64 v8a
      - android-30 | ARM 64 v8a
      - android-30 | Google APIs ARM 64 v8a
      - android-34 | Android TV ARM 64 v8a
      - android-34 | ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-35 | Google APIs ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.3 AI-243.22562.218.2431.12996373
  Xcode:
    version: 16.3/16E140
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.0
    wanted: 18.0.0
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.79.0
    wanted: 0.79.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

No crash

Reproducer

https://github.com/jpudysz/RN079-repro

Screenshots and Videos

RN 0.78.2:

Screen.Recording.2025-04-10.at.12.43.05.mov

RN 0.79.0:

Screen.Recording.2025-04-10.at.12.40.46.mov
@react-native-bot react-native-bot added Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Platform: iOS iOS applications. labels Apr 10, 2025
@cortinico
Copy link
Contributor

I've noticed a regression in the RCTWindowFrameDidChangeNotification event on iOS when using React Native 0.79. The event no longer fires, as reported in #47234

@jpudysz just to understand, are you saying that the issue regressed again, as it was fixed in 0.77/0.78 but regressed once more?
Or was it broken since 0.76?

@jpudysz
Copy link
Contributor Author

jpudysz commented Apr 10, 2025

It worked from version 0.76.2 but broke again in 0.79.0

@cortinico
Copy link
Contributor

@cipolleschi do you have context on this one?

@migueldaipre
Copy link
Collaborator

For some reason version 0.79 does not contain the fix made in this commit.

0.78.2 vs 0.79.0

@cortinico
Copy link
Contributor

cortinico commented Apr 11, 2025

Great find @migueldaipre. That's because:

Got applied on top. Perhaps @okwasniewski or @cipolleschi can shed some light here?

@cipolleschi
Copy link
Contributor

The context is that, in the effort of decoupling react native from the App Delegate and toward supporting the SceneDelegate, we were refactoring the observers for those events.

I don't think the delegate is the right fix, as we were changing the mechanism that emit the event. We might have missed a spot.

@okwasniewski can you look into it?

@okwasniewski
Copy link
Contributor

@cipolleschi @jpudysz Yeah, previous fixes for this are incorrect with the new approach.

So actually now the RCTWindowFrameDidChangeNotification is triggered only when the frame changes. Before, it was triggered whenever the current UITraitCollection changed (so, for example, dark mode trigger).

@cipolleschi For backward compatibility's sake, should we still emit this notification if there are any changes to the trait collection not only to the frame?

@jpudysz
Copy link
Contributor Author

jpudysz commented Apr 16, 2025

For me, this is a breaking change without any notice. Also, it’s easier for me to listen for a single event, debounce it, and re-compute something rather than listening for multiple events and adding extra overhead on top of that.

Keep in mind that this event reported updates for all sort of changes: orientation/screen size/color scheme/content size category

@yerffejytnac
Copy link

Any updates? 👀

@cipolleschi
Copy link
Contributor

Hi @jpudysz and @yerffejytnac, the RCTWindowFrameDidChangeNotification, as the name implies, was meant to fire only when the window frame was changing.

The fact that we were firing it for any kind of change before was a bug. If the library was depending on a bug, that's not a good reason for not fixing the bug.

Imagine if react was rendering all the components twice and people started creating libraries depending on that behavior. We should be able to fix the behavior, even if it breaks the libraries. I'm sorry that we didn't communicate the change properly, we didn't realize that some libraries might be depending on that behavior.

I do understand that having the event emitted for every change was convenient, but we can't have that code in React Native: we would have all the apps paying the cost of sending notifications, even those apps that are not using the library.

If it is important for your library to observe all those events and to unify them in a single notification, it should be fairly easy to implement that mechanism in the library and to listen to the various notifications emitted by the OS and react accordingly.

@jpudysz
Copy link
Contributor Author

jpudysz commented Apr 24, 2025

No worries, and thanks for the update. I will patch it on the library level 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Needs: Triage 🔍 Platform: iOS iOS applications.
Projects
None yet
Development

No branches or pull requests

7 participants