Skip to content

Commit

Permalink
[PAY-1483] Patch RN to fix textinput multiline onchange not firing (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dharit-tan committed Jun 17, 2023
1 parent e9bf14b commit c7800fe
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/audius-client/packages/mobile/patches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ Patch to support full screen swipe gestures in native stack. and navigation draw

## react-native+0.71.8.patch

Patch to prevent a freezing issue on some Android 13 devices when using an inverted FlatList with a lot of text or any animations. See https://github.com/facebook/react-native/issues/35350 and https://github.com/facebook/react-native/issues/30034
Patch to prevent a freezing issue on some Android 13 devices when using an inverted FlatList with a lot of text or any animations. See https://github.com/facebook/react-native/issues/35350 and https://github.com/facebook/react-native/issues/30034

Patch to fix an issue with TextInput not sending onChange events on the first character entered, when multiline is set to true. See https://github.com/facebook/react-native/issues/37784
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,35 @@ index e948a85..0814a98 100644
horizontallyInverted: {
transform: [{scaleX: -1}],
},
diff --git a/node_modules/react-native/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m b/node_modules/react-native/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m
index 1c8f8e0..0542362 100644
--- a/node_modules/react-native/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m
+++ b/node_modules/react-native/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m
@@ -256,21 +256,21 @@ - (BOOL)textView:(__unused UITextView *)textView shouldChangeTextInRange:(NSRang

- (void)textViewDidChange:(__unused UITextView *)textView
{
- if (_ignoreNextTextInputCall) {
+ if (_ignoreNextTextInputCall && [_lastStringStateWasUpdatedWith isEqual:_backedTextInputView.attributedText]) {
_ignoreNextTextInputCall = NO;
return;
}
+ _lastStringStateWasUpdatedWith = _backedTextInputView.attributedText;
_textDidChangeIsComing = NO;
[_backedTextInputView.textInputDelegate textInputDidChange];
}

- (void)textViewDidChangeSelection:(__unused UITextView *)textView
{
- if (_lastStringStateWasUpdatedWith && ![_lastStringStateWasUpdatedWith isEqual:_backedTextInputView.attributedText]) {
+ if (![_lastStringStateWasUpdatedWith isEqual:_backedTextInputView.attributedText]) {
[self textViewDidChange:_backedTextInputView];
_ignoreNextTextInputCall = YES;
}
- _lastStringStateWasUpdatedWith = _backedTextInputView.attributedText;
[self textViewProbablyDidChangeSelection];
}

diff --git a/node_modules/react-native/scripts/.packager.env b/node_modules/react-native/scripts/.packager.env
new file mode 100644
index 0000000..361f5fb
Expand Down

0 comments on commit c7800fe

Please sign in to comment.