Skip to content

Commit

Permalink
fix: brownfield integration (#6774)
Browse files Browse the repository at this point in the history
## Summary

In brownfield, ` // we need only one instance because SurfacePresenter
is the same during the application lifetime` is false since you can
destroy RN and create it again.

## Test plan
Run Reanimated in brownfield and try to create and destroy the whole RN
a couple of times.
  • Loading branch information
WoLewicki authored and tjzel committed Dec 13, 2024
1 parent d1cd913 commit bb47309
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@interface REAInitializerRCTFabricSurface : RCTFabricSurface

@property REAModule *reaModule;
@property __weak REAModule *reaModule;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,10 @@ - (void)setBridge:(RCTBridge *)bridge

- (void)setReaSurfacePresenter
{
if (reaSurface == nil) {
// we need only one instance because SurfacePresenter is the same during the application lifetime
reaSurface = [[REAInitializerRCTFabricSurface alloc] init];
if (_surfacePresenter && ![_surfacePresenter surfaceForRootTag:reaSurface.rootTag]) {
if (!reaSurface) {
reaSurface = [[REAInitializerRCTFabricSurface alloc] init];
}
[_surfacePresenter registerSurface:reaSurface];
}
reaSurface.reaModule = self;
Expand Down

0 comments on commit bb47309

Please sign in to comment.