【发布时间】:2021-05-04 10:36:51
【问题描述】:
已经尝试了不同的风格,但问题总是在这里(至少在 android 上)。
我想固定输入位置,但是当我们聚焦(键盘出现)并且输入上升时。
Before Focus (It's OKAY)
When we Focus (NOT OKAY)
输入代码:
<TextInput
placeholder="Procurar Lazer..."
style={[stylesListagem.inputBarFilter, {display:"flex"}]}
onChangeText={text => onChangeText(text)}
value={value}
/>
输入样式:
inputBarFilter:{
height:40,
width:250,
borderRadius:100,
display:"none",
opacity:10,
},
ViewStyle 其中 Input 是:
viewSearchFilter:{
position:"absolute",
top:"14%",
alignSelf:"center",
borderRadius:10,
backgroundColor:'#fff',
opacity:50,
},
【问题讨论】:
-
请发布 stylesListagem.inputBarFilter 对象的值
-
我同意@VáclavRyska
-
我的错!已编辑@VáclavRyska
-
尝试将
top:"14%",更改为绝对值,因为键盘激活时屏幕的高度会发生变化 -
@VáclavRyska 成功了!
标签: react-native expo