【问题标题】:React native element renderErrorMessage反应原生元素 renderErrorMessage
【发布时间】:2021-02-24 10:50:41
【问题描述】:

我试图在 react native element 输入组件上有条件地显示错误消息,但似乎它不起作用

      <Input
        label="Email"
        leftIcon={<MaterialIcon name="email" size={24} color="#f8dc81" />}
        onChangeText={(value) => setEmail(value)}
        value={email}
        renderErrorMessage={false}
        errorMessage="Enter valid email"
      />

它不会显示错误消息但会显示的预期行为

【问题讨论】:

    标签: react-native react-native-android react-native-ios react-native-flatlist react-native-elements


    【解决方案1】:

    由于 doc renderErrorMessage 是处理 errorMessage 占用的空间。

    If the error message container should be rendered (take up vertical space). If false, when showing errorMessage, the layout will shift to add it at that time.
    

    所以如果errorMessage 存在,即使renderErrorMessage 为假,它也会显示错误

    【讨论】:

      猜你喜欢
      • 2022-08-06
      • 1970-01-01
      • 1970-01-01
      • 2019-12-20
      • 1970-01-01
      • 2016-03-04
      • 2020-06-08
      • 2018-04-30
      • 1970-01-01
      相关资源
      最近更新 更多