react-native - react-native-progress-circle 在 android 设备上没有进展
问题描述
我在我的应用程序中使用 react-native-progress-circle 它没有在 android 设备的进度条中显示进度,在 ios 中工作正常
constructor(props) {
super(props);
this.state = {
progress: 100,
fadeAnim: new Animated.Value(0),
percent: 100
};
}
Progress() {
timeLeft = this.props.data.time_left;
totalTime = this.props.data.total_time;
if (interval) {
clearInterval(interval);
}
interval = setInterval(() => {
timeLeft = timeLeft - 1;
console.log(timeLeft,"time" )
const percentageLeft = (timeLeft / totalTime) * 100;
this.setState({ progress: parseInt(percentageLeft) }, () => {
console.log(this.state.progress,"pro")
});
if (percentageLeft <= 1) {
clearInterval(interval);
}
}, 1000);
}
componentDidMount() {
console.log("object!!!")
this.Progress();
setInterval(() => {
console.log(this.state.percent,'one more interval')
this.setState({ percent: 50}, ()=> {console.log("fghfg")})
}, 1000);
}
componentDidUpdate(prevProps) {
if (prevProps.socket.checkin_users !== this.props.socket.checkin_users) {
this.Progress();
}
}
<ProgressCircle
percent={this.state.progress}
radius={20}
borderWidth={4}
color="#3399FF"
shadowColor="#eee"
bgColor="#fff"
>
<Svg width={40} height={30}>
<Image
source={{
uri: renderImage(this.props.data.profile_image, "user"),
}}
style={styles.image}
/>
</Svg>
</ProgressCircle>
this my code, anyone has any solution? trying from past 2 days can't find anything
解决方案
引用不能很好地使用它react-native-progress
的本机ART
模块可能是一个问题。react-native
您可以尝试使用 -Link 安装
yarn add @react-native-community/art
社区版本。
然后清理重建cd android && ./gradlew clean
推荐阅读
- java - 在一定延迟后需要帮助从 Web URL 下载文件
- scala - 如何将按第一个元素排序的元组列表分组到包含重叠和非重叠元组的两个列表中
- java - 为什么一定要加双引号?
- javascript - Angular 7+:如何只允许上传包含 utf-8 内容的文件?
- facebook - Facebook 图形 API 上缺少 instagram_business_account ID
- javascript - 使用 webpack 获取 svg fir 图像 src 返回 304
- java - 如何获取文件中每一行的最后一个单词并将其放入另一个文件的每一行
- java - 返回值反转的java集合
- python - 用于自定义表单数据的 Django REST 框架序列化程序
- typescript - 在我的控制器中使用模型中定义的实例方法