Repository navigation
Conversation
…the shared values they read
… its component commits
…nput, and does not run inside itself
…-on-commit' into fix/reanimated-render-only-hooks # Conflicts: # packages/vitest-native/src/presets/reanimated.ts
…or changeset with what changes
…he act warning and the merge
This branch has not been deployed
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.
Summary
useDerivedValue,useAnimatedStyle,useAnimatedPropsanduseAnimatedReactionfromreact-native-reanimatednow run on one mapper scheduler modelled on Reanimated'smappers.ts. Styles and props follow the shared values they read without a render, and reactions run. Fixes #754.Why
Reanimated's own test mock, and the built-in preset for older versions, ran the style and props updaters only at render and never called a reaction. A test that called
progress.set(0.5)and thentoHaveAnimatedStylesaw the old style, and a child React skipped (for example one React Compiler memoized) kept its first one.Changes
presets/reanimated.ts. A write marks every mapper that read the value dirty, then runs one pass in topological order, each mapper once. A write made during a pass does not start another (processingMappers). A mapper that writes its own input stays dirty for the next pass. Mappers start in an effect and stop on unmount.previousand dependency rules. Each run uses the latest committed render's functions.pre-754-reanimated-animated-style-stale.Notes