From 791bf489db1909e1153de62bce1f42a7cb8e174b Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Mon, 29 Jan 2024 14:24:31 +0800 Subject: [PATCH] ignore layout value when width and height is 0 --- src/components/TextInput/BaseTextInput/index.native.tsx | 3 +++ src/components/TextInput/BaseTextInput/index.tsx | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/components/TextInput/BaseTextInput/index.native.tsx b/src/components/TextInput/BaseTextInput/index.native.tsx index c26ab8700bc0..7a230bc90fe4 100644 --- a/src/components/TextInput/BaseTextInput/index.native.tsx +++ b/src/components/TextInput/BaseTextInput/index.native.tsx @@ -426,6 +426,9 @@ function BaseTextInput( styles.visibilityHidden, ]} onLayout={(e) => { + if (e.nativeEvent.layout.width === 0 && e.nativeEvent.layout.height === 0) { + return; + } setTextInputWidth(e.nativeEvent.layout.width); setTextInputHeight(e.nativeEvent.layout.height); }} diff --git a/src/components/TextInput/BaseTextInput/index.tsx b/src/components/TextInput/BaseTextInput/index.tsx index 49b203b37567..7ca8c69153f1 100644 --- a/src/components/TextInput/BaseTextInput/index.tsx +++ b/src/components/TextInput/BaseTextInput/index.tsx @@ -447,6 +447,9 @@ function BaseTextInput( styles.visibilityHidden, ]} onLayout={(e) => { + if (e.nativeEvent.layout.width === 0 && e.nativeEvent.layout.height === 0) { + return; + } let additionalWidth = 0; if (Browser.isMobileSafari() || Browser.isSafari() || Browser.isMobileChrome()) { additionalWidth = 2;