Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default ({ transition }: ChevronProps) => {
const rotateZ = bInterpolate(transition, Math.PI, 0);
const backgroundColor = bInterpolateColor(
transition,
{ r: 82, g: 82, b: 81 },
{ r: 228, g: 86, b: 69 }
);
return (
);
};
onChange(nextIndex, [
cond(and(not(clockRunning(clock)), neq(nextIndex, selectedCard)), [
set(selectedCard, nextIndex),
call([selectedCard], selectCardState)
])
]),
cond(eq(selectedCard, INITIAL_INDEX), [
set(spring, timing(clock)),
set(cardRotates[0], bInterpolate(spring, 0, -15)),
set(cardRotates[1], 0),
set(cardRotates[2], bInterpolate(spring, 0, 15))
]),
cond(and(neq(selectedCard, INITIAL_INDEX), not(firstSelectionIsDone)), [
set(spring, timing(clock)),
set(cardRotates[0], bInterpolate(spring, 0, -7.5)),
set(cardRotates[1], bInterpolate(spring, 0, 7.5)),
set(cardRotates[2], bInterpolate(spring, 15, 0)),
set(translationX, bInterpolate(spring, translationX, 0)),
cond(not(clockRunning(clock)), set(firstSelectionIsDone, 1))
]),
...cards.map((_, index) =>
cond(and(firstSelectionIsDone, eq(selectedCard, index)), [
set(spring, timing(clock)),
...cards
.map((_c, i) => i)
.filter((_c, i) => i !== index)
.map((absoluteIndex, i) =>
set(
cardRotates[absoluteIndex],
bInterpolate(
spring,
cardRotates[absoluteIndex],
cond(and(not(clockRunning(clock)), neq(nextIndex, selectedCard)), [
set(selectedCard, nextIndex),
call([selectedCard], selectCardState)
])
]),
cond(eq(selectedCard, INITIAL_INDEX), [
set(spring, timing(clock)),
set(cardRotates[0], bInterpolate(spring, 0, -15)),
set(cardRotates[1], 0),
set(cardRotates[2], bInterpolate(spring, 0, 15))
]),
cond(and(neq(selectedCard, INITIAL_INDEX), not(firstSelectionIsDone)), [
set(spring, timing(clock)),
set(cardRotates[0], bInterpolate(spring, 0, -7.5)),
set(cardRotates[1], bInterpolate(spring, 0, 7.5)),
set(cardRotates[2], bInterpolate(spring, 15, 0)),
set(translationX, bInterpolate(spring, translationX, 0)),
cond(not(clockRunning(clock)), set(firstSelectionIsDone, 1))
]),
...cards.map((_, index) =>
cond(and(firstSelectionIsDone, eq(selectedCard, index)), [
set(spring, timing(clock)),
...cards
.map((_c, i) => i)
.filter((_c, i) => i !== index)
.map((absoluteIndex, i) =>
set(
cardRotates[absoluteIndex],
bInterpolate(
spring,
cardRotates[absoluteIndex],
7.5 * (i % 2 === 0 ? -1 : 1)
};
useCode(
block([
cond(and(not(clockRunning(clock)), neq(nextIndex, selectedCard)), [
set(selectedCard, nextIndex),
call([selectedCard], selectCardState)
]),
cond(eq(selectedCard, INITIAL_INDEX), [
set(spring, timing(clock)),
set(cardRotates[0], bInterpolate(spring, 0, -15)),
set(cardRotates[1], 0),
set(cardRotates[2], bInterpolate(spring, 0, 15))
]),
cond(and(neq(selectedCard, INITIAL_INDEX), not(firstSelectionIsDone)), [
set(spring, timing(clock)),
set(cardRotates[0], bInterpolate(spring, 0, -7.5)),
set(cardRotates[1], bInterpolate(spring, 0, 7.5)),
set(cardRotates[2], bInterpolate(spring, 15, 0)),
set(translationX, bInterpolate(spring, translationX, 0)),
cond(not(clockRunning(clock)), set(firstSelectionIsDone, 1))
]),
...cards.map((_, index) =>
cond(and(firstSelectionIsDone, eq(selectedCard, index)), [
set(spring, timing(clock)),
...cards
.map((_c, i) => i)
.filter((_c, i) => i !== index)
.map((absoluteIndex, i) =>
set(
cardRotates[absoluteIndex],
bInterpolate(
spring,
.map((absoluteIndex, i) =>
set(
cardRotates[absoluteIndex],
bInterpolate(
spring,
cardRotates[absoluteIndex],
7.5 * (i % 2 === 0 ? -1 : 1)
)
)
),
block([
onChange(nextIndex, [
cond(and(not(clockRunning(clock)), neq(nextIndex, selectedCard)), [
set(selectedCard, nextIndex),
call([selectedCard], selectCardState)
])
]),
cond(eq(selectedCard, INITIAL_INDEX), [
set(spring, timing(clock)),
set(cardRotates[0], bInterpolate(spring, 0, -15)),
set(cardRotates[1], 0),
set(cardRotates[2], bInterpolate(spring, 0, 15))
]),
cond(and(neq(selectedCard, INITIAL_INDEX), not(firstSelectionIsDone)), [
set(spring, timing(clock)),
set(cardRotates[0], bInterpolate(spring, 0, -7.5)),
set(cardRotates[1], bInterpolate(spring, 0, 7.5)),
set(cardRotates[2], bInterpolate(spring, 15, 0)),
set(translationX, bInterpolate(spring, translationX, 0)),
cond(not(clockRunning(clock)), set(firstSelectionIsDone, 1))
]),
...cards.map((_, index) =>
cond(and(firstSelectionIsDone, eq(selectedCard, index)), [
set(spring, timing(clock)),
...cards
.map((_c, i) => i)
.filter((_c, i) => i !== index)
.map((absoluteIndex, i) =>
set(
cardRotates[absoluteIndex],
bInterpolate(
spring,
const rotateX = useMemo(() => bInterpolate(transition, 0, -Math.PI / 6), [
transition
set(selectedCard, nextIndex),
call([selectedCard], selectCardState)
])
]),
cond(eq(selectedCard, INITIAL_INDEX), [
set(spring, timing(clock)),
set(cardRotates[0], bInterpolate(spring, 0, -15)),
set(cardRotates[1], 0),
set(cardRotates[2], bInterpolate(spring, 0, 15))
]),
cond(and(neq(selectedCard, INITIAL_INDEX), not(firstSelectionIsDone)), [
set(spring, timing(clock)),
set(cardRotates[0], bInterpolate(spring, 0, -7.5)),
set(cardRotates[1], bInterpolate(spring, 0, 7.5)),
set(cardRotates[2], bInterpolate(spring, 15, 0)),
set(translationX, bInterpolate(spring, translationX, 0)),
cond(not(clockRunning(clock)), set(firstSelectionIsDone, 1))
]),
...cards.map((_, index) =>
cond(and(firstSelectionIsDone, eq(selectedCard, index)), [
set(spring, timing(clock)),
...cards
.map((_c, i) => i)
.filter((_c, i) => i !== index)
.map((absoluteIndex, i) =>
set(
cardRotates[absoluteIndex],
bInterpolate(
spring,
cardRotates[absoluteIndex],
7.5 * (i % 2 === 0 ? -1 : 1)
)
export default ({
title,
source,
onPress,
dark,
resizeMode,
comingSoon
}: ThumbnailProps) => {
const value = new Value(0);
const scale = bInterpolate(value, 1, 1.5);
return (
const selectCard = (index: number) => {
if (index !== selectedCardState) {
nextIndex.setValue(index);
}
};
useCode(
block([
cond(and(not(clockRunning(clock)), neq(nextIndex, selectedCard)), [
set(selectedCard, nextIndex),
call([selectedCard], selectCardState)
]),
cond(eq(selectedCard, INITIAL_INDEX), [
set(spring, timing(clock)),
set(cardRotates[0], bInterpolate(spring, 0, -15)),
set(cardRotates[1], 0),
set(cardRotates[2], bInterpolate(spring, 0, 15))
]),
cond(and(neq(selectedCard, INITIAL_INDEX), not(firstSelectionIsDone)), [
set(spring, timing(clock)),
set(cardRotates[0], bInterpolate(spring, 0, -7.5)),
set(cardRotates[1], bInterpolate(spring, 0, 7.5)),
set(cardRotates[2], bInterpolate(spring, 15, 0)),
set(translationX, bInterpolate(spring, translationX, 0)),
cond(not(clockRunning(clock)), set(firstSelectionIsDone, 1))
]),
...cards.map((_, index) =>
cond(and(firstSelectionIsDone, eq(selectedCard, index)), [
set(spring, timing(clock)),
...cards
.map((_c, i) => i)
.filter((_c, i) => i !== index)
.map((absoluteIndex, i) =>