danielweinmann / react-native-stateless-form

Stateless form components for React Native
MIT License
105 stars 14 forks source link

How to handle numbers? #4

Open ms88privat opened 8 years ago

ms88privat commented 8 years ago

I have a really hard time figuring out how to handle numbers best.

There are two main problems here:

  1. My initialValue is an integer, which will not get displayed by the react-native TextInput
  2. validatorjs only validates strings

I don't really want to translate all my number props of my models to strings beforehand. Afterwards I can't really intercept the value because it will get handled by redux-form. Any idea here?

edit: The documentation of redux-form says, that value will be either a bool or a string, which is not the case by me... hm

ms88privat commented 8 years ago

To get around this, I edited the InlineTextInput Widget here and here

and did another isNumber check in the validate-model plugin