Skip to content

Commit ee9926c

Browse files
committed
Fix excessive emits of keyboardDidShow event on iOS
1 parent 2d6a323 commit ee9926c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,13 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
300300

301301
if (newTextInputProps.inputAccessoryViewID != oldTextInputProps.inputAccessoryViewID) {
302302
_backedTextInputView.inputAccessoryViewID = RCTNSStringFromString(newTextInputProps.inputAccessoryViewID);
303+
304+
// InputAccessoryView component sets the inputAccessoryView when inputAccessoryViewID exists
305+
if (_backedTextInputView.inputAccessoryViewID) {
306+
if (_backedTextInputView.isFirstResponder) {
307+
[_backedTextInputView reloadInputViews];
308+
}
309+
}
303310
}
304311

305312
if (newTextInputProps.inputAccessoryViewButtonLabel != oldTextInputProps.inputAccessoryViewButtonLabel) {
@@ -639,9 +646,6 @@ - (void)setDefaultInputAccessoryView
639646
{
640647
// InputAccessoryView component sets the inputAccessoryView when inputAccessoryViewID exists
641648
if (_backedTextInputView.inputAccessoryViewID) {
642-
if (_backedTextInputView.isFirstResponder) {
643-
[_backedTextInputView reloadInputViews];
644-
}
645649
return;
646650
}
647651

0 commit comments

Comments
 (0)