【问题标题】:Floating Label with Input Text - Label is touching to bottom border of input in android using in react native带有输入文本的浮动标签-标签在使用本机反应的android中触及输入的底部边框
【发布时间】:2026-01-07 14:00:01
【问题描述】:

我已经实现了带有输入项的浮动标签。以下是我的代码并附上屏幕截图。浮动标签在 iphone 中工作正常,但在 android 中,浮动标签在使用 react native 时触及底部边框

<Item floatingLabel style={styles.floatInput}>
            <Label style={styles.lbl}>Enter Your Mobile Number</Label>
            <Input
              style={styles.inputcolor}
              ref="Mobile"
              keyboardType="numeric"
              onChangeText={text => {
                this.checkSetMobile(text)
              }}
              value={this.state.Mobile}
            />
              <Icon style={{color:AppColors.colors.main_color}} name="md-call" />
          </Item>

      lbl: {
        paddingTop: Platform.OS === "ios" ? undefined : 5 ,
        paddingBottom: Platform.OS === "ios" ? undefined : 5 ,
        marginBottom: 5,

      },
      inputcolor: {
        flex: 1,
        paddingBottom:5,
}

【问题讨论】:

    标签: android react-native floating


    【解决方案1】:

    目前我在浮动标签中通过这一行完成了工作,它解决了我的问题

    paddingTop: Platform.OS === "ios" ? undefined : -15 ,
    

    【讨论】:

      最近更新 更多