refactor: don't use private reanimated API#1209
Merged
kirillzyusko merged 4 commits intomainfrom Nov 21, 2025
Merged
Conversation
Contributor
📊 Package size report
|
2650061 to
f419fb5
Compare
2 tasks
kirillzyusko
added a commit
that referenced
this pull request
Nov 21, 2025
## 📜 Description Remove a note that library is not compatible with Expo Go. ## 💡 Motivation and Context Technically support has landed for `1.17.5` in expo/expo#37942 and starting from SDK 54 Expo Go officially supports `1.18.5`. However in Expo snacks there was a crash. I fixed it here: #1209 and these changes will be included in `1.20.0`. So I decided to update documentation page in order not to mislead developers. Starting from version `1.20.x` this package will be fully supported by Expo and I'm planning to use snacks and make documentation even more interactive 😎 ## 📢 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 --> ### Docs - remove a message that lib is not compatible with Expo Go. ## 🤔 How Has This Been Tested? Tested via preview. ## 📸 Screenshots (if appropriate): <img width="1000" height="529" alt="image" src="https://github.com/user-attachments/assets/912cc4aa-07ab-45cf-9a59-97c3f41b965f" /> ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
2 tasks
kirillzyusko
added a commit
that referenced
this pull request
Dec 3, 2025
## 📜 Description Fixed `The final argument passed to %s changed size between renders. The order and size of this array must remain constant.` warning. ## 💡 Motivation and Context This warning happens inside `useSmoothKeyboardHandler` and started to happen after #1209 The main difference from these changes is that we started to use `useHandler`/`useEvent` hooks, while in the past we simply used direct worklet registration. Turns out `useAnimatedReaction` modifies array of dependencies: ```tsx if (dependencies === undefined) { dependencies = [ ...Object.values(prepare.__closure ?? {}), ...Object.values(react.__closure ?? {}), prepare.__workletHash, react.__workletHash, ]; } else { dependencies.push(prepare.__workletHash, react.__workletHash); } ``` Then `useHandler` (used in `useKeyboardHandler`) uses `buildDependencies` which also modifies the array of dependencies: ```ts dependencies.push(buildWorkletsHash(handlersList)); ``` So if we use deps like: ```ts const useMyCustomHook = (deps) => { useAnimatedReaction(() => {}, deps); useKeyboardHandler({}, deps); } ``` Then we'll get this warning because we mutate deps two times. To fix this issue I decided to make a shallow copy of `deps` for `useAnimatedReaction` hook. It fixes the problem 🤞 Closes #1228 ## 📢 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 - create shallow array copy for `useAnimatedReaction` in `useSmoothKeyboardHandler`; ## 🤔 How Has This Been Tested? Tested manually on iPhone 16 Pro. ## 📸 Screenshots (if appropriate): |Before|After| |-------|-----| |<video src="https://github.com/user-attachments/assets/a82b9e6d-adb9-4530-9f2c-2b50ec954386">|<video src="https://github.com/user-attachments/assets/e8fe2cac-bb8c-47eb-89ac-b8d34d01591f">| ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Added a support for Expo snack.
💡 Motivation and Context
In this PR I re-worked the approach how I attach worklet handlers to
KeyboardControllerView. Prior to #538 we simply broadcasted events for stored worklet handlers inside a global object. But this approach had downsides, such as slow flow of execution, so I re-worked it in #538 and instantly introduced issues like: #551 and #555While I managed somehow to fix it, the new approach wasn't ideal:
I kept the idea to re-work this piece of code and in this PR I'm doing it. I can not use public API only, but the new approach is actually smarter. The new idea is that we still use
registerEventShould fix errors like:
Actually correct solution for: #555
In future I'll be able to add interactive code samples into documentation, so people can run demos straight in the browser.
📢 Changelog
JS
event-handlerfiles;event-mappingfile;useEvent/useHandlerhook foruseKeyboardHandleranduseFocusedInputHandlerhooks;registerForEvents/unregisterFromEventsmethods fromWorkletEventHandler(instance returned byuseEventhook);🤔 How Has This Been Tested?
Tested manually on:
📸 Screenshots (if appropriate):
📝 Checklist