-
Notifications
You must be signed in to change notification settings - Fork 22
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
Crash when trying to animate with transform props #269
Comments
same issue |
Hey, I investigated this problem some time ago. I encountered the same crashes and also switched to the imperative approach. But later, when I wanted to clean up the code and make it more declarative and in line with the components from the library, I started looking into this and found the problem (but still kept my imperative approach in the end). The issue seems to be here:
Using Also, I think replacing I’m not entirely sure anymore which approach ( Here’s the original code (lines 108–120): useEffect(() => {
if (entity == null) return;
if (position == null || Array.isArray(position)) return;
const unsubscribePosition = position.addListener(() => {
transformManager.setEntityPosition(entity, position.value, multiplyWithCurrentTransform);
});
return () => {
unsubscribePosition();
};
}, [entity, multiplyWithCurrentTransform, position, transformManager]); Replacing it with this: useWorkletEffect(() => {
'worklet';
if (entity == null) return;
if (position == null || Array.isArray(position)) {
return;
}
const unsubscribePosition = position.addListener(() => {
'worklet';
transformManager.setEntityPosition(
entity,
[position.value[0], position.value[1], position.value[2]],
multiplyWithCurrentTransform
);
});
return () => {
'worklet';
unsubscribePosition();
};
}); worked for me. Also, I made similar adjustments for the scaling values in lines 71 to 83, following the same approach as for the position described above. Without these changes, the scale prop was also causing crashes. With these adjustments, the scale prop worked as expected as well. This resolved the crashes and allowed me to use the declarative API as intended. However, I can’t say for sure if this approach works perfectly in the long run, as I decided to stick with my imperative approach. Hope this helps :) |
Hey! I've been playing with the lib, awesome work!!
I noticed that whenever I try to animate the transform props according to the docs the app crashes, on both iOS and Android.
But on the other hand, animating imperatively with
TransformManager
seems to work great!Here's a minimal reproduction on a new bare RN app: https://github.com/thiagobrez/filament-crash-repro
It's a very trivial scene:
Xcode logs
In the debugger:
filament.render.queue (20): EXC_BAD_ACCESS (code=1, address=0x88)
In the console:
I guess I can continue with
TransformManager
for now, but just wanted let you know 👍🏻The text was updated successfully, but these errors were encountered: