File tree 6 files changed +34
-4
lines changed
6 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ NS_ASSUME_NONNULL_BEGIN
43
43
*/
44
44
- (ReactTag)tagByComponentView : (UIView<RCTComponentViewProtocol> *)componentView ;
45
45
46
+ /* *
47
+ * Creates a component view with a given type and puts it to the recycle pool.
48
+ */
49
+ - (void )preliminaryCreateComponentViewWithName : (NSString *)componentName ;
50
+
46
51
@end
47
52
48
53
NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ + (void)unregisterView:(UIView *)view
64
64
65
65
#endif
66
66
67
- const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 256 ;
67
+ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024 ;
68
68
69
69
@implementation RCTComponentViewRegistry {
70
70
NSMapTable <id , UIView<RCTComponentViewProtocol> *> *_registry;
@@ -121,6 +121,13 @@ - (void)enqueueComponentViewWithName:(NSString *)componentName
121
121
[self _enqueueComponentViewWithName: componentName componentView: componentView];
122
122
}
123
123
124
+ - (void )preliminaryCreateComponentViewWithName : (NSString *)componentName
125
+ {
126
+ RCTAssertMainQueue ();
127
+ [self _enqueueComponentViewWithName: componentName
128
+ componentView: [self _createComponentViewWithName: componentName]];
129
+ }
130
+
124
131
- (UIView<RCTComponentViewProtocol> *)componentViewByTag : (ReactTag)tag
125
132
{
126
133
RCTAssertMainQueue ();
Original file line number Diff line number Diff line change @@ -26,10 +26,18 @@ NS_ASSUME_NONNULL_BEGIN
26
26
/* *
27
27
* Transfroms mutation insturctions to mount items and execute them.
28
28
* The order of mutation tnstructions matters.
29
+ * Can be called from any thread.
29
30
*/
30
31
- (void )mutateComponentViewTreeWithMutationInstructions : (facebook::react::TreeMutationInstructionList)instructions
31
32
rootTag : (ReactTag)rootTag ;
32
33
34
+ /* *
35
+ * Suggests preliminary creation of a component view of given type.
36
+ * The receiver is free to ignore the request.
37
+ * Can be called from any thread.
38
+ */
39
+ - (void )preliminaryCreateComponentViewWithName : (NSString *)componentName ;
40
+
33
41
@end
34
42
35
43
NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change @@ -181,4 +181,11 @@ - (void)_performMountItems:(NSArray<RCTMountItemProtocol> *)mountItems
181
181
[self .delegate mountingManager: self didMountComponentsWithRootTag: rootTag];
182
182
}
183
183
184
+ - (void )preliminaryCreateComponentViewWithName : (NSString *)componentName
185
+ {
186
+ RCTExecuteOnMainQueue (^{
187
+ [self ->_componentViewRegistry preliminaryCreateComponentViewWithName: componentName];
188
+ });
189
+ }
190
+
184
191
@end
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
19
19
@class RCTMountingManager;
20
20
21
21
/* *
22
- * Exacly same semantic as `facebook::react::SchedulerDelegate`.
22
+ * Exactly same semantic as `facebook::react::SchedulerDelegate`.
23
23
*/
24
24
@protocol RCTSchedulerDelegate
25
25
Original file line number Diff line number Diff line change @@ -67,15 +67,18 @@ - (void)dealloc
67
67
[[NSNotificationCenter defaultCenter ] removeObserver: self ];
68
68
}
69
69
70
- - (void )schedulerDidComputeMutationInstructions : (facebook::react::TreeMutationInstructionList)instructions rootTag : (ReactTag)rootTag
70
+ #pragma mark - RCTSchedulerDelegate
71
+
72
+ - (void )schedulerDidComputeMutationInstructions : (facebook::react::TreeMutationInstructionList)instructions
73
+ rootTag : (ReactTag)rootTag
71
74
{
72
75
[_mountingManager mutateComponentViewTreeWithMutationInstructions: instructions
73
76
rootTag: rootTag];
74
77
}
75
78
76
79
- (void )schedulerDidRequestPreliminaryViewAllocationWithComponentName : (NSString *)componentName
77
80
{
78
- // TODO: To be implemeted.
81
+ [_mountingManager preliminaryCreateComponentViewWithName: componentName];
79
82
}
80
83
81
84
#pragma mark - Internal Surface-dedicated Interface
You can’t perform that action at this time.
0 commit comments