我在样式化 React Native DateTimePicker 时遇到问题。相关代码如下:
import React, { ReactChild, useState } from 'react';
import DateTimePicker from '@react-native-community/datetimepicker';
const Picker = () => {
const [currentDate, setCurrentDate] = useState(new Date());
return (
<DateTimePicker
testID={'dateTimePicker'}
value={currentDate}
mode={'date'}
display={'default'}
style={styles.dateTimePicker}
textColor={BLACK}
/>
);
};
const styles = StyleSheet.create({
dateTimePicker: {
backgroundColor: 'white',
borderRadius: 5,
borderColor: '#C5C5C5',
borderWidth: 1,
marginVertical: 10,
height: 43,
},
})
问题是,在白色背景下,当模式打开时,选择器的背景是浅灰色的。我需要摆脱它。或者,我尝试创建一个会触发选择器的输入字段,但在这种情况下,我需要它看起来已经对模态开放。
有什么建议么?