Skip to content

Commit 9acd790

Browse files
authored
fix: remove unnecessary code (#1389)
## 📜 Description Removed a fix with increased padding by `+1`. ## 💡 Motivation and Context This code has been added in #342 But these changes became irrelevant after #1381 Since we started to change frame to full-height frame once per the animation we no longer have a condition described in #342 Additionally #332 is no longer reproducible, because in #797 we already were fighting with "ghost view" issue and fix for this problem also fixes #332 (just in a different way). So to sum it up: - we no longer need to adjust spacer each frame; - we no longer need a fix with artificial spacer increasing 🤞 ## 📢 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 - don't apply `+1` to keyboard spacer size in `KeyboardAwareScrollView`; ## 🤔 How Has This Been Tested? Tested manually on Redmi Note 5 Pro (Android 9). ## 📸 Screenshots (if appropriate): |Current code|Latest main (before PR changes)|1.20.7 release| |-------------|---------------------------------|-------------| |<video src="https://github.com/user-attachments/assets/7ab3477c-eedd-42da-9af9-5bdb0c842284">|<video src="https://github.com/user-attachments/assets/8697e5e6-84d3-49c5-adb6-2d286cd9ccaa">|<video src="https://github.com/user-attachments/assets/37c9b30c-8aa8-470a-9255-8c4a3d752a95">| ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
1 parent 90dd772 commit 9acd790

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

  • src/components/KeyboardAwareScrollView

src/components/KeyboardAwareScrollView/index.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -553,14 +553,8 @@ const KeyboardAwareScrollView = forwardRef<
553553
[],
554554
);
555555

556-
// animations become choppy when scrolling to the end of the `ScrollView` (when the last input is focused)
557-
// this happens because the layout recalculates on every frame. To avoid this we slightly increase padding
558-
// by `+1`. In this way we assure, that `scrollTo` will never scroll to the end, because it uses interpolation
559-
// from 0 to `keyboardHeight`, and here our padding is `keyboardHeight + 1`. It allows us not to re-run layout
560-
// re-calculation on every animation frame and it helps to achieve smooth animation.
561-
// see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/342
562556
const padding = useDerivedValue(
563-
() => (enabled ? currentKeyboardFrameHeight.value + 1 : 0),
557+
() => (enabled ? currentKeyboardFrameHeight.value : 0),
564558
[enabled],
565559
);
566560

0 commit comments

Comments
 (0)