javascript - 错误:2339 属性“setNativeProps”不存在类型“从不”
问题描述
每当我在我的代码中使用“setNativeProps”时,由于某种原因它不会工作,而且它不仅仅是一个代码。它总是显示错误 2339 并且我正在使用 typescript 我在甜甜圈图上使用带有 expo 的 react.js 这里的代码, PLZ 帮助
React.useEffect(() =>{
const maxPerc=100 * percentage/max;
const strokeDashoffset= circleCircumference - (circleCircumference *maxPerc) /100;
animatedValue.addListener(v =>{
if(circleRef?.current){
circleRef.current.setNativeProps({
strokeDashoffset,
});
}
})
})
return (
<View>
<Svg width={radius * 2}height={radius * 2} viewBox={`0 0 ${halfCircle * 2} ${halfCircle * 2}`}>
<G rotation='-90 ' origin={`${halfCircle}, ${halfCircle}`}>
<Circle
cx='50%'
cy='50%'
stroke={color}
strokeWidth={strokeWidth}
r={radius}
fill="transparent"
strokeOpacity={0.2}
/>
<AnimatedCircle
ref={circleRef}
cx='50%'
cy='50%'
stroke={color}
strokeWidth={strokeWidth}
r={radius}
fill="transparent"
strokeDasharray={circleCircumference}
strokeDashoffset={strokeDashoffset}
strokeLinecap='round'
/>
</G>
</Svg>
</View>
);
}
解决方案
推荐阅读
- angular - 无法读取属性长度
- .htaccess - 更改某些文件名后如何进行 301 永久重定向
- css - Div 垂直扩展,但如果它已填满其容器,则可滚动
- javascript - RXJS 6 Doubts Chaining observables
- php - 如何在 duncan3dc / 黄昏中使用点击?
- php - 为什么 PHP 的内存使用在另一个环境中,使用相同的代码时会有很大的不同
- php - 创建带有字母和重音符号的正则表达式
- c# - 如何使用反射将具有集合的复杂类复制到其他类和不同的专有名称
- jquery - 检查 HTML 5 视频元素是否正在获取框架
- odata - 子派生属性上的 OData v4 $orderby