【发布时间】:2018-07-27 20:28:07
【问题描述】:
我的代码如下。
componentDidMount() {
this.onfetchData();
}
async onfetchData() {
/* global fetch */
await fetch('https://api.myjson.com/bins/tughj6[enter image description here][1]/')
.then((response) => response.json())
.then((responseData) => {
this.setState({
data: responseData.Level,
});
})
.catch(error => {
console.log(error);
throw error;
});
}
render() {
console.log('data', this.state.data);
const Topdata = this.state.data.map((item, index) => {
return (
<View style={{ flex: 1 }} key={index}>
<Text>{item.displayName}</Text>
</View>
);
});
return (
<View>
<View style={styles.container1}>
<Text style={styles.Text1}>Welcome</Text>
</View>
<View>
<Dropdown
data={Topdata}
itemPadding={10}
onChangeText={() => console.log('clicked')}
/>
</View>
</View>
);
}
}
下拉菜单中的选项文本不可见。它只是提供一个带有一些隐藏文本的空白下拉列表。我尝试显式更改颜色以查看选项是否可见。没有变化。请帮忙
【问题讨论】:
-
您能否更新您的代码以包含导入和整个类?另外,下拉组件来自哪里,react-native 库还是自定义组件?
标签: react-native react-redux reactive-programming react-native-ios