react-native-macos/Libraries
Janic Duplessis 6adba409e6 Implement TextInput autoFocus natively on iOS (#27803)
Summary:
This implement the autoFocus functionality natively instead of calling the focus method from JS on mount. This is needed to properly fix the issue described in https://github.com/facebook/react-native/issues/27217, where when using native navigation (UINavigationController) text input focus needs to happen in the same frame transition starts or it leads to an animation bug in UIKit.

My previous attempt fixed the problem only partially and the bug could still happen since there is no guaranty code executed in useEffect will end up in the same frame as the native view being created and attached.

To fix this I added an autoFocus prop to the native component on iOS and in didAttachToWindow we focus the input if it is set. This makes sure the focus is set in the same frame as the view hierarchy containing the input is created.

## Changelog

[iOS] [Fixed] - Add native support for TextInput autoFocus on iOS
Pull Request resolved: https://github.com/facebook/react-native/pull/27803

Test Plan:
- Tested that the UI glitch when transitionning to a screen with an input with autofocus no longer happens in my app.
- Tested that autofocus still works in RNTester
- Made sure that onFocus does get called and TextInputState is updated properly

Differential Revision: D19673369

Pulled By: TheSavior

fbshipit-source-id: 14d8486ac635901622ca667c0e61c75fb446e493
2020-01-31 21:56:18 -08:00
..
ART iOS: Deprecate iOS 9 / tvOS 9 SDK support 2020-01-02 12:52:12 -08:00
ActionSheetIOS iOS: Deprecate iOS 9 / tvOS 9 SDK support 2020-01-02 12:52:12 -08:00
Alert Exact-by-default codemod for react-native-github 2019-11-21 09:42:57 -08:00
Animated Allow zIndex to useNativeDriver (#27418) 2020-01-30 22:15:41 -08:00
AppState TM JS: Revert to import from TurboModuleRegistry.js 2019-11-08 11:44:16 -08:00
BatchedBridge Exact-by-default codemod for react-native-github 2019-11-21 09:42:57 -08:00
Blob Transform empty responses into empty Blobs 2020-01-27 10:27:14 -08:00
BugReporting Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
CameraRoll iOS: guard image picker logic to check for the right source type 2019-12-20 01:41:02 -08:00
Components Add a hand-written JS view config for RCTSinglelineTextInputView 2020-01-30 15:30:11 -08:00
Core Backwards-compatible implementation for registerCallableModule 2019-12-17 18:38:57 -08:00
DeprecatedPropTypes Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
EventEmitter Exact-by-default codemod for react-native-github 2019-11-21 09:42:57 -08:00
Experimental Remove IncrementalPresenter 2019-12-07 10:41:54 -08:00
FBLazyVector Rename isolation root to "default" in fbobjc 2020-01-24 08:26:36 -08:00
FBReactNativeSpec Rename isolation root to "default" in fbobjc 2020-01-24 08:26:36 -08:00
HeapCapture Fix NativeJSCHeapCapture 2020-01-14 08:03:49 -08:00
Image Make C++ requirement opt-in (#27730) 2020-01-28 13:14:35 -08:00
Inspector Convert Inspector to call ref.measure 2019-12-17 20:09:25 -08:00
Interaction Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
JSInspector Exact-by-default codemod for react-native-github 2019-11-21 09:42:57 -08:00
LayoutAnimation Export LayoutAnimationConfig type 2020-01-28 17:10:30 -08:00
Linking Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
LinkingIOS Upgrade Folly to v2020.01.13.00 (#27810) 2020-01-21 12:44:00 -08:00
Lists Log VirtualizedList nesting hierarchy in listKey collision error 2020-01-28 11:34:14 -08:00
LogBox LogBox - Add build version and open in browser 2020-01-29 06:23:26 -08:00
Modal LogBox - Update to use it's own root for the inspector 2019-12-10 02:31:38 -08:00
NativeAnimation Upgrade Folly to v2020.01.13.00 (#27810) 2020-01-21 12:44:00 -08:00
NativeModules/specs Add missing NativeEventListener methods to NativeDevSettings (#27838) 2020-01-23 13:20:53 -08:00
Network Transform empty responses into empty Blobs 2020-01-27 10:27:14 -08:00
NewAppScreen Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
Performance Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
PermissionsAndroid Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
Pressability Pressability: Support Rect or Numeric Size 2020-01-28 15:14:23 -08:00
PushNotificationIOS Upgrade Folly to v2020.01.13.00 (#27810) 2020-01-21 12:44:00 -08:00
RCTRequired Rename isolation root to "default" in fbobjc 2020-01-24 08:26:36 -08:00
ReactNative Remove method findShadowNodeByTag_DEPRECATED from UIManagerBinding class 2019-12-23 17:09:44 -08:00
ReactPrivate Add annotations to ReactNativePrivateInterface 2019-08-22 17:50:36 -07:00
Renderer React Native sync for revisions 6cff70a...19f6fe1 2020-01-09 11:18:06 -08:00
Settings Upgrade Folly to v2020.01.13.00 (#27810) 2020-01-21 12:44:00 -08:00
Share Share - title is not a valid attribute in iOS (#27351) 2019-12-04 15:49:22 -08:00
Storage Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
StyleSheet Pressability: Support Rect or Numeric Size 2020-01-28 15:14:23 -08:00
SurfaceBackedComponent Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
SurfaceHostingComponent Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
Text Implement TextInput autoFocus natively on iOS (#27803) 2020-01-31 21:56:18 -08:00
TurboModule Clear some lint warnings (#27893) 2020-01-29 04:36:28 -08:00
TypeSafety Upgrade Folly to v2020.01.13.00 (#27810) 2020-01-21 12:44:00 -08:00
Types Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
Utilities Ignore deprecatedPropType in bridgeless mode 2020-01-29 12:02:48 -08:00
Vibration Upgrade Folly to v2020.01.13.00 (#27810) 2020-01-21 12:44:00 -08:00
WebSocket Clear some lint warnings (#27893) 2020-01-29 04:36:28 -08:00
Wrapper Tidy up license headers [3/n] 2019-10-16 10:06:34 -07:00
YellowBox LogBox fixes for OSS 2019-12-18 19:28:56 -08:00
__flowtests__ Manually fix places the codemod doesnt hit 2019-11-19 13:38:18 -08:00
polyfills Remove groupCollapsed from list of unsupported polyfills 2019-12-06 13:35:47 -08:00
vendor RN: Delete `merge[Into]` 2019-10-12 15:52:27 -07:00
.npmignore npmignore: ignore tests and fixtures 2018-02-27 08:42:14 -08:00
Promise.js Don't crash when pretty-format is not available 2019-11-19 16:22:29 -08:00
UTFSequence.js Clean-up $TEMPORARY$object in xplat/js/react-native-github 2019-08-21 09:58:24 -07:00
promiseRejectionIsError.js Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00