-
-
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
Can't cast NoopNode to ClockNode on Android #672
Comments
I think the problem is when we deal with clock and debug('clock before timing? ', clockRunning(clock)) |
Hi @likern, |
Closing due to no activity. |
I had the same issue when I have initialised a Clock and trying to stop it without actually starting the Clock. Will this help you @jakub-gonet ? |
no, I couldn't reproduce it that way. Check it yourself: import React from 'react';
import { TextInput } from 'react-native';
import Animated from 'react-native-reanimated';
const {
useCode,
concat,
Clock,
stopClock,
createAnimatedComponent,
} = Animated;
const AnimText = createAnimatedComponent(TextInput);
const Example = () => {
const clock = new Clock();
const value = new Value(10);
useCode(() => [stopClock(clock)], []);
return <AnimText editable={false} text={concat('', clock)} />;
};
export default Example; |
@jakub-gonet I didn't get the error for your code but I replaced the return part with the below, I was able to reproduce it.
|
had similar issue and it seems wrapping the clock with useRef resolved it.
|
I'm having the same issue, clock is basically unusable on android, EDIT: |
Thanks @pearup that fixed the issue for me. |
@pearup can you please paste a snippet of your solution here ? |
@pearup Timing doesn't have velocity. Where do you define velocity? |
I add a cond block to check whether the clock is defined. cond(
defined(this.clock),
[
cond(
not(clockRunning(this.clock)),
[ set(this.startValue, 1) ],
0
)
],
0
) |
@luogao Thanks, you solved my problem.. |
For me, this bug occurred on a large FlatList with many items and towards the bottom of the list, the bug would always happen. The hack that worked to circumvent this bug for me was to disable anything that would call the clocks on the first render and enable on the second. Since I was using PanGestureHandler, this did the trick: const [enabled, setEnabled] = useState(false)
useLayoutEffect(() => {
setEnabled(true)
}, [])
return <PanGestureHandler enabled={enabled} /> Not ideal since it triggers an extra re-render, but it does avoid this bug. |
@gabrielbull could you share your example so I can test it as well? |
We will abandon support for Reanimated v1 in near future. This issue is inactive and we don't have repro for this issue so I need to close. If anyone has still this problem, please try Reanimated v2. |
I did have this very issue but with different settings. I was starting an animation with different lengths depending on the Animated.timing(fadeRightButtonAnim, {
toValue: pressed ? 1.2 : 1,
duration: pressed ? 0 : 200,
easing: EasingNode.out(EasingNode.exp),
}).start(); It worked on iOS but crashes with the error Can't cast NoopNode to ClockNode on Android. The fix I applied was to put an animation length greater than zero. duration: pressed ? 1 : 200, // changed from 0 to 1 Hope this can help someone ✨ |
I use animation function, which is defined as follows:
and later use the returned value to animate
Animated.View's
property:And I started getting this error, which I can't understand or somehow to deal with. Where is a bug?
The text was updated successfully, but these errors were encountered: