AI Chat Keyboard Example: Add Android scroll-clamp workaround for keyboard-controller bug 1453#442
Conversation
…in ai-chat fixture
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66b3f8d4b9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ); | ||
|
|
||
| const contentContainerStyle = useMemo<ViewStyle | null>( | ||
| () => (spacerHeight > 0 ? { paddingTop: spacerHeight } : null), |
There was a problem hiding this comment.
Make the spacer scroll range reachable
When the actual chat content is shorter than the list viewport, adding only paddingTop: spacerHeight does not make scrollY >= spacerHeight reachable: the maximum offset is roughly spacerHeight + contentHeight - viewportHeight, which is still below spacerHeight unless the real content is at least one viewport tall. On the initial Android fixture after this commit shortens INITIAL_AI_TEXT, scrollTo(..., spacer) will clamp below the spacer, leaving the injected blank area visible and the keyboard-controller short-content case still broken. Add enough trailing/bottom space or compute the spacer from the measured content so the clamp target is within the scrollable range.
Useful? React with 👍 / 👎.
Use a paddingTop spacer and scroll clamping to work around kirillzyusko/react-native-keyboard-controller#1453
This ensures the content will always be long enough to be scrollable on Android.
This is a competing workaround with #443 and only one of them should be used.