reactjs - react-native-dropdown-picker 回到屏幕时会留下占位符吗?
问题描述
我正在做 react-native 项目。我对这个库“react-native-dropdown-picker”有疑问。当我在其下拉列表中选择某个值时,它将占位符留下我选择的值,我再次回到同一屏幕上。下面是代码。
sourceListArry=[[
{
"label": "ABC",
"value": "SourceBody"
},
{
"label": "EFG",
"value": "SourceBody"
}
]]
callFun = async (item) => {
await AppStorage.saveKey(key.GET_SOURCE, JSON.stringify(item.label)).then(() => {
})
}
<DropDownPicker
items={sourceListArry}
placeholder={'Source'}
containerStyle={{
height: hp('6%'),
width: '100%'
}}
itemStyle={{
height: hp('5%'),
width: '100%',
justifyContent: 'flex-start'
}}
onOpen={() => Keyboard.dismiss()}
onChangeItem={item => this.callFun(item)}
dropDownStyle={{ backgroundColor: '#E0E0E0' }}
dropDownMaxHeight={130}
onOpen={() => Keyboard.dismiss()}
labelStyle={{
fontSize: hp('1.6%'),
textAlign: 'left',
color: '#000'
}}
/>
当我回到屏幕上时,它的占位符保持不变,这是我最后选择的。但不是默认的 - 在其 UI 上再次“排序”。请让我知道一些解决方案,我将不胜感激。
解决方案
推荐阅读
- entity-framework-6 - 实体框架撤消删除而不再次查询数据库
- powershell - 使用 CLSID 创建 COM 组件的实例
- java - GregorianCalendar 不能加 97 天?
- python - Python用其他数据填充缺失值
- python - Python - 用 try/except 猜数字
- php - 如何使用ajax在url中保存变量
- jenkins - Jenkins 中的 Cucumber 报告错误 - “net.masterthought.cucumber.ValidationException:未添加报告文件”
- jquery - 将一个元素移到另一个之上的问题
- javascript - 构造函数中定义的方法的用例
- mongodb - MongoDB 文档 ID 是整个数据库唯一的还是该集合唯一的?