Gifted Form
Form component for React Native.
Example
var GiftedForm GiftedFormManager = ; var FormComponent = ;
Storing form's state elsewhere (could be used with Redux) - Beta feature
Pass value
prop to your widgets and onValueChange
to your GiftedForm to store your state outside of GiftedFormManager's store.
IMPORTANT: currently only TextInputWidget and HiddenWidget support this feature. PR's are welcome for the other widgets ;)
{ superprops context thisstate = form: fullName: 'Marco Polo' tos: false } { console this } { const fullName tos gender = thisstateform console return <GiftedForm formName='signupForm' openModal= { thispropsnavigator } onValueChange=thishandleValueChange > <GiftedFormTextInputWidget name='fullName' title='Full name' placeholder='Marco Polo' clearButtonMode='while-editing' value=fullName /> <GiftedFormHiddenWidget name='tos' value=tos /> </GiftedForm> } AppRegistry
Installation
npm install react-native-gifted-form --save# ORyarn add react-native-gifted-form
Available widgets
- TextInputWidget - A text input
- TextAreaWidget - A text area
- GooglePlacesWidget - A Google Places picker based on react-native-google-places-autocomplete
- ModalWidget - A route opener for nested forms
- GroupWidget - A widgets container with a title
- HiddenWidget - A non-displayed widget. The value will be passed to SubmitWidget
- LoadingWidget - A loader
- RowWidget - A touchable row with title/image
- RowValueWidget - A touchable row with title/image and a value
- SelectCountryWidget - A country picker. Flags made by www.IconDrawer.com
- SelectWidget - A select menu
- SeparatorWidget - A 10px widgets separator
- SubmitWidget - A submit button that trigger form validators and error displaying
- SwitchWidget - A switch
- DatePickerIOSWidget - Date picker for iOS
- NoticeWidget - A notice information - PR wanted for onPress handler
See the widget sources for full props details.
Custom widgets
Widgets must implement the mixin GiftedForm.WidgetMixin
. See TextAreaWidget for a good example.
Contributing
Pull requests are welcome! The author is very busy at the moment but there are also some contributors who are also helping out.
License
Feel free to ask me questions on Twitter @FaridSafi!