react-native-macos/Libraries/Text/TextInput
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
..
Multiline Add blur and focus native commands to TextInput 2020-01-20 03:08:23 -08:00
Singleline Fabric: <TextInput> component on iOS: RCTTextInputUtils 2020-01-13 23:22:10 -08:00
RCTBackedTextInputDelegate.h New delegate method in RCTBackedTextInputDelegate and its implementation 2019-12-01 19:09:49 -08:00
RCTBackedTextInputDelegateAdapter.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTBackedTextInputDelegateAdapter.m New delegate method in RCTBackedTextInputDelegate and its implementation 2019-12-01 19:09:49 -08:00
RCTBackedTextInputViewProtocol.h TextInput: Refactoring of RCTBackedTextInputViewProtocol (merging some props into defaultTextAttributes) 2019-12-13 09:03:04 -08:00
RCTBaseTextInputShadowView.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTBaseTextInputShadowView.m Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTBaseTextInputView.h Implement TextInput autoFocus natively on iOS (#27803) 2020-01-31 21:56:18 -08:00
RCTBaseTextInputView.m Implement TextInput autoFocus natively on iOS (#27803) 2020-01-31 21:56:18 -08:00
RCTBaseTextInputViewManager.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTBaseTextInputViewManager.m Implement TextInput autoFocus natively on iOS (#27803) 2020-01-31 21:56:18 -08:00
RCTInputAccessoryShadowView.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTInputAccessoryShadowView.m Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTInputAccessoryView.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTInputAccessoryView.m Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTInputAccessoryViewContent.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTInputAccessoryViewContent.m Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTInputAccessoryViewManager.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTInputAccessoryViewManager.m Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTTextSelection.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTTextSelection.m Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00