react-native-macos/Libraries/Text
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
..
BaseText Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RawText Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
Text Disable `usesFontLeading` for NSLayoutManager on iOS to fix baseline alignment issue on some fonts (#27195) 2020-01-26 19:46:38 -08:00
TextInput Implement TextInput autoFocus natively on iOS (#27803) 2020-01-31 21:56:18 -08:00
VirtualText Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTConvert+Text.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTConvert+Text.m Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTTextAttributes.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTTextAttributes.m Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTTextTransform.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
React-RCTText.podspec iOS: Deprecate iOS 9 / tvOS 9 SDK support 2020-01-02 12:52:12 -08:00
Text.js Text: HostComponent instead of NativeComponent 2019-12-12 14:23:57 -08:00
TextAncestor.js Deploy v0.106.0 to xplat/js 2019-08-23 08:06:44 -07:00
TextProps.js Remove deprecated accessibilityStates property. (#26168) 2019-09-02 11:25:31 -07:00