react-native - 文本输入占位符在本机反应中下降
问题描述
在我的反应原生应用程序中,当我按下文本输入时,占位符会下降一点,如下图所示。我们怎样才能解决这个问题?在屏幕上进行简单的触摸和滚动即可进行此更改。有或没有滚动视图它不起作用
> below is my code
<ScrollView>
<View style={styles.Seventh}>
<View style={styles.Eighth}>
<Image style={styles.Imagethird} source={require('../src/Assets/Profile-xhdpi.png')} />
</View>
<View style={styles.ninth}>
<Text style={styles.Textthird}>USER'S NAME</Text>
<TextInput placeholder="user's name " style={styles.one} underlineColorAndroid='transparent'
//--------------value Handler----------------//
onChangeText={(firstName) => this.setState({firstName})}
//---------------------------------//
/>
</View>
</View>
</ScrollView>
Seventh: {
height: 60,
width: '100%',
borderRadius: 70,
flexDirection: 'row',
elevation: 3,
backgroundColor: 'white',
marginTop:10
},
Eighth: {
height: 60,
width: '20%',
justifyContent: 'center',
alignItems: 'center'
},
Imagethird: {
height: 20,
width: 20,
resizeMode: 'contain',
},
ninth: {
height: 60,
width: '80%',
},
Textthird: {
marginRight:29,
marginTop: 10,
fontSize: 12,
color: '#C7C7CD'
},one:{
marginBottom:25,
fontWeight:'bold',
}
[1]: https://i.stack.imgur.com/Cq2wx.png
解决方案
我认为问题出在边距..我也有这个问题,发现文本输入有一个默认边距值,尝试将边距设置为 0,
<TextInput style={{margin:0,padding:0}} placeholder="place holder"/>
推荐阅读
- sql - 如何以 10 为增量更新所有行的列
- javascript - 仅在定义名称时才向对象添加动态属性
- amazon-web-services - EC2 经典链接 - 确定经典 IP 范围
- authentication - 通过 Nginx 进行 Haproxy 身份验证
- javascript - 如何将图像文件(像素数据)读入 JavaScript 数组?
- json - 在 JSON 字符串中为 Excel 标题传递动态文本的正确格式
- android - firebase-crashlytics-ndk:generateCrashlyticsSymbolFreeDebug 所需的未剥离本机库路径不存在
- c++ - Initialize member class that prohibits copy
- r - 识别R数据表中字符串中具有非字母字符的子字符串
- amazon-web-services - SageMaker 中的时间序列预测 - 我应该选择哪个实例?