@@ -1162,3 +1162,80 @@ test('scroll view parent is unflattened and view becomes culled', () => {
1162
1162
'Insert {type: "ScrollView", parentNativeID: "unflattened", index: 0, nativeID: (N/A)}' ,
1163
1163
] ) ;
1164
1164
} ) ;
1165
+
1166
+ test ( 'parent-child flattening with culling' , ( ) => {
1167
+ const root = Fantom . createRoot ( { viewportWidth : 100 , viewportHeight : 100 } ) ;
1168
+
1169
+ Fantom . runTask ( ( ) => {
1170
+ root . render (
1171
+ < ScrollView
1172
+ style = { { height : 100 , width : 100 } }
1173
+ contentOffset = { { x : 0 , y : 60 } } >
1174
+ < View
1175
+ style = { {
1176
+ marginTop : 100 ,
1177
+ opacity : 0 ,
1178
+ } } >
1179
+ < View
1180
+ style = { {
1181
+ marginTop : 50 ,
1182
+ opacity : 0 ,
1183
+ } } >
1184
+ < View
1185
+ nativeID = { 'child' }
1186
+ style = { { height : 10 , width : 10 , backgroundColor : 'red' } }
1187
+ />
1188
+ </ View >
1189
+ </ View >
1190
+ </ ScrollView > ,
1191
+ ) ;
1192
+ } ) ;
1193
+
1194
+ expect ( root . takeMountingManagerLogs ( ) ) . toEqual ( [
1195
+ 'Update {type: "RootView", nativeID: (root)}' ,
1196
+ 'Create {type: "ScrollView", nativeID: (N/A)}' ,
1197
+ 'Create {type: "View", nativeID: (N/A)}' ,
1198
+ 'Create {type: "View", nativeID: (N/A)}' ,
1199
+ 'Create {type: "View", nativeID: (N/A)}' ,
1200
+ 'Create {type: "View", nativeID: "child"}' ,
1201
+ 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
1202
+ 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: (N/A)}' ,
1203
+ 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: (N/A)}' ,
1204
+ 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: (N/A)}' ,
1205
+ 'Insert {type: "ScrollView", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
1206
+ ] ) ;
1207
+
1208
+ // force parent-child to be flattened.
1209
+ Fantom . runTask ( ( ) => {
1210
+ root . render (
1211
+ < ScrollView
1212
+ style = { { height : 100 , width : 100 } }
1213
+ contentOffset = { { x : 0 , y : 60 } } >
1214
+ < View
1215
+ style = { {
1216
+ marginTop : 100 ,
1217
+ } } >
1218
+ < View
1219
+ style = { {
1220
+ marginTop : 50 ,
1221
+ } } >
1222
+ < View
1223
+ nativeID = { 'child' }
1224
+ style = { { height : 10 , width : 10 , backgroundColor : 'red' } }
1225
+ />
1226
+ </ View >
1227
+ </ View >
1228
+ </ ScrollView > ,
1229
+ ) ;
1230
+ } ) ;
1231
+
1232
+ expect ( root . takeMountingManagerLogs ( ) ) . toEqual ( [
1233
+ 'Update {type: "View", nativeID: "child"}' ,
1234
+ 'Remove {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
1235
+ 'Remove {type: "View", parentNativeID: (N/A), index: 0, nativeID: (N/A)}' ,
1236
+ 'Remove {type: "View", parentNativeID: (N/A), index: 0, nativeID: (N/A)}' ,
1237
+ 'Delete {type: "View", nativeID: (N/A)}' ,
1238
+ 'Delete {type: "View", nativeID: (N/A)}' ,
1239
+ 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
1240
+ ] ) ;
1241
+ } ) ;
0 commit comments