首页 > 解决方案 > 在 react-native-paper 中使用 TextInputMask 在 TextInput 上出错

问题描述

警告:componentWillReceiveProps 已重命名,不推荐使用。有关详细信息,请参阅 react-unsafe-component-lifecycles。

请更新以下组件:TextInputMask

<TextInput
    mode="outlined"
    label="Pincode"
    value={this.state.pincode}
    onChangeText={this.handlePincodeChange}
    left={<TextInput.Icon style={{marginEnd:10}} color='#156da9' name="map-marker"/>}
    style={styles.textInput}
    keyboardType='number-pad'
    render={props => 
        <TextInputMask
            {...props}
            mask="[000000]"
        />
    }
    theme={theme}
/>

标签: react-nativereact-native-paper

解决方案


这似乎是react-native-text-input-mask库中的一个错误,代码已修复,但拉取请求尚未合并,因此很可能在库自行修复之前您将无法修复此问题,除非您想通过修复分叉库并构建它。

公关#141

错误 158


推荐阅读