React-native - TextInput 小数点在 iOS 上显示逗号而不是点

Abd*_*cin 6 react-native react-native-textinput

某些 iOS 设备似乎在小数点上显示,(逗号)而不是 a .。我相信这与键盘语言/语言环境有关。有没有一种方法可以强制无论键盘语言/语言环境如何都decimal-pad显示.

<TextInput
    rejectResponderTermination={false}
    style={[
        {
            fontSize: entryValueFontSize,
            height: height,
        },
        calculatorStyles.inputsShared,
        calculatorStyles.amountInput,
        theme.inputsShared,
    ]}
    autoCapitalize={'none'}
    placeholder={entryValueLabel}
    placeholderTextColor={theme.placeholderTextColor}
    keyboardType={'decimal-pad'}
    returnKeyType={'done'}
    defaultValue={''}
    value={isNaN(this.state.entryValue) ? '' : this.state.entryValue}
    onChangeText={(entryValue) => {
        this.onEntryValueChange(entryValue);
    }}
/>
Run Code Online (Sandbox Code Playgroud)

问题:

在此处输入图片说明

期望的输出:

在此处输入图片说明

Bla*_*ack 9

无法强制键盘使用逗号。它基于区域,例如捷克有逗号。我创建的解决方案是输入逗号后将小数点的逗号替换为点

<TextInput
  onChangeText={(entryValue) => {
    // I am passing keyboardType as prop
    if (keyboardType === 'decimal-pad') {
      this.onEntryValueChange(entryValue.replace(',', '.'));
    } else {
      this.onEntryValueChange(entryValue);
    }
  }}
/>
Run Code Online (Sandbox Code Playgroud)