【问题标题】:Setting TextInput placeholder vertically center in ios - React Native在 ios 中设置 TextInput 占位符垂直居中 - React Native
【发布时间】:2018-06-07 13:35:53
【问题描述】:

我在我的react-native 应用程序中使用TextInput 并发现了一个奇怪的问题。我的 TextInput 中使用的占位符在 ios 设备中不是垂直居中,而是在 android 设备中居中。我该如何解决这个问题?

代码

 <View style={{marginBottom: 20}}>
      <Text style={styles.subTitle}>Description</Text>
      <TextInput style={[styles.inputFull_80]} multiline={true} placeholder="Enter group description" underlineColorAndroid='transparent'/>
 </View>

风格

const styles = {
    container: {
        //TODO: Remove once added properly
        marginTop: Constants.statusBarHeight,
        padding: 20,
        backgroundColor: 'white',

    },

    subTitle: {

        fontFamily: 'gotham',
        marginBottom: 5,
        fontSize: 16,
        color: '#4A4A50',


    },

    inputFull_80: {

        minHeight: 80,
        borderWidth: 1,
        borderColor: '#E6E6E6',
        fontFamily: 'gotham_light',
        borderRadius: 4,
        fontSize: 14,
        padding: 10,


    },


};

【问题讨论】:

    标签: javascript ios react-native styles


    【解决方案1】:

    将textAlign={'center'} 作为属性添加到TextInput 组件

    【讨论】:

      猜你喜欢
      • 2017-04-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-23
      • 2017-05-13
      • 2023-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多