Skip to content

[BUG] - There is a bug when setting min and max values #69

Description

@rutsatz

Bug when setting min and max value
If you set the property minValue to a minimum value and type a value below the minimum value using the cell phone keypad and click on another field on the screen to leave the field and then go back to the field and leave again, an error will occur that will break your application .

To Reproduce
Steps to reproduce the behavior:

  1. Set the minValue of the component to 0.
  2. Click on the text part of the component and using de cellphone keyboard, type -1.
  3. Click on another part of the screen to leave the field.
  4. Click back in the field.
  5. Click on another part of the screen to leave the field.
  6. You will see the error that will break your app.

If you don't see the error, try to repeat the previous steps and in step 4, when clicking on the field, try to enter some other valid or invalid value.

Component Code:

<NumericInput type='plus-minus' minValue={0} maxValue={9999} rounded={true} onChange={value => console.log(value)} />

Expected behavior
When the user enters a value below the minimum, the set value should be equal to the minimum value and not a null value. By making this adjustment, the error should probably be adjusted and also allows the user to leave the field.

Enviroment:

  • Version: 1.8.3
  • React Native version: 0.62.2
  • Device: Nexus_5X_API_24 (using emulator)
  • Device OS: Android 7

Here is part of the log printed by the library when the error occurred:

[Mon Aug 31 2020 23:04:46.170]  LOG      0
[Mon Aug 31 2020 23:04:46.168]  LOG      0
[Mon Aug 31 2020 23:04:46.381]  LOG      0
[Mon Aug 31 2020 23:04:48.749]  LOG      0
[Mon Aug 31 2020 23:04:51.693]  LOG      -5
[Mon Aug 31 2020 23:04:53.998]  LOG      
[Mon Aug 31 2020 23:04:54.000]  LOG      
[Mon Aug 31 2020 23:04:57.259]  LOG      
[Mon Aug 31 2020 23:04:57.260]  LOG      
[Mon Aug 31 2020 23:04:58.175]  LOG      
[Mon Aug 31 2020 23:04:58.176]  LOG      
[Mon Aug 31 2020 23:08:32.432]  LOG      1
[Mon Aug 31 2020 23:08:33.207]  LOG      2
[Mon Aug 31 2020 23:08:33.384]  LOG      3
[Mon Aug 31 2020 23:08:33.569]  LOG      4
[Mon Aug 31 2020 23:08:35.125]  LOG      3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions