UNPKG

2.98 kBtext/x-cView Raw
1#import <Foundation/Foundation.h>
2
3#import "REANode.h"
4#import <React/RCTBridgeModule.h>
5#import <React/RCTUIManager.h>
6
7@class REAModule;
8
9typedef void (^REAOnAnimationCallback)(CADisplayLink *displayLink);
10typedef void (^REANativeAnimationOp)(RCTUIManager *uiManager);
11typedef void (^REAEventHandler)(NSString *eventName, id<RCTEvent> event);
12
13@interface REANodesManager : NSObject
14
15@property (nonatomic, weak, nullable) RCTUIManager *uiManager;
16@property (nonatomic, weak, nullable) REAModule *reanimatedModule;
17@property (nonatomic, readonly) CFTimeInterval currentAnimationTimestamp;
18
19@property (nonatomic, nullable) NSSet<NSString *> *uiProps;
20@property (nonatomic, nullable) NSSet<NSString *> *nativeProps;
21
22- (nonnull instancetype)initWithModule:(REAModule *)reanimatedModule
23 uiManager:(nonnull RCTUIManager *)uiManager;
24
25- (REANode* _Nullable)findNodeByID:(nonnull REANodeID)nodeID;
26
27- (void)invalidate;
28
29- (void)operationsBatchDidComplete;
30
31//
32
33- (void)postOnAnimation:(REAOnAnimationCallback)clb;
34- (void)postRunUpdatesAfterAnimation;
35- (void)registerEventHandler:(REAEventHandler)eventHandler;
36- (void)enqueueUpdateViewOnNativeThread:(nonnull NSNumber *)reactTag
37 viewName:(NSString *) viewName
38 nativeProps:(NSMutableDictionary *)nativeProps
39 trySynchronously:(BOOL)trySync;
40- (void)getValue:(REANodeID)nodeID
41 callback:(RCTResponseSenderBlock)callback;
42
43// graph
44
45- (void)createNode:(nonnull REANodeID)tag
46 config:(NSDictionary<NSString *, id> *__nonnull)config;
47
48- (void)dropNode:(nonnull REANodeID)tag;
49
50- (void)connectNodes:(nonnull REANodeID)parentID
51 childID:(nonnull REANodeID)childID;
52
53- (void)disconnectNodes:(nonnull REANodeID)parentID
54 childID:(nonnull REANodeID)childID;
55
56- (void)connectNodeToView:(nonnull REANodeID)nodeID
57 viewTag:(nonnull NSNumber *)viewTag
58 viewName:(nonnull NSString *)viewName;
59
60- (void)disconnectNodeFromView:(nonnull REANodeID)nodeID
61 viewTag:(nonnull NSNumber *)viewTag;
62
63- (void)attachEvent:(nonnull NSNumber *)viewTag
64 eventName:(nonnull NSString *)eventName
65 eventNodeID:(nonnull REANodeID)eventNodeID;
66
67- (void)detachEvent:(nonnull NSNumber *)viewTag
68 eventName:(nonnull NSString *)eventName
69 eventNodeID:(nonnull REANodeID)eventNodeID;
70
71// configuration
72
73- (void)configureProps:(nonnull NSSet<NSString *> *)nativeProps
74 uiProps:(nonnull NSSet<NSString *> *)uiProps;
75
76- (void)updateProps:(nonnull NSDictionary *)props
77 ofViewWithTag:(nonnull NSNumber *)viewTag
78 withName:(nonnull NSString *)viewName;
79
80- (NSString*)obtainProp:(nonnull NSNumber *)viewTag
81 propName:(nonnull NSString *)propName;
82
83// events
84
85- (void)dispatchEvent:(id<RCTEvent>)event;
86
87- (void)setValueForNodeID:(nonnull NSNumber *)nodeID value:(nonnull NSNumber *)newValue;
88
89@end