react-native-reanimated
react-native-reanimated copied to clipboard
ClockNode cannot be found on Android
I'm getting this error on Android, on iOS it works fine. Here is the code responsible for starting the clock.

const {
Value,
Clock,
and,
block,
cond,
lessThan,
greaterThan,
greaterOrEq,
interpolate,
lessOrEq,
abs,
set,
useCode,
event,
add,
eq,
divide,
multiply,
diff,
startClock,
stopClock,
decay,
not,
spring,
sub,
min,
pow,
debug
} = Animated;
const withScroll = ({
translationX,
velocityX,
state: gestureState,
tabsWidth,
containerWidth,
tabs,
positions,
indexTransition,
index
}) => {
const clock = new Clock();
const delta = new Value(0);
const isSpringing = new Value(0);
const state = {
time: new Value(0),
position: new Value(0),
velocity: new Value(0),
finished: new Value(0)
};
const activeIndex = index;
const activeIndexTransition = withTransition(index);
const isIndexUpdated = new Value(0);
const upperBound = 0;
const lowerBound = -1 * (tabsWidth - containerWidth);
const isInBound = and(
lessOrEq(state.position, upperBound),
greaterOrEq(state.position, lowerBound)
);
const config = {
stiffness: new Value(100),
mass: new Value(1),
damping: new Value(14),
overshootClamping: false,
restSpeedThreshold: 0.001,
restDisplacementThreshold: 0.001,
toValue: new Value(0)
};
const overscroll = sub(
state.position,
cond(greaterOrEq(state.position, 0), upperBound, lowerBound)
);
return block([
startClock(clock),
set(delta, diff(translationX)),
cond(
eq(gestureState, State.ACTIVE),
[
set(isSpringing, 0),
set(isIndexUpdated, 0),
set(
state.position,
add(
state.position,
cond(
isInBound,
delta,
multiply(
delta,
friction(min(divide(abs(overscroll), containerWidth), 1))
)
)
)
),
set(state.velocity, velocityX),
set(state.time, 0)
],
[
set(translationX, 0),
cond(
diff(activeIndexTransition),
[
set(
state.position,
interpolate(activeIndexTransition, {
inputRange: tabs.map((_tab, i) => i),
outputRange: positions.map((value, index) => {
return -1 * value;
})
})
),
set(isIndexUpdated, 1)
],
[
cond(
and(isInBound, not(isSpringing)),
[decay(clock, state, { deceleration: 0.997 })],
[
cond(not(isIndexUpdated), [
set(isSpringing, 1),
set(state.finished, 0),
set(
config.toValue,
snapPoint(state.position, state.velocity, [
lowerBound,
upperBound
])
),
spring(clock, state, config),
cond(state.finished, set(isSpringing, 0))
])
]
)
]
)
]
),
state.position
]);
};
@igarcido95 how did you solved this error? Exactly the same situation for me on android..
@vitosorriso did you find a solution 🤔 ?