wonsikin / react-native-barcode-builder

Component for generating barcode in react native app
Other
175 stars 116 forks source link

Throw error if the value prop is not a non-empty string #41

Closed phamhoaivu911 closed 4 years ago

phamhoaivu911 commented 4 years ago

Context:

In the documentation, the value prop is marked as a required prop. But when users forget to provide this prop, it does not raise any exceptions or show any warnings. When generating barcode for my app, I used the text prop instead of value prop and the barcode is showing fine. The value of the barcode when scanning is undefined. I was so dumb that I did not check it before releasing the app, which caused my users could not use the barcode.

Summary:

This PR is to throw an error if the value prop is not a non-empty string. As value prop is a required prop, it should raise an exception if the value is blank.

Screenshots

When no value, no onError

Screen Shot 2019-07-15 at 11 38 44 AM
When no value, onError Console
When value prop is present