react-native - 在 react-native-paper 中使用 TextInputMask 在 TextInput 上出错
问题描述
警告:componentWillReceiveProps 已重命名,不推荐使用。有关详细信息,请参阅 react-unsafe-component-lifecycles。
- 将数据获取代码或副作用移动到 componentDidUpdate。
- 如果您在 props 更改时更新状态,请重构您的代码以使用记忆技术或将其移动到静态 getDerivedStateFromProps。了解更多信息:react-derived-state
- 将 componentWillReceiveProps 重命名为 UNSAFE_componentWillReceiveProps 以在非严格模式下抑制此警告。在 React 17.x 中,只有 UNSAFE_ 名称可以使用。要将所有已弃用的生命周期重命名为新名称,您可以
npx react-codemod rename-unsafe-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}
/>
解决方案
推荐阅读
- javascript - TS/JS 如何找到对象嵌套属性的索引?
- java - 如何实现策略设计模式
- javascript - 可缩放的旭日形图在 React JS 中一次仅显示层次结构的两层
- python - 将枕头灰度图像转换为十六进制值?
- macos - Bit-Bucket 服务器的只读权限
- php - 无法在 WordPress WP_Query 中显示自定义分类
- excel - Excel VBA宏将excel工作簿保存为pdf不会保存
- wordpress - 由 wordpress 插件创建的自定义页面
- dataframe - DataFrames.jl - 按类型或名称子字符串选择列
- swift - 在 XCode 11 上哪里可以找到“Log Dyld API Usage”和“Log Library Loads”?