File tree 1 file changed +30
-2
lines changed
packages/react-native/Libraries/ReactNative
1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -217,10 +217,38 @@ const UIManagerJSPlatformAPIs = Platform.select({
217
217
return { } ;
218
218
} ,
219
219
focus : ( reactTag : ?number ) : void => {
220
- raiseSoftError ( 'focus ') ;
220
+ if ( reactTag == null ) {
221
+ console . error (
222
+ `focus ( ) noop : Cannot be called with ${String ( reactTag ) } reactTag `,
223
+ ) ;
224
+ return ;
225
+ }
226
+
227
+ const FabricUIManager = nullthrows ( getFabricUIManager ( ) ) ;
228
+ const shadowNode =
229
+ FabricUIManager . findShadowNodeByTag_DEPRECATED ( reactTag ) ;
230
+ if ( ! shadowNode ) {
231
+ console . error ( `focus ( ) noop : Cannot find view with tag #${ reactTag } `) ;
232
+ return ;
233
+ }
234
+ FabricUIManager . dispatchCommand ( shadowNode , 'focus ', [ ] ) ;
221
235
} ,
222
236
blur : ( reactTag : ?number ) : void => {
223
- raiseSoftError ( 'blur ') ;
237
+ if ( reactTag == null ) {
238
+ console . error (
239
+ `blur ( ) noop : Cannot be called with ${String ( reactTag ) } reactTag `,
240
+ ) ;
241
+ return ;
242
+ }
243
+
244
+ const FabricUIManager = nullthrows ( getFabricUIManager ( ) ) ;
245
+ const shadowNode =
246
+ FabricUIManager . findShadowNodeByTag_DEPRECATED ( reactTag ) ;
247
+ if ( ! shadowNode ) {
248
+ console . error ( `blur ( ) noop : Cannot find view with tag #${ reactTag } `) ;
249
+ return ;
250
+ }
251
+ FabricUIManager . dispatchCommand ( shadowNode , 'blur ', [ ] ) ;
224
252
} ,
225
253
} ,
226
254
} ) ;
You can’t perform that action at this time.
0 commit comments