Skip to content

feat: add ClippingScrollView component#1289

Merged
kirillzyusko merged 2 commits intomainfrom
feat/clipping-scroll-view
Jan 28, 2026
Merged

feat: add ClippingScrollView component#1289
kirillzyusko merged 2 commits intomainfrom
feat/clipping-scroll-view

Conversation

@kirillzyusko
Copy link
Owner

@kirillzyusko kirillzyusko commented Jan 28, 2026

📜 Description

Added ClippingScrollView component (on Android only) that is supposed to act as a polyfill for contentInset: {bottom} property of ScrollView.

💡 Motivation and Context

Those changes are based on my PR from facebook/react-native#49145

The big problem with original PR is that it wasn't working correctly, if we specify all insets/paddings simultaneously. But! It worked well for bottom inset property (keyboard-controller case, because keyboard appears from the bottom of the screen). I think it's risky to ship a code in this state into facebook codebase, so I decided to add those changes into react-native-keyboard-controller first. It's good because:

  • I have a full ownership of the code and I can fix bugs quickly (without waiting for a new RN release);
  • we don't ship buggy code in react-native repository;
  • we don't depend on react-native version and we don't need to write a conditional code, like "if prop is supported, then use new approach and if not, then fallback to old implementation".

The approach that I've choose is based on "decorator" approach - this approach has been used in many other libs, such as advanced-input-mask, live-markdown etc. The idea is that we create our custom view that wraps our target view and then we access a target view as a children (and we can modify behavior/props of this view).

I'm going to use this component in KeyboardAwareScrollView and in new ChatKit component. From lessons learned from the previous experience I can confidently say, that additional view near children will cause issues and this polyfill for contentInset: {bottom} should hopefully solve all the issues that we had. I'll continue experiments with this view in #797

📢 Changelog

JS

  • added codegen component;
  • added new types props for new component;
  • added jsdoc for new component;

Android

  • added ClippingScrollView;

🤔 How Has This Been Tested?

Tested in example app in KeyboardAwareScrollView screen and in new component that is currently under active development 😊 Everywhere works stable on both architectures 🤞

📸 Screenshots (if appropriate):

KeyboardAwareScrollView Non inverted chat list
telegram-cloud-document-2-5463118136163211010.mp4
telegram-cloud-document-2-5463118136163211009.mp4

📝 Checklist

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

@kirillzyusko kirillzyusko self-assigned this Jan 28, 2026
@kirillzyusko kirillzyusko added enhancement New feature or request 🤖 android Android specific labels Jan 28, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2026

📊 Package size report

Current size Target Size Difference
234076 bytes 231594 bytes 2482 bytes 📈

@kirillzyusko kirillzyusko marked this pull request as ready for review January 28, 2026 11:50
@kirillzyusko kirillzyusko merged commit 36abe0b into main Jan 28, 2026
26 checks passed
@kirillzyusko kirillzyusko deleted the feat/clipping-scroll-view branch January 28, 2026 11:59
kirillzyusko added a commit that referenced this pull request Jan 29, 2026
## 📜 Description

Added `ScrollViewWithBottomPadding` component.

## 💡 Motivation and Context

This PR is a logical continuation of
#1289

In this PR I'm building a foundational component that adds scrollable
padding on both iOS/Android without modifying layout. As a result it
gives super smooth keyboard interactions, because we don't recalculate
layout on each frame and we still add scrollable space. Also we achieve
it without additional views, which is also super helpful, since we don't
accidentally break styling.

This component will power next-gen implementation of
`KeyboardAwareScrollView` and future `ChatKit` component.

## 📢 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

- added `ScrollViewWithBottomPadding` component;

## 🤔 How Has This Been Tested?

Tested manually in example project. At the moment not used in the
package, but will be eventually used in `KeyboardAwareScrollView` and
`ChatKit`.

## 📸 Screenshots (if appropriate):

|KeyboardAwareScrollView|Non inverted chat list|
|--------------------------|---------------------|
|<video
src="https://github.com/user-attachments/assets/0f7efef7-ec15-4fe6-96cb-40334f0c91ad">|<video
src="https://github.com/user-attachments/assets/92093e87-434a-4c82-91d5-1c7e9706e5f0">|

## 📝 Checklist

- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 android Android specific enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant