使用 React Native 组件在 ReactART 中创建动画式圆形进度条
React Native 组件用于创建动画式圆形进度条。例如,可用于显示用户点。
React-native-svg:
npm i --save React-native-circular-progress React-native-svgReact-native link React-native-svgimport { 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" />}
/>最后,您可以通过在组件上添加一个引用并调用animate(toValue, duration, easing)函数来手动触发基于持续时间的定时动画:
暂无开放 Issues,或尚未同步最近议题。