Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Libraries/Animated/src/nodes/AnimatedProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ class AnimatedProps extends AnimatedNode {
}

__detach(): void {
if (this.__isNative && this._animatedView) {
this.__disconnectAnimatedView();
}
for (const key in this._props) {
const value = this._props[key];
if (value instanceof AnimatedNode) {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@protocol RCTValueAnimatedNodeObserver;

@interface RCTNativeAnimatedNodesManager : NSObject
@interface RCTNativeAnimatedNodesManager : NSObject<RCTUIManagerDelegate>

- (nonnull instancetype)initWithUIManager:(nonnull RCTUIManager *)uiManager;

Expand Down
9 changes: 9 additions & 0 deletions Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#import "RCTTransformAnimatedNode.h"
#import "RCTValueAnimatedNode.h"
#import "RCTTrackingAnimatedNode.h"
#import <React/RCTUIManager.h>

@implementation RCTNativeAnimatedNodesManager
{
Expand All @@ -46,10 +47,18 @@ - (instancetype)initWithUIManager:(nonnull RCTUIManager *)uiManager
_animationNodes = [NSMutableDictionary new];
_eventDrivers = [NSMutableDictionary new];
_activeAnimations = [NSMutableSet new];
_uiManager.delegate = self;
}
return self;
}

- (void)didDeregisteredView: (NSNumber *)viewTag {
RCTAnimatedNode *node = _animationNodes[viewTag];
if (node && [node isKindOfClass:RCTPropsAnimatedNode.class]) {
[(RCTPropsAnimatedNode *)node disconnectFromView:viewTag];
}
}

#pragma mark -- Graph

- (void)createAnimatedNode:(nonnull NSNumber *)tag
Expand Down
7 changes: 7 additions & 0 deletions React/Modules/RCTUIManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
#import <React/RCTRootView.h>
#import <React/RCTViewManager.h>

@protocol RCTUIManagerDelegate
- (void)didDeregisteredView: (NSNumber *)viewTag;
@end


/**
* Posted right before re-render happens. This is a chance for views to invalidate their state so
* next render cycle will pick up updated views and layout appropriately.
Expand All @@ -27,6 +32,8 @@ RCT_EXTERN NSString *const RCTUIManagerWillUpdateViewsDueToContentSizeMultiplier
*/
@interface RCTUIManager : NSObject <RCTBridgeModule, RCTInvalidating>

@property (weak) id<RCTUIManagerDelegate> delegate;

/**
* Register a root view tag and creates corresponding `rootView` and
* `rootShadowView`.
Expand Down
1 change: 1 addition & 0 deletions React/Modules/RCTUIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ - (void)_purgeChildren:(NSArray<id<RCTComponent>> *)children
[(id<RCTInvalidating>)subview invalidate];
}
[registry removeObjectForKey:subview.reactTag];
[self.delegate didDeregisteredView:subview.reactTag];
});
}
}
Expand Down