mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fix: do not overwrite external inputAccessoryView on Fabric (#48339)
Summary: If 3rd party libs are using `inputAccessoryView` - the current code can easily break it. Whenever props gets changed we call `setDefaultInputAccessoryView` which will simply overwrite the current `inputAccessoryView` (which is highly undesirable). The same fix on paper was made ~7 years ago: https://github.com/facebook/react-native/commit/bf3698323d81508fc77174df2b1ffe5fb03224e7 ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [IOS] [FIXED] - Fixed problem with accessory view & 3rd party libs For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: https://github.com/facebook/react-native/pull/48339 Test Plan: Make sure `inputAccessoryView` functionality works as before Reviewed By: javache Differential Revision: D67451188 Pulled By: cipolleschi fbshipit-source-id: bc3fa82ae15f8acedfd0b4e17bdea69cbd8c8a8d
This commit is contained in:
+5
-1
@@ -68,6 +68,8 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
||||
* later comparison insensitive to them.
|
||||
*/
|
||||
NSDictionary<NSAttributedStringKey, id> *_originalTypingAttributes;
|
||||
|
||||
BOOL _hasInputAccessoryView;
|
||||
}
|
||||
|
||||
#pragma mark - UIView overrides
|
||||
@@ -610,10 +612,12 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
||||
keyboardType == UIKeyboardTypeDecimalPad || keyboardType == UIKeyboardTypeASCIICapableNumberPad) &&
|
||||
(containsKeyType || containsInputAccessoryViewButtonLabel);
|
||||
|
||||
if ((_backedTextInputView.inputAccessoryView != nil) == shouldHaveInputAccessoryView) {
|
||||
if (_hasInputAccessoryView == shouldHaveInputAccessoryView) {
|
||||
return;
|
||||
}
|
||||
|
||||
_hasInputAccessoryView = shouldHaveInputAccessoryView;
|
||||
|
||||
if (shouldHaveInputAccessoryView) {
|
||||
NSString *buttonLabel = inputAccessoryViewButtonLabel != nil ? inputAccessoryViewButtonLabel
|
||||
: [self returnKeyTypeToString:returnKeyType];
|
||||
|
||||
Reference in New Issue
Block a user