-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
What happened?
For Android (worse in 15+) there's an issue only in release builds where using measure or measureInWindow on a View gives incorrect and inconsistent x and y coordinates.
If I push/pop the screen again the same view will give me different x and y coordinates. This is due to the animation when performing push/pop.
I've put in custom push/pop animations which fixes most screens but some views are still slightly off. I suspect the translate X/Y on the default animations is confusing the renderer as to the true position of views.
animations:
Platform.OS === "android"
? {
push: {
content: {
enter: {
scaleX: {
from: 0.85,
to: 1,
duration: 300,
interpolation: { type: "decelerate" },
},
scaleY: {
from: 0.85,
to: 1,
duration: 300,
interpolation: { type: "decelerate" },
},
alpha: {
from: 0,
to: 1,
duration: 300,
},
},
},
},
pop: {
content: {
exit: {
scaleX: {
from: 1,
to: 0.85,
duration: 250,
interpolation: { type: "accelerate" },
},
scaleY: {
from: 1,
to: 0.85,
duration: 250,
interpolation: { type: "accelerate" },
},
alpha: {
from: 1,
to: 0,
duration: 250,
},
},
},
},
}
: undefined
What was the expected behaviour?
measure or measureInWindow on a View gives correct and consistent x and y coordinates.
Was it tested on latest react-native-navigation?
- I have tested this issue on the latest react-native-navigation release and it still reproduces.
Help us reproduce this issue!
- Create a release build for any Android device.
- Push or pop any screen and use a ref + measure/measureInWindow (we use the x and y coordinates to show a popover)
- You'll notice the popover is in the incorrect position, if you push/pop again you'll get different x and y coordinates
In what environment did this happen?
React Native Navigation version: 8.1.0
React Native version: 0.77.2
Has Fabric (React Native's new rendering system) enabled: Yes
Node version: 20.11
Device model: Any
Android version: 15+