Skip to content
Permalink
Branch: master
Commits on Apr 2, 2019
  1. Improve handling of non event values in handleChange and handleBlur (#…

    MrLoh authored and jaredpalmer committed Apr 2, 2019
    …1216)
    
    This PR improves `handleChange` and `handleBlur` for cases where they are not passed an event, for usage with React Native (Web) and other UI libraries, where the library currently struggles. 
    
    - `handleBlur` can now be called with undefined instead of an event.
    - `handleChange` can now no only be called with a string value, but also any other value
    
    The gist of this PR is checking for `isEvent` instead of checking for `!isString`. This makes the handling much more straight forward. I also took the liberty to refactor some of the code to be less dense (no confusing ternary assignment returns) and improve the types for `handleBlur`.
You can’t perform that action at this time.