react-native-masked-text icon indicating copy to clipboard operation
react-native-masked-text copied to clipboard

Set Max and Min amount for the money input

Open ManigandanRaamanathan opened this issue 5 years ago • 1 comments

Hi @benhurott currently there are no ways to limit the user from entering the input in this masked library. What I'm trying to achieve is that the user are not allowed to key in an amount that is more than x amount.

Is there a way to hold the library from updating the front end input field if the amount that exceeding the limit set? Please provide example code snippet.

Thanks

ManigandanRaamanathan avatar Apr 09 '19 17:04 ManigandanRaamanathan

This is actually doable with the checkText function.

You can write a custom function to check the text, and return true if you want to accept it. For example:

      checkText={(previous, next) => {
        return next.length <= 7;
      }}

jwoodmansey avatar May 05 '20 09:05 jwoodmansey