[英]Does anyone know how to create this component in React native?
這稱為 循環進度
用法
import { AnimatedCircularProgress } from 'react-native-circular-progress';
<AnimatedCircularProgress
size={120}
width={15}
fill={100}
tintColor="#00e0ff"
onAnimationComplete={() => console.log('onAnimationComplete')}
backgroundColor="#3d5875" />
您還可以定義一個接收當前進度的函數,例如將其顯示在圓圈內:
<AnimatedCircularProgress
size={200}
width={3}
fill={this.state.fill}
tintColor="#00e0ff"
backgroundColor="#3d5875">
{
(fill) => (
<Text>
{ this.state.fill }
</Text>
)
}
</AnimatedCircularProgress>
您還可以定義一個函數,該函數將接收進度圈頂部的位置並呈現自定義 SVG 元素:
<AnimatedCircularProgress
size={120}
width={15}
fill={100}
tintColor="#00e0ff"
backgroundColor="#3d5875"
padding={10}
renderCap={({ center }) => <Circle cx={center.x} cy={center.y} r="10" fill="blue" />}
/>
最后,您可以通過在組件上放置 ref 並調用animate(toValue, duration, easing)
函數來手動觸發基於持續時間的計時動畫,如下所示:
<AnimatedCircularProgress
ref={(ref) => this.circularProgress = ref}
...
/>
this.circularProgress.animate(100, 8000, Easing.quad); // Will fill the progress bar linearly in 8 seconds
animate-function
返回計時動畫,以便您可以鏈接、並行運行等。
這就是您要尋找的... https://github.com/JesperLekland/react-native-svg-charts這是 ProgressCircle。 希望能幫到你...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.