Skip to content

Commit

Permalink
Fix platform events for bridgeless (#5937)
Browse files Browse the repository at this point in the history
## Summary

This PR adds missing registration for platform events such as scroll
events on Bridgeless mode. In the previous PR
(#5901)
I checked support for Gesture Handler events, I forgot about platform
events

## Test plan

| before | after |
| --- | --- |
| <video
src="https://github.com/software-mansion/react-native-reanimated/assets/36106620/0d83f08a-16d4-4669-bfea-a630ded6451f"
/> | <video
src="https://github.com/software-mansion/react-native-reanimated/assets/36106620/2819b8b8-8c0a-4160-80d1-c5488ea9b0a5"
/> |
  • Loading branch information
piaskowyk committed Apr 26, 2024
1 parent 5c350e5 commit 48fd0c2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apple/REAModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ - (void)installReanimatedAfterReload

- (void)handleJavaScriptDidLoadNotification:(NSNotification *)notification
{
_surfacePresenter = self.bridge.surfacePresenter;
[self attachReactEventListener];
}

- (void)attachReactEventListener
{
RCTScheduler *scheduler = [_surfacePresenter scheduler];
__weak __typeof__(self) weakSelf = self;
_surfacePresenter.runtimeExecutor(^(jsi::Runtime &runtime) {
Expand Down Expand Up @@ -289,6 +293,7 @@ - (void)sendEventWithName:(NSString *)eventName body:(id)body
});
auto nativeReanimatedModule = reanimated::createReanimatedModuleBridgeless(
_moduleRegistry, rnRuntime, std::string([valueUnpackerCode UTF8String]), executorFunction);
[self attachReactEventListener];
[self commonInit:nativeReanimatedModule withRnRuntime:rnRuntime];
#else // REACT_NATIVE_MINOR_VERSION >= 74 && defined(RCT_NEW_ARCH_ENABLED)
[NSException raise:@"Missing bridge" format:@"[Reanimated] Failed to obtain the bridge."];
Expand Down

0 comments on commit 48fd0c2

Please sign in to comment.