简体   繁体   中英

How can I fix React-Native Android affineFormats error

I'm using react-native-text-input-mask library in my React-Native project. react-native-text-input-mask is one of the good libraries to add the text input mask for React-Native on iOS and Android. It works well on iOS but on Android, I see affineFormats error. How can I fix this error?

在此处输入图像描述

Here is my code.

<TextInputMask
  style={commonStyles.textInput}
  value={phoneNumber}
  placeholderTextColor="darkgray"
  placeholder="Phone #"
  keyboardType="phone-pad"
  mask={"+1 ([000])-[000]-[0000]"}
  onChangeText={setPhoneNumber}
/>

The solution is to add the missing props.

<TextInputMask
  onChangeText={onChangeText}
  value={value}
  affineFormats={[]}
  customNotations={[]}
  affinityCalculationStrategy={'WHOLE_STRING'}
  mask={"[000].[000].[000]"}
/>

https://github.com/react-native-text-input-mask/react-native-text-input-mask/issues/217#issuecomment-831844833

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM