-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9819f37
commit d32adf6
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
patches/react-native+0.73.4+025+on-content-size-changed-on-mount-android.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
diff --git a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java | ||
index 26dc163..4dd8a47 100644 | ||
--- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java | ||
+++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java | ||
@@ -18,6 +18,8 @@ import android.graphics.Paint; | ||
import android.graphics.PorterDuff; | ||
import android.graphics.drawable.Drawable; | ||
import android.os.Build; | ||
+import android.os.Handler; | ||
+import android.os.Looper; | ||
import android.text.Editable; | ||
import android.text.InputFilter; | ||
import android.text.InputType; | ||
@@ -1231,12 +1233,14 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout | ||
mPreviousContentHeight = contentHeight; | ||
mPreviousContentWidth = contentWidth; | ||
|
||
- mEventDispatcher.dispatchEvent( | ||
- new ReactContentSizeChangedEvent( | ||
- mSurfaceId, | ||
- mEditText.getId(), | ||
- PixelUtil.toDIPFromPixel(contentWidth), | ||
- PixelUtil.toDIPFromPixel(contentHeight))); | ||
+ // fixes `onContentSizeChanged` not being fired in JS on mount | ||
+ Handler handler = new Handler(Looper.getMainLooper()); | ||
+ handler.postDelayed(() -> mEventDispatcher.dispatchEvent( | ||
+ new ReactContentSizeChangedEvent( | ||
+ mSurfaceId, | ||
+ mEditText.getId(), | ||
+ PixelUtil.toDIPFromPixel(mPreviousContentWidth), | ||
+ PixelUtil.toDIPFromPixel(mPreviousContentHeight))), 1); | ||
} | ||
} | ||
} |