@@ -232,125 +232,159 @@ describe('ViewFlattening', () => {
232
232
'Insert {type: "View", parentNativeID: "J", index: 1, nativeID: "B"}' ,
233
233
] ) ;
234
234
} ) ;
235
- } ) ;
236
235
237
- test ( 'parent-child switching from unflattened-flattened to flattened-unflattened' , ( ) => {
238
- const root = Fantom . createRoot ( ) ;
236
+ test ( 'parent-child switching from unflattened-flattened to flattened-unflattened' , ( ) => {
237
+ const root = Fantom . createRoot ( ) ;
239
238
240
- Fantom . runTask ( ( ) => {
241
- root . render (
242
- < View
243
- style = { {
244
- marginTop : 100 ,
245
- opacity : 0 ,
246
- } } >
239
+ Fantom . runTask ( ( ) => {
240
+ root . render (
247
241
< View
248
242
style = { {
249
- marginTop : 50 ,
243
+ marginTop : 100 ,
244
+ opacity : 0 ,
250
245
} } >
251
246
< View
252
- nativeID = { 'child' }
253
- style = { { height : 10 , width : 10 , backgroundColor : 'red' } }
254
- />
255
- </ View >
256
- </ View > ,
257
- ) ;
258
- } ) ;
247
+ style = { {
248
+ marginTop : 50 ,
249
+ } } >
250
+ < View
251
+ nativeID = { 'child' }
252
+ style = { { height : 10 , width : 10 , backgroundColor : 'red' } }
253
+ />
254
+ </ View >
255
+ </ View > ,
256
+ ) ;
257
+ } ) ;
259
258
260
- expect ( root . takeMountingManagerLogs ( ) ) . toEqual ( [
261
- 'Update {type: "RootView", nativeID: (root)}' ,
262
- 'Create {type: "View", nativeID: (N/A)}' ,
263
- 'Create {type: "View", nativeID: "child"}' ,
264
- 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
265
- 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
266
- ] ) ;
267
-
268
- // force view to be flattened.
269
- Fantom . runTask ( ( ) => {
270
- root . render (
271
- < View
272
- style = { {
273
- marginTop : 100 ,
274
- } } >
259
+ expect ( root . takeMountingManagerLogs ( ) ) . toEqual ( [
260
+ 'Update {type: "RootView", nativeID: (root)}' ,
261
+ 'Create {type: "View", nativeID: (N/A)}' ,
262
+ 'Create {type: "View", nativeID: "child"}' ,
263
+ 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
264
+ 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
265
+ ] ) ;
266
+
267
+ // force view to be flattened.
268
+ Fantom . runTask ( ( ) => {
269
+ root . render (
275
270
< View
276
271
style = { {
277
- marginTop : 50 ,
278
- opacity : 0 ,
272
+ marginTop : 100 ,
279
273
} } >
280
274
< View
281
- nativeID = { 'child' }
282
- style = { { height : 10 , width : 10 , backgroundColor : 'red' } }
283
- />
284
- </ View >
285
- </ View > ,
286
- ) ;
275
+ style = { {
276
+ marginTop : 50 ,
277
+ opacity : 0 ,
278
+ } } >
279
+ < View
280
+ nativeID = { 'child' }
281
+ style = { { height : 10 , width : 10 , backgroundColor : 'red' } }
282
+ />
283
+ </ View >
284
+ </ View > ,
285
+ ) ;
286
+ } ) ;
287
+
288
+ expect ( root . takeMountingManagerLogs ( ) ) . toEqual ( [
289
+ 'Update {type: "View", nativeID: "child"}' ,
290
+ 'Remove {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
291
+ 'Remove {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
292
+ 'Delete {type: "View", nativeID: (N/A)}' ,
293
+ 'Create {type: "View", nativeID: (N/A)}' ,
294
+ 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
295
+ 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
296
+ ] ) ;
287
297
} ) ;
288
298
289
- expect ( root . takeMountingManagerLogs ( ) ) . toEqual ( [
290
- 'Update {type: "View", nativeID: "child"}' ,
291
- 'Remove {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
292
- 'Remove {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
293
- 'Delete {type: "View", nativeID: (N/A)}' ,
294
- 'Create {type: "View", nativeID: (N/A)}' ,
295
- 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
296
- 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
297
- ] ) ;
298
- } ) ;
299
+ test ( 'parent-child switching from flattened-unflattened to unflattened-flattened' , ( ) => {
300
+ const root = Fantom . createRoot ( ) ;
299
301
300
- test ( 'parent-child switching from flattened-unflattened to unflattened-flattened' , ( ) => {
301
- const root = Fantom . createRoot ( ) ;
302
+ Fantom . runTask ( ( ) => {
303
+ root . render (
304
+ < View
305
+ style = { {
306
+ marginTop : 100 ,
307
+ } } >
308
+ < View
309
+ style = { {
310
+ marginTop : 50 ,
311
+ opacity : 0 ,
312
+ } } >
313
+ < View nativeID = { 'child' } style = { { height : 10 , width : 10 } } />
314
+ </ View >
315
+ </ View > ,
316
+ ) ;
317
+ } ) ;
302
318
303
- Fantom . runTask ( ( ) => {
304
- root . render (
305
- < View
306
- style = { {
307
- marginTop : 100 ,
308
- } } >
319
+ expect ( root . takeMountingManagerLogs ( ) ) . toEqual ( [
320
+ 'Update {type: "RootView", nativeID: (root)}' ,
321
+ 'Create {type: "View", nativeID: (N/A)}' ,
322
+ 'Create {type: "View", nativeID: "child"}' ,
323
+ 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
324
+ 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
325
+ ] ) ;
326
+
327
+ // force view to be flattened.
328
+ Fantom . runTask ( ( ) => {
329
+ root . render (
309
330
< View
310
331
style = { {
311
- marginTop : 50 ,
332
+ marginTop : 100 ,
312
333
opacity : 0 ,
313
334
} } >
314
- < View nativeID = { 'child' } style = { { height : 10 , width : 10 } } />
315
- </ View >
316
- </ View > ,
317
- ) ;
335
+ < View
336
+ style = { {
337
+ marginTop : 50 ,
338
+ } } >
339
+ < View nativeID = { 'child' } style = { { height : 10 , width : 10 } } />
340
+ </ View >
341
+ </ View > ,
342
+ ) ;
343
+ } ) ;
344
+ expect ( root . takeMountingManagerLogs ( ) ) . toEqual ( [
345
+ 'Update {type: "View", nativeID: "child"}' ,
346
+ 'Remove {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
347
+ 'Remove {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
348
+ 'Delete {type: "View", nativeID: (N/A)}' ,
349
+ 'Create {type: "View", nativeID: (N/A)}' ,
350
+ 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
351
+ 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
352
+ ] ) ;
318
353
} ) ;
319
354
320
- expect ( root . takeMountingManagerLogs ( ) ) . toEqual ( [
321
- 'Update {type: "RootView", nativeID: (root)}' ,
322
- 'Create {type: "View", nativeID: (N/A)}' ,
323
- 'Create {type: "View", nativeID: "child"}' ,
324
- 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
325
- 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
326
- ] ) ;
327
-
328
- // force view to be flattened.
329
- Fantom . runTask ( ( ) => {
330
- root . render (
331
- < View
332
- style = { {
333
- marginTop : 100 ,
334
- opacity : 0 ,
335
- } } >
355
+ test ( '#51378: view with rgba(255,255,255,127/256) background color is not flattened' , ( ) => {
356
+ const root = Fantom . createRoot ( ) ;
357
+
358
+ Fantom . runTask ( ( ) => {
359
+ root . render (
336
360
< View
337
361
style = { {
338
- marginTop : 50 ,
339
- } } >
340
- < View nativeID = { 'child' } style = { { height : 10 , width : 10 } } />
341
- </ View >
342
- </ View > ,
362
+ width : 100 ,
363
+ height : 100 ,
364
+ backgroundColor : `rgba(255, 255, 255, ${ 127 / 256 } )` ,
365
+ } }
366
+ /> ,
367
+ ) ;
368
+ } ) ;
369
+
370
+ expect ( root . takeMountingManagerLogs ( ) ) . toEqual ( [
371
+ 'Update {type: "RootView", nativeID: (root)}' ,
372
+ 'Create {type: "View", nativeID: (N/A)}' ,
373
+ 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
374
+ ] ) ;
375
+
376
+ expect (
377
+ root
378
+ . getRenderedOutput ( { props : [ 'width' , 'height' , 'backgroundColor' ] } )
379
+ . toJSX ( ) ,
380
+ ) . toEqual (
381
+ < rn-view
382
+ width = "100.000000"
383
+ height = "100.000000"
384
+ backgroundColor = "rgba(255, 255, 255, 127)"
385
+ /> ,
343
386
) ;
344
387
} ) ;
345
- expect ( root . takeMountingManagerLogs ( ) ) . toEqual ( [
346
- 'Update {type: "View", nativeID: "child"}' ,
347
- 'Remove {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
348
- 'Remove {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
349
- 'Delete {type: "View", nativeID: (N/A)}' ,
350
- 'Create {type: "View", nativeID: (N/A)}' ,
351
- 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
352
- 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
353
- ] ) ;
354
388
} ) ;
355
389
356
390
describe ( 'reconciliation of setNativeProps and React commit' , ( ) => {
0 commit comments