我正在使用react-native-svg-charts,动画不工作。下面是代码
function AnimusScreen () {
const [lineChartData, setLineChartData] = useState([
{
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
svg: { stroke: Colors.cosmic, strokeWidth: 1, },
}
])
const changea = ()=>{
setLineChartData([
{
data: [50, 10, 40, 95, -4, -24, 85, 50, -20, -80],
svg: { stroke: Colors.cosmic, strokeWidth: 1, },
}
])
}
return (
<View
style={{
flex: 1,
flexDirection: "column",
justifyContent: "center",
alignItems: "center"
}}
>
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
alignSelf: "stretch"
}}
>
<LineChart
style={{
flex: 1,
alignSelf: "stretch",
borderWidth: 1,
borderColor: "rgba(255,255,255,0.5)",
margin: 10
}}
data={lineChartData}
svg={{
strokeWidth: 2,
stroke: Colors.cosmic
}}
animate
/>
</View>
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
alignSelf: "stretch"
}}
>
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
alignSelf: "stretch"
}}
>
<Text>My Chart :D x</Text>
</View>
</View>
<TouchableOpacity
onPress={() => changea()}
>
<Text>Press Here</Text>
</TouchableOpacity>
</View>
);
}
export default AnimusScreen;https://stackoverflow.com/questions/66183854
复制相似问题