admin管理员组文章数量:1390513
I am using reanimated on a project and I am receiving an error
Argument of type '() => { transform: ({ rotateX: `${number}deg`; rotateY?: undefined; } | { rotateY: `${number}deg`; rotateX?: undefined; })[]; }' is not assignable to parameter of type '() => DefaultStyle'.
React Native version : 0.78.0 Reanimated Version : 3.17.1
export const FlipCard = ({
isFlipped,
cardStyle,
direction = "y",
duration = 500,
RegularContent,
FlippedContent,
}: FlipCardProps) => {
const isDirectionX = direction === "x"
const regularCardAnimatedStyle = useAnimatedStyle(() => {
const spinValue = interpolate(Number(isFlipped.value), [0, 1], [0, 180])
const rotateValue = withTiming(`${spinValue}deg`, { duration })
return {
transform: [isDirectionX ? { rotateX: rotateValue } : { rotateY: rotateValue }],
}
})
const flippedCardAnimatedStyle = useAnimatedStyle(() => {
const spinValue = interpolate(Number(isFlipped.value), [0, 1], [180, 360])
const rotateValue = withTiming(`${spinValue}deg`, { duration })
return {
transform: [isDirectionX ? { rotateX: rotateValue } : { rotateY: rotateValue }],
}
})
My code is from the reanimated documentation and when replacing their code with mine in a snack everything works as expected. Any thoughts as to what is going on?
Documentation used : /
本文标签: typescriptType Errors on ReactNativeReanimatedStack Overflow
版权声明:本文标题:typescript - Type Errors on React-Native-Reanimated - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744699094a2620456.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论