Css 反应本机:保持图标位置固定
我正在使用Css 反应本机:保持图标位置固定,css,react-native,flexbox,react-native-stylesheet,Css,React Native,Flexbox,React Native Stylesheet,我正在使用react本机自动完成输入组件的 但当我开始打字时,搜索和关闭图标都会被下推到建议的中心: 任何建议,我如何保持两个图标固定在它的顶部位置。 请提供帮助。请尝试样式中的属性对齐项目:'flex-start'。搜索部分 要进一步对齐图标,请在searchIcon和clearcon中使用padingTop:10,请尝试样式中的属性alignItems:'flex-start' 要进一步对齐图标,请在searchIcon和clearIcon中使用padingTop:10,谢谢@Laxmin
react本机自动完成输入
组件的
但当我开始打字时,搜索和关闭图标都会被下推到建议的中心:
任何建议,我如何保持两个图标固定在它的顶部位置。
请提供帮助。请尝试样式中的属性对齐项目:'flex-start'
。搜索部分
要进一步对齐图标,请在searchIcon
和clearcon
中使用padingTop:10
,请尝试样式中的属性alignItems:'flex-start'
要进一步对齐图标,请在searchIcon
和clearIcon
中使用padingTop:10
,谢谢@Laxminarayan的指导。我用更精确的信息编辑了答案。谢谢@Laxminarayan的指导。我用更精确的信息编辑了答案。
<View style={styles.searchSection}>
<AntDesign
name="search1"
size={18}
color="gray"
style={styles.searchIcon}
/>
<Autocomplete
autoCapitalize="none"
autoCorrect={false}
containerStyle={styles.autocompleteContainer}
inputContainerStyle={styles.inputContainer}
//data to show in suggestion
data={filteredFilms}
//default value if you want to set something in input
defaultValue={
JSON.stringify(selectedValue) === '{}'
? ''
: selectedValue.title + selectedValue.id
}
// onchange of the text changing the state of the query
// which will trigger the findFilm method
// to show the suggestions
onChangeText={(text) => findFilm(text)}
placeholder="Search doctors, specialities, symptoms"
renderItem={({item}) => (
//you can change the view you want to show in suggestions
<View style={{backgroundColor: 'red', flexDirection: 'column'}}>
<TouchableOpacity
onPress={() => {
setSelectedValue(item);
setFilteredFilms([]);
}}>
<Text style={styles.itemText}>{item.title + item.id}</Text>
</TouchableOpacity>
</View>
)}
/>
<AntDesign
name="close"
size={18}
color="gray"
style={styles.clearIcon}
/>
</View>