Skip to content

Commit b5fb835

Browse files
authored
refactor: change conditional code in KeyboardAvoidingView (#1257)
## 📜 Description Compare `OS` only with `ios` string. ## 💡 Motivation and Context We want `KeyboardAvoidingView` to have `translate` specific behavior only for iOS (because only this platform can smoothly animate instant changes). Before we were comparing `OS` with `android` to make it "android specific" behavior, but in reality it should be "non-iOS behavior", so i'm flipping the condition in this PR. Since we support only two platforms it shouldn't make any difference, but for web which will work in the same way as android it makes a lot of sense, because otherwise it will not be able to animate it properly. ## 📢 Changelog <!-- High level overview of important changes --> <!-- For example: fixed status bar manipulation; added new types declarations; --> <!-- If your changes don't affect one of platform/language below - then remove this platform/language --> ### JS - flip `OS === "android"` into `OS !== "ios"` condition; ## 🤔 How Has This Been Tested? Tested via this PR. ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
1 parent e5438be commit b5fb835

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • src/components/KeyboardAvoidingView

src/components/KeyboardAvoidingView/hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export const useTranslateAnimation = () => {
8888
onMove: (e) => {
8989
"worklet";
9090

91-
if (OS === "android") {
91+
if (OS !== "ios") {
9292
translate.value = e.progress;
9393
}
9494
},
@@ -104,7 +104,7 @@ export const useTranslateAnimation = () => {
104104

105105
padding.value = e.progress;
106106

107-
if (OS === "android") {
107+
if (OS !== "ios") {
108108
translate.value = e.progress;
109109
}
110110
},

0 commit comments

Comments
 (0)