为你的React Native应用添加华丽的加载指示器:react-native-indicators
import React from 'react';
import { View, StyleSheet } from 'react-native';
import { MaterialIcons } from '@expo/vector-icons';
import { ProgressBarIndeterminate } from 'react-native-indicators';
export default class LoadingIndicator extends React.Component {
render() {
return (
<View style={styles.container}>
<ProgressBarIndeterminate
color="#5382FA"
animationDuration={1000}
thickness={3}
/>
<MaterialIcons
name="refresh"
size={32}
color="#5382FA"
style={styles.refreshIcon}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
refreshIcon: {
marginTop: 16,
},
});
这段代码展示了如何在React Native应用中使用react-native-indicators
库的ProgressBarIndeterminate
组件来创建一个华丽的加载指示器,并且使用了@expo/vector-icons
中的MaterialIcons
图标来表示刷新动作。这个加载指示器是灵活的,可以通过样式调整来满足不同的设计需求。
评论已关闭