React native 本机扁平列表已灰显
我使用的是平面列表,但renderItem显示为灰色。项目渲染时,组件显示为灰色,请帮助我执行此操作 这是我的密码React native 本机扁平列表已灰显,react-native,react-native-flatlist,React Native,React Native Flatlist,我使用的是平面列表,但renderItem显示为灰色。项目渲染时,组件显示为灰色,请帮助我执行此操作 这是我的密码 <FlatList data={this.state.serviceList} renderItem={({ item }) => <> <Text style={styles.serviceDropText}> Title </Text> <View sty
<FlatList
data={this.state.serviceList}
renderItem={({ item }) =>
<>
<Text style={styles.serviceDropText}>
Title
</Text>
<View style={styles.dropdown}>
<DropDownPicker
items={this.state.products}
defaultValue={this.state.country}
containerStyle={{ height: 40 }}
style={{ backgroundColor: '#fafafa' }}
itemStyle={{
justifyContent: 'flex-start'
}}
dropDownStyle={{ backgroundColor: '#fafafa' }}
onChangeItem={item => this.setState({
country: item.value
})}
/>
</View>
</>
}
keyExtractor={(item, index) => index.toString()}
/>
您必须上传完整的代码,至少包括
样式
。
您是否在样式方面犯了错误?代码使用样式更新,仅供参考:样式在没有Flatlist的情况下运行良好。我已获取您的代码并在上构建了应用程序。它工作得很好。文本和下拉列表不是灰色的。检查您是否有任何错误或遗漏。好的@sriram,我会检查。thanks@sriram,我调试后发现,当使用react native simple单选按钮时,平面列表变灰。有什么想法吗?你能把你用在react native simple单选按钮上的代码贴出来吗?
serviceDropText: {
fontSize: wp('4%'),
fontWeight: 'bold',
color:'black'
},
dropdown: {
width: wp('60%')
},