Skip to content

Commit c9df1db

Browse files
vonovakfacebook-github-bot
authored andcommitted
allow custom maybeSetText logic for ReactEditText subclasses (#24927)
Summary: We're working on a custom EditText that supports some rich text editing, and one of the places where our logic has to be different from the textinput provided by RN is the text setting logic: https://github.com/facebook/react-native/blob/7abfd23b90db08b426c3c91b0cb6d01d161a9b9e/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java#L377 However, some of the important members are private and our subclass cannot access them (we work around this now with reflection). It would be nice if we could work with them directly, either using getters and setters or by changing the access. Let me know what you think about this. Thanks. ## Changelog [Android] [Added] - allow custom maybeSetText logic for ReactEditText subclasses Pull Request resolved: #24927 Differential Revision: D15431682 Pulled By: cpojer fbshipit-source-id: 91860cadac0798a101ff7df6f6b868f3980ba9b1
1 parent 80258b5 commit c9df1db

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@ public class ReactEditText extends EditText {
5858
// This flag is set to true when we set the text of the EditText explicitly. In that case, no
5959
// *TextChanged events should be triggered. This is less expensive than removing the text
6060
// listeners and adding them back again after the text change is completed.
61-
private boolean mIsSettingTextFromJS;
61+
protected boolean mIsSettingTextFromJS;
6262
// This component is controlled, so we want it to get focused only when JS ask it to do so.
6363
// Whenever android requests focus (which it does for random reasons), it will be ignored.
6464
private boolean mIsJSSettingFocus;
6565
private int mDefaultGravityHorizontal;
6666
private int mDefaultGravityVertical;
67-
private int mNativeEventCount;
68-
private int mMostRecentEventCount;
67+
protected int mNativeEventCount;
68+
protected int mMostRecentEventCount;
6969
private @Nullable ArrayList<TextWatcher> mListeners;
7070
private @Nullable TextWatcherDelegator mTextWatcherDelegator;
7171
private int mStagedInputType;
72-
private boolean mContainsImages;
72+
protected boolean mContainsImages;
7373
private @Nullable Boolean mBlurOnSubmit;
7474
private boolean mDisableFullscreen;
7575
private @Nullable String mReturnKeyType;

0 commit comments

Comments
 (0)