Skip to content

Commit

Permalink
fix: forward ref to KeyboardAwareScrollView (#345)
Browse files Browse the repository at this point in the history
## 馃摐 Description

Right now it's impossible to assign `ref` on `KeyboardAwareScrollView`
and access `ScrollView` methods. This PR fixes this problem.

## 馃挕 Motivation and Context

It's important to have `ref` in many cases - so I think motivation why
it's needed is pretty clear 馃槄

The technical aspect is a little bit tricky, since internally we also
use `ref` (from REA hook) and we need to propagate it from inside the
component. To achieve this I added `onRef` callback that manages
everything 馃槑 It uses single ref and derives a reanimated ref + assigns
plain `ref` for typical RN usage.

This PR has a lot of changes, but it's because of prettier. Main changes
are `onRef` + `forwardRef` component wrap.

## 馃摙 Changelog

### JS

- `forwardRef` on `KeyboardAwareScrollView`;
- manage (clone) refs inside `KeyboardAwareScrollView` for reanimated
usage + assign it to forwarded ref;

## 馃 How Has This Been Tested?

Tested manually on Xiaomi Redmi Note 5 Pro.

## 馃摑 Checklist

- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
  • Loading branch information
kirillzyusko committed Jan 29, 2024
1 parent 2c93b82 commit 7d78983
Showing 1 changed file with 216 additions and 198 deletions.

0 comments on commit 7d78983

Please sign in to comment.