react-native-screens icon indicating copy to clipboard operation
react-native-screens copied to clipboard

feat(iOS, Stack): Migrate to new invalidate method

Open t0maboro opened this issue 1 month ago • 1 comments

Description

This PR updates the logic responsible for triggering the invalidate callback. We're now aligning the logic to use RCTComponentViewProtocol callback, when available.

Depending on the React Native architecture and version, the invalidate mechanism behaves differently:

  • Paper - the invalidate flow continues to use the RCTInvalidating protocol.
  • Fabric, RN < 0.82.0 - scanning the list of mutations
  • Fabric, RN starting from 0.82.0 - the recommended way to handle invalidation is through the callback provided by RCTComponentViewProtocol. This PR enables usage of that callback.

Note: I'm using some common code from: https://github.com/software-mansion/react-native-screens/pull/3367

Changes

  • added RNSReactNativeVersionUtils in stack - for runtime checks as the commit with the new method in protocol was CP to 0.82 release
  • merged invalidation paths in a single function invalidateImpl

Test code and steps to reproduce

Check any example with native stack and verify whether invalidate callback is called from a proper path, e.g. by hitting a breakpoint.

Checklist

  • [x] Included code example that can be used to test this change
  • [x] Ensured that CI passes

t0maboro avatar Nov 03 '25 15:11 t0maboro

Switching to draft until we drop support for RN versions before 0.82

t0maboro avatar Nov 04 '25 11:11 t0maboro