【发布时间】:2020-09-14 06:03:15
【问题描述】:
我正在为我的 React Native 应用程序苦苦挣扎!!!!
我有一个简单的平面列表。
我有一个带有过滤器选项的 TextInput。
在 TextInput 内部单击。出现一个过滤器下拉菜单。
点击出现在 TextInput 中的过滤器。
需要一些帮助来设计这个!!!它应该看起来像这样。如果不是到这种程度,至少周围有一个框就可以了。
我尝试使用 Button - React Native 元素。真是太令人沮丧了。我不能使用任何 3rd 方库(公司政策)。
文本输入代码:
<Icon type='materialicons' name='search' /> // search icon
<Button icon={<Icon name="check"/>}. //my attempt to create a button around the filter
type='clear' title ={val}
onPress={()=>{this.handleFilterIcon(false); this.setFilt(false)}}/>
<TextInput // Text Input
value={value}
placeholder='Search Here...'
onChangeText={(text)=>{this.handleSearch(text, true);this.renderDropDown(false)}}
onTouchStart={()=>{this.setTempNotifications();this.renderDropDown(true)}}
style={{ height: 40, flex: 1}}
autoCapitalize='none'
selectTextOnFocus={true}
label='input'
/>
<Icon type='materialicons' name='cancel' onPress={()=>{} /> // Clear Icon
<Button title='Cancel'
buttonStyle={{backgroundColor:'#D3D3D3', borderColor: 'grey', borderRadius: 6 , borderWidth: 1, height: 40}}
onPress={()=>{} /> // Cancel button
请告诉我最有效的方法!!!
【问题讨论】:
-
到底是什么问题?您是否无法过滤或需要帮助设置输入字段的文本样式?
-
在设置输入到字段中的文本样式时需要帮助。一旦我点击“医院管理局”,输入中的文本应该被设置样式。就像它周围的框/按钮(通常是我们手机中的过滤器)
标签: javascript reactjs react-native search filter