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 includes the following changes:
null
).fixElementPosition
only when parent is defined.These checks are expected to eliminate
cannot read properties of null
error.Origin of this PR
This PR originates from discussion on discord, where it was reported that layout animations crash on web when using
react-navigation
andexpo-router
. Crashes happen whendisplay: none;
is set. We are not sure what is the exact cause of this issue. However, our main suspect isMutationObserver
insidedomUtils.ts
. Also, we don't know whyelement
isnull
, but we believe that it can happen because of this line, since this is the only place where we assign something to_component
.Snippet from discord
The snippet provided on discord looks like this:
As you can tell it uses
Tailwind
. Unfortunately it doesn't help much.Error message
Original error message looks like this:
By looking at this error we were able to identify that the crash happens during exiting animation. We still don't know which one is null in this case -
parent
orelement
.Test Plan
We struggle to prepare a reproduction as it is very rare problem. However, I believe that the changes are effective.