0

Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See react-unsafe-component-lifecycles for details.

  • Move data fetching code or side effects to componentDidUpdate.
  • If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: react-derived-state
  • Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run npx react-codemod rename-unsafe-lifecycles in your project source folder.

Please update the following components: 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}
/>
Praveen Patel
  • 349
  • 7
  • 24
  • What’s the question? – Denis Tsoi Sep 26 '20 at 11:48
  • I'm getting warning, "componentWillReceiveProps has been renamed, and is not recommended for use. See react-unsafe-component-lifecycles for details.". Please help how can I use TextInputMask correctly with react-native-paper TextInput? – Praveen Patel Sep 26 '20 at 13:05

1 Answers1

2

This seems to be a BUG in react-native-text-input-mask library and the code is fixed but pull request is not merged yet so most likely you will not be able to fix this until library has fix itself unless you want to fork the library with fix and build it.

PR #141

BUG 158

Dipen Shah
  • 25,562
  • 1
  • 32
  • 58
  • do you have any idea, how can i implement text input mask in TextInput? Or have any work around to limit any text field to enter mobile no. format like this +91 (987) 654 3210. – Praveen Patel Oct 05 '20 at 05:24
  • You can use `onChangeText` event handler for such validation. Implementing text mask will require big effort but you can start with text-input-mask library and customize it based on your requirements. – Dipen Shah Oct 05 '20 at 05:54