Skip to content

Conversation

@t0maboro
Copy link
Contributor

@t0maboro t0maboro commented Nov 3, 2025

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: #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

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

@t0maboro t0maboro force-pushed the @t0maboro/old-stack-invalidate branch from c9c2b29 to 9b286c3 Compare November 3, 2025 15:06
if (!self->_toBeDeletedScreens.empty()) {
__weak RNSScreenStackView *weakSelf = self;
// We want to run after container updates are performed (transitions etc.)
dispatch_async(dispatch_get_main_queue(), ^{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: it seems that we can consider removing that delay as invalidateImpl is doing the same right now, but I decided to leave it as it is, because we're invalidating a bit later and the code will be dropped when we stop supporting <0.82

@t0maboro t0maboro force-pushed the @t0maboro/old-stack-invalidate branch from 788b570 to e1cd715 Compare November 4, 2025 08:56
@t0maboro t0maboro requested a review from kligarski November 4, 2025 08:59
@t0maboro
Copy link
Contributor Author

t0maboro commented Nov 4, 2025

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

@t0maboro t0maboro marked this pull request as draft November 4, 2025 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants