File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
packages/react-native-renderer/src/__tests__ Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -1064,4 +1064,36 @@ describe('ReactFabric', () => {
10641064 expect ( TextInputState . focusTextInput ) . toHaveBeenCalledTimes ( 1 ) ;
10651065 expect ( TextInputState . focusTextInput ) . toHaveBeenCalledWith ( viewRef . current ) ;
10661066 } ) ;
1067+
1068+ it ( 'should no-op if calling sendAccessibilityEvent on unmounted refs' , ( ) => {
1069+ const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
1070+ validAttributes : { foo : true } ,
1071+ uiViewClassName : 'RCTView' ,
1072+ } ) ) ;
1073+
1074+ nativeFabricUIManager . sendAccessibilityEvent . mockReset ( ) ;
1075+
1076+ let viewRef ;
1077+ act ( ( ) => {
1078+ ReactFabric . render (
1079+ < View
1080+ ref = { ref => {
1081+ viewRef = ref ;
1082+ } }
1083+ /> ,
1084+ 11 ,
1085+ ) ;
1086+ } ) ;
1087+ const dangerouslyRetainedViewRef = viewRef ;
1088+ act ( ( ) => {
1089+ ReactFabric . stopSurface ( 11 ) ;
1090+ } ) ;
1091+
1092+ ReactFabric . sendAccessibilityEvent (
1093+ dangerouslyRetainedViewRef ,
1094+ 'eventTypeName' ,
1095+ ) ;
1096+
1097+ expect ( nativeFabricUIManager . sendAccessibilityEvent ) . not . toBeCalled ( ) ;
1098+ } ) ;
10671099} ) ;
You can’t perform that action at this time.
0 commit comments