Files
react-native-reanimated/ios/REANodesManager.h
Michał Osadnik 3bbf8a0fed Make Animated Value persist its value after reattaching (#87)
When value gets detached from all component it can be still kept in memory and attached to some other component at later time. But because we don't know when JS reference is dropped we need to delete native counterpart of the value when it gets detached. This has led to a situation in which the value was reinstantiated on the native site. In that case if the value has changed we expect it to persist that changes when it gets attached again. This wasn't happening and each time the value was instantiated we'd always use the initial value.

With this change we are solving that issue by querying the value right before we detach the native node and then we use that value to update config such that next time when it gets instantiated it uses updated value instead of the initial one.
2018-09-28 13:45:51 +02:00

78 lines
2.4 KiB
Objective-C

#import <Foundation/Foundation.h>
#import "REANode.h"
#import <React/RCTBridgeModule.h>
#import <React/RCTUIManager.h>
@class REAModule;
typedef void (^REAOnAnimationCallback)(CADisplayLink *displayLink);
typedef void (^REANativeAnimationOp)(RCTUIManager *uiManager);
@interface REANodesManager : NSObject
@property (nonatomic, weak, nullable) RCTUIManager *uiManager;
@property (nonatomic, weak, nullable) REAModule *reanimatedModule;
@property (nonatomic, readonly) CFTimeInterval currentAnimationTimestamp;
@property (nonatomic, nullable) NSSet<NSString *> *uiProps;
@property (nonatomic, nullable) NSSet<NSString *> *nativeProps;
- (nonnull instancetype)initWithModule:(REAModule *)reanimatedModule
uiManager:(nonnull RCTUIManager *)uiManager;
- (REANode* _Nullable)findNodeByID:(nonnull REANodeID)nodeID;
- (void)invalidate;
- (void)operationsBatchDidComplete;
//
- (void)postOnAnimation:(REAOnAnimationCallback)clb;
- (void)postRunUpdatesAfterAnimation;
- (void)enqueueUpdateViewOnNativeThread:(nonnull NSNumber *)reactTag
viewName:(NSString *) viewName
nativeProps:(NSMutableDictionary *)nativeProps;
- (void)getValue:(REANodeID)nodeID
callback:(RCTResponseSenderBlock)callback;
// graph
- (void)createNode:(nonnull REANodeID)tag
config:(NSDictionary<NSString *, id> *__nonnull)config;
- (void)dropNode:(nonnull REANodeID)tag;
- (void)connectNodes:(nonnull REANodeID)parentID
childID:(nonnull REANodeID)childID;
- (void)disconnectNodes:(nonnull REANodeID)parentID
childID:(nonnull REANodeID)childID;
- (void)connectNodeToView:(nonnull REANodeID)nodeID
viewTag:(nonnull NSNumber *)viewTag
viewName:(nonnull NSString *)viewName;
- (void)disconnectNodeFromView:(nonnull REANodeID)nodeID
viewTag:(nonnull NSNumber *)viewTag;
- (void)attachEvent:(nonnull NSNumber *)viewTag
eventName:(nonnull NSString *)eventName
eventNodeID:(nonnull REANodeID)eventNodeID;
- (void)detachEvent:(nonnull NSNumber *)viewTag
eventName:(nonnull NSString *)eventName
eventNodeID:(nonnull REANodeID)eventNodeID;
// configuration
- (void)configureProps:(nonnull NSSet<NSString *> *)nativeProps
uiProps:(nonnull NSSet<NSString *> *)uiProps;
// events
- (void)dispatchEvent:(id<RCTEvent>)event;
@end