Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: forward ref to KeyboardAwareScrollView #345

Merged
merged 1 commit into from
Jan 29, 2024
Merged

Conversation

kirillzyusko
Copy link
Owner

@kirillzyusko kirillzyusko commented Jan 29, 2024

📜 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

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

@kirillzyusko kirillzyusko added 🐛 bug Something isn't working 📚 components Anything related to the exported components of this library labels Jan 29, 2024
@kirillzyusko kirillzyusko self-assigned this Jan 29, 2024
Copy link
Contributor

github-actions bot commented Jan 29, 2024

📊 Package size report

Current size Target Size Difference
115589 bytes 115228 bytes 361 bytes 📈

@kirillzyusko kirillzyusko marked this pull request as ready for review January 29, 2024 17:29
@kirillzyusko kirillzyusko merged commit 7d78983 into main Jan 29, 2024
6 checks passed
@kirillzyusko kirillzyusko deleted the fix/kasv-forward-ref branch January 29, 2024 20:00
@kirillzyusko kirillzyusko added the KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 📚 components Anything related to the exported components of this library KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant