【发布时间】:2021-04-28 11:17:38
【问题描述】:
您好,我正在关注一个教程,一切顺利,直到导师在他的项目中使用 react-native-paper ProgressBar,我写的完全一样,但它不可见,我找到了文档并插入它,仍然没有可见。
我做错了什么?
import {View, StyleSheet, Text} from 'react-native' ;
import { ProgressBar, Colors } from 'react-native-paper';
import CountDown from '../comps/CountDown.js' ;
const Timer = ({task}) => {
return (
<View style={styles.container}>
<CountDown />
<Text style={styles.text}> Focusing On:</Text>
<Text style={[styles.text, styles.textBold]}> {task} </Text>
<ProgressBar progress={0.4} color='#5E84E2' style={styles.progress}/>
</View>
) ;
}
const styles = StyleSheet.create({
container : {
flex: 1,
width: 100,
alignItems: 'center' ,
justifyContent: 'center',
paddingTop: 40,
},
text: {
// flex: 0.5,
color: 'white'
},
textBold: {
fontWeight: 'bold' ,
// borderColor: 'white',
// borderWidth: 1,
// borderStyle: 'solid' ,
},
progress: {
height: 10,
// borderColor: 'white',
// borderWidth: 1,
// borderStyle: 'solid' ,
}
}) ;
export default Timer ;
另外,如果我要给进度条提供边框,它会出现,但宽度会继续增加,即使宽度大于视口宽度也是如此。我不知道发生了什么
【问题讨论】:
标签: javascript reactjs react-native react-native-paper