12
12
13
13
let React ;
14
14
let ReactFabric ;
15
- let ReactFeatureFlags ;
16
15
let createReactNativeComponentClass ;
17
16
let UIManager ;
18
17
let StrictMode ;
@@ -38,7 +37,6 @@ describe('ReactFabric', () => {
38
37
React = require ( 'react' ) ;
39
38
StrictMode = React . StrictMode ;
40
39
ReactFabric = require ( 'react-native-renderer/fabric' ) ;
41
- ReactFeatureFlags = require ( 'shared/ReactFeatureFlags' ) ;
42
40
UIManager = require ( 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface' )
43
41
. UIManager ;
44
42
createReactNativeComponentClass = require ( 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface' )
@@ -649,112 +647,7 @@ describe('ReactFabric', () => {
649
647
expect ( touchStart2 ) . toBeCalled ( ) ;
650
648
} ) ;
651
649
652
- it ( 'dispatches event with target as reactTag' , ( ) => {
653
- ReactFeatureFlags . enableNativeTargetAsInstance = false ;
654
-
655
- const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
656
- validAttributes : {
657
- id : true ,
658
- } ,
659
- uiViewClassName : 'RCTView' ,
660
- directEventTypes : {
661
- topTouchStart : {
662
- registrationName : 'onTouchStart' ,
663
- } ,
664
- topTouchEnd : {
665
- registrationName : 'onTouchEnd' ,
666
- } ,
667
- } ,
668
- } ) ) ;
669
-
670
- function getViewById ( id ) {
671
- const [
672
- reactTag ,
673
- ,
674
- ,
675
- ,
676
- instanceHandle ,
677
- ] = nativeFabricUIManager . createNode . mock . calls . find (
678
- args => args [ 3 ] && args [ 3 ] . id === id ,
679
- ) ;
680
-
681
- return { reactTag, instanceHandle} ;
682
- }
683
-
684
- const ref1 = React . createRef ( ) ;
685
- const ref2 = React . createRef ( ) ;
686
-
687
- ReactFabric . render (
688
- < View id = "parent" >
689
- < View
690
- ref = { ref1 }
691
- id = "one"
692
- onResponderStart = { event => {
693
- expect ( ref1 . current ) . not . toBeNull ( ) ;
694
- expect ( ReactFabric . findNodeHandle ( ref1 . current ) ) . toEqual (
695
- event . target ,
696
- ) ;
697
- expect ( ReactFabric . findNodeHandle ( ref1 . current ) ) . toEqual (
698
- event . currentTarget ,
699
- ) ;
700
- } }
701
- onStartShouldSetResponder = { ( ) => true }
702
- />
703
- < View
704
- ref = { ref2 }
705
- id = "two"
706
- onResponderStart = { event => {
707
- expect ( ref2 . current ) . not . toBeNull ( ) ;
708
- expect ( ReactFabric . findNodeHandle ( ref2 . current ) ) . toEqual (
709
- event . target ,
710
- ) ;
711
- expect ( ReactFabric . findNodeHandle ( ref2 . current ) ) . toEqual (
712
- event . currentTarget ,
713
- ) ;
714
- } }
715
- onStartShouldSetResponder = { ( ) => true }
716
- />
717
- </ View > ,
718
- 1 ,
719
- ) ;
720
-
721
- let [
722
- dispatchEvent ,
723
- ] = nativeFabricUIManager . registerEventHandler . mock . calls [ 0 ] ;
724
-
725
- dispatchEvent ( getViewById ( 'one' ) . instanceHandle , 'topTouchStart' , {
726
- target : getViewById ( 'one' ) . reactTag ,
727
- identifier : 17 ,
728
- touches : [ ] ,
729
- changedTouches : [ ] ,
730
- } ) ;
731
- dispatchEvent ( getViewById ( 'one' ) . instanceHandle , 'topTouchEnd' , {
732
- target : getViewById ( 'one' ) . reactTag ,
733
- identifier : 17 ,
734
- touches : [ ] ,
735
- changedTouches : [ ] ,
736
- } ) ;
737
-
738
- dispatchEvent ( getViewById ( 'two' ) . instanceHandle , 'topTouchStart' , {
739
- target : getViewById ( 'two' ) . reactTag ,
740
- identifier : 17 ,
741
- touches : [ ] ,
742
- changedTouches : [ ] ,
743
- } ) ;
744
-
745
- dispatchEvent ( getViewById ( 'two' ) . instanceHandle , 'topTouchEnd' , {
746
- target : getViewById ( 'two' ) . reactTag ,
747
- identifier : 17 ,
748
- touches : [ ] ,
749
- changedTouches : [ ] ,
750
- } ) ;
751
-
752
- expect . assertions ( 6 ) ;
753
- } ) ;
754
-
755
650
it ( 'dispatches event with target as instance' , ( ) => {
756
- ReactFeatureFlags . enableNativeTargetAsInstance = true ;
757
-
758
651
const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
759
652
validAttributes : {
760
653
id : true ,
0 commit comments