react-native-item-checkbox
react-native-item-checkbox copied to clipboard
Support both react-native-vector-icons & react-native-icons, docs, and tests
Nice component - I have my modified version here: https://github.com/bartonhammond/snowflake which is what I'm wanting to merge with yours.
I use it thusly:
- Login - toggles the display of Password fields
- Profile - displays the email-verified field which is read only
This merge would do the following:
- Extract out the hard dependancy of Icon - pass it in as a property of type
PropTypes.func
- Support the user pass property of react-native-vector-icons or react-native-icons
- Add support for passing the text property for display next to icon
- I need the text all the time but it should be conditional
- Add support for a "read-only" non feedback version (for display only )
- Add testing with jest (Had to drop to react-native to 0.0.15 as 0.0.16 is babel6 and...well I'm not up on that)
- npm install
- npm test
- coverage is on by default, 4 tests, with 52% coverage...easily enhanced
- should be able to now use Travis or similar CI
- Added documentation using docker
- npm run docs
- docs are now in ./doc
- can be used as project gh-pages see https://bartonhammond.github.io/snowflake/snowflake.js
I think there might be some style properties that apply to one Icon and not the other. A switch statement could be necessary to style both maybe. With this merge it looks exactly like you see in my demo. If I have the transparency and background the icon disappears. Maybe you can figure out what properties are in common....It's close now though.
In my app I am calling it thusly:
/**
* Toggle the display of the Password and PasswordAgain fields
*/
import Icon from 'react-native-vector-icons/FontAwesome';
let itemCheckBox =
<ItemCheckbox
icon={Icon}
text="Show Password"
disabled={this.props.auth.form.isFetching}
onCheck={() => {
this.props.actions.onAuthFormFieldChange('showPassword',true)}
}
onUncheck={() => {
this.props.actions.onAuthFormFieldChange('showPassword',false)}
}
/>;
hope this helps....I have all this done in my project so why lose it? it's up to you.. good luck -barton
Thanks @bartonhammond! I'll look into it over the weekend!
I think you should drop the support for the react-native-icons
is this going to master any time soon?