diff --git a/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m b/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m index 34994ca4fd115c..77d70d14c769c8 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m @@ -132,7 +132,9 @@ - (void)setBridge:(RCTBridge *)bridge } RCTExecuteOnUIManagerQueue(^{ RCTBaseTextInputShadowView *shadowView = (RCTBaseTextInputShadowView *)[self.bridge.uiManager shadowViewForReactTag:viewTag]; - [shadowView setText:value]; + if (value) { + [shadowView setText:value]; + } [self.bridge.uiManager setNeedsLayout]; RCTExecuteOnMainQueue(^{ [view setSelectionStart:start selectionEnd:end]; diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm index bbe622eebfc163..589ff99ac7cc38 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm @@ -420,7 +420,7 @@ - (void)setTextAndSelection:(NSInteger)eventCount return; } _comingFromJS = YES; - if (![value isEqualToString:_backedTextInputView.attributedText.string]) { + if (value && ![value isEqualToString:_backedTextInputView.attributedText.string]) { NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:value attributes:_backedTextInputView.defaultTextAttributes]; [self _setAttributedString:attributedString]; diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java index 0b6298fdd1f489..9581583b6cb00b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java @@ -288,16 +288,17 @@ public void receiveCommand( return; } - String text = args.getString(1); - int start = args.getInt(2); int end = args.getInt(3); if (end == UNSET) { end = start; } - reactEditText.maybeSetTextFromJS( - getReactTextUpdate(text, mostRecentEventCount, start, end)); + if (!args.isNull(1)) { + String text = args.getString(1); + reactEditText.maybeSetTextFromJS( + getReactTextUpdate(text, mostRecentEventCount, start, end)); + } reactEditText.maybeSetSelection(mostRecentEventCount, start, end); break; }