Skip to content

fix: support dynamic bottomOffset for KeyboardAwareScrollView#952

Merged
kirillzyusko merged 1 commit intomainfrom
fix/keyboard-aware-scroll-view-supports-dynamic-bottom-offset
May 23, 2025
Merged

fix: support dynamic bottomOffset for KeyboardAwareScrollView#952
kirillzyusko merged 1 commit intomainfrom
fix/keyboard-aware-scroll-view-supports-dynamic-bottom-offset

Conversation

@kirillzyusko
Copy link
Copy Markdown
Owner

@kirillzyusko kirillzyusko commented May 22, 2025

📜 Description

React on bottomOffset changes reactively.

💡 Motivation and Context

In current implementation we change callbacks and they will use an updated value in next calls, but the call to maybeScroll function is missing.

So in this PR I'm force-calling maybeScroll when bottomOffset gets changed, so in this way we always respect actual bottomOffset value 😊

Closes #930 #743

📢 Changelog

JS

  • call maybeScroll when bottomOffset gets changed;

🤔 How Has This Been Tested?

Tested manually in FabricExample app with next code modification:

const [offset, setOffset] = useState(0);
// ...
<KeyboardAwareScrollView
  bottomOffset={offset}
// ...
<TextInput
  key={i}
  contextMenuHidden={i === 4 && Platform.OS === "ios"}
  keyboardType={i % 2 === 0 ? "numeric" : "default"}
  placeholder={`TextInput#${i}`}
  onChangeText={setText}
  onFocus={() => {
    setOffset(i * 10)
  }}
/>

Verified by e2e tests that it doesn't introduce breaking changes.

📸 Screenshots (if appropriate):

Screen.Recording.2025-05-23.at.13.09.10.1.mov

📝 Checklist

  • CI successfully passed
  • I added new mocks and corresponding unit-tests if library API was changed

@kirillzyusko kirillzyusko self-assigned this May 22, 2025
@kirillzyusko kirillzyusko added 🐛 bug Something isn't working KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component labels May 22, 2025
@github-actions
Copy link
Copy Markdown
Contributor

📊 Package size report

Current size Target Size Difference
199639 bytes 199476 bytes 163 bytes 📈

@kirillzyusko kirillzyusko linked an issue May 22, 2025 that may be closed by this pull request
@kirillzyusko kirillzyusko marked this pull request as ready for review May 23, 2025 11:18
@kirillzyusko kirillzyusko merged commit c5c0077 into main May 23, 2025
12 checks passed
@kirillzyusko kirillzyusko deleted the fix/keyboard-aware-scroll-view-supports-dynamic-bottom-offset branch May 23, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component

Projects

None yet

1 participant