-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add mutable value read/write during render warning #6310
Merged
MatiPl01
merged 13 commits into
main
from
@matipl01/mutable-value-access-during-render-warning
Aug 28, 2024
Merged
Add mutable value read/write during render warning #6310
MatiPl01
merged 13 commits into
main
from
@matipl01/mutable-value-access-during-render-warning
Aug 28, 2024
Conversation
This file contains 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
MatiPl01
commented
Jul 30, 2024
tomekzaw
approved these changes
Jul 30, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
piaskowyk
reviewed
Jul 31, 2024
tomekzaw
reviewed
Aug 1, 2024
a15a12b
to
70fd267
Compare
70fd267
to
d538f1e
Compare
d538f1e
to
837c3b4
Compare
0e9eec1
to
e4bca1d
Compare
github-merge-queue bot
pushed a commit
that referenced
this pull request
Aug 28, 2024
## Summary This PR adds a possibility to customize log level via the `level` property (limit to just see errors or show errors and warnings) and enable/disable strict mode (via `strict` property), which will be useful for changes implemented in [this](#6310) PR to show invalid `.value` access warnings only in the strict mode. ## Example recording https://github.com/user-attachments/assets/232d3b69-d99c-4114-989f-967d9d8c9e22 ## Test plan - Open `EmptyExample` (which will be reverted to the original implementation before merging this PR), - Change logger settings (e.g. the `level` property) via `Animated.configureLogger`, --------- Co-authored-by: Tomasz Żelawski <[email protected]>
837c3b4
to
f87cc00
Compare
Co-authored-by: Tomek Zawadzki <[email protected]>
880a0f5
to
5a7258c
Compare
piaskowyk
approved these changes
Aug 28, 2024
AlbertVilaCalvo
added a commit
to AlbertVilaCalvo/React-Native-Memory-Game
that referenced
this pull request
Oct 21, 2024
The full warning is: [Reanimated] Writing to `value` during component render. Please ensure that you do not access the `value` property or use `set` method of a shared value while React is rendering a component. If you don't want to see this message, you can disable the `strict` mode. Refer to: https://docs.swmansion.com/react-native-reanimated/docs/debugging/logger-configuration for more details. This warning was introduced in version 3.16, in this commit: software-mansion/react-native-reanimated#6310 Also see this issue: dohooo/react-native-reanimated-carousel#706
3 tasks
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
This PR adds warnings shown when the SharedValue
.value
property is accessed (read or written) while the component is being rendered.The initial render is ignored as all reanimated hooks are executed for the first time during the initial render (e.g.
useAnimatedStyle
builds the initial component style).Test plan
.value
property of the shared value from the component function body,