-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description
When use const deviceMotion = useAnimatedSensor(SensorType.ROTATION, { interval: "auto", }) to animate a RadialGradient using ReAnimate. Android has a significant amount of memory consumed caused by SvgView being invalid by the sensor data. And a new Bitmap is created on next onDraw.
See detailed call trace. GC runs every few seconds.
Steps to reproduce
Use the useAnimatedSensor to drive a RadialGradient animation on Android
Example:
` const deviceMotion = useAnimatedSensor(SensorType.ROTATION, {
interval: "auto",
});
const derivedValue = useDerivedValue(() => {
return 0.5 * (Math.sin(deviceMotion.sensor.value.roll) + 1);
});
const animatedProps = useAnimatedProps(() => {
return {
cx: (derivedValue.value - 0.5) * 2.4,
fx: (derivedValue.value - 0.5) * 2.4,
};
});`
Snack or a link to a repository
SVG version
13.10.0
React Native version
0.74.5
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native
Architecture
Fabric (New Architecture)
Build type
Release app & production bundle
Device
Real device
Device model
Google Pixel 10Pro
Acknowledgements
Yes