No description, website, or topics provided.
JavaScript Objective-C Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.idea Added screen shot Nov 5, 2015
example v0.0.1 Nov 5, 2015
FMForm.js v0.0.1 Nov 5, 2015 Update Nov 5, 2015
package.json Update dependencies Nov 5, 2015
screenshot.png Added screen shot Nov 5, 2015


FM Form is a module for React Native to fast generate pages with a form. It works like Backbone forms. Using this module you can generate a page in 5 minutes!

Currently only support iOS!!!

I build this module because I am lazy... The original purpose of this project is for me to develop an app faster. I believe there are many bugs and design issue. If you are interesting in this project please help me improve it!

generate a page like this in 5 mins:


set up

npm install react-native-fm-form or add "react-native-fm-form" : "^0.0.1" to your package.json and run npm install.

var FMForm = require('react-native-fm-form') to start using it.

generate a page using FM Form:

  1. right a schema for the FM Form: _genSchema : function(){ return [ { type: 'textInput', lable: 'Text Input', reference: 'textInput' } ] }

  2. Use FMForm as a React component: render: function(){ return ( This is a FM Form example <FMForm schema={this._genSchema} delegate={this} ref={'form'} style={{marginTop: 50}} initData={{ custom: 0, }} ) }

Form properties:

  1. delegate: the component that owns FM Form instance. All the form value will be storing in this component.
  2. initData: the initial data of different form field.
  3. onFormRender: a function that will be called just after the form is rendered

accessing form data:

The form data will be stored in this.FMFormData object of its delegate. For example:

var Example = React.creatClass({
	render: function(){
		return (
				<Text>This is a FM Form example</Text>
	                style={{marginTop: 50}}
	                    custom: 0,
	             <Text onPress={this._onSubmit}>On submit</Text>
	_onSubmit: function(){
		//accessing form data


each editor will have a corresponding form field, which is specified by the 'reference' property. For example, if a text input has 'name' as the reference, the input value of this field will be stored in

Text Input:

    type: 'textInput',
    label: 'Text Input',
    placeholder: 'I am a Text Input',
    reference: 'textInput',
    autoFocus: false,
    secureTextEntry: false,
    keyboardType: 'default',
    onChangeText: function(text){
    	console.log('input: ' + text);
	onFocus: function(text){
    	console.log('text input focused');
	onSubmitEditing: function(){
    	console.log('text input submitted');
	onBlur: function(){
		console.log('text input blurred');


    type: 'button',
    label: 'Button',
    buttonLabel: function(){
        return "I am a button, click me!"
    onClick: function(){
        AlertIOS.alert('Button clicked');


    type: 'switch',
    label: 'Switch',
    onLabel: 'I am a switch, I am on',
    offLabel: 'I am a switch, I am off',
    reference: 'switch',


    type: 'select',
    label: 'Select',
    reference: 'minLimit',
    options: [
        '1', '2'
        'option 1', 'option 2'
    defaultButtonLabel: 'I am a select, click me!'


    type: 'spacer'


    type: 'picture',
    labelWithNoPicture: 'I am an image picker',
    reference: 'image',

To use picture selector, you have to prepare the project with module:


    type: 'custom',
    reference: 'custom',
    renderRow:function(rowData:object, sectionID:number, rowID:number, fieldValue){
        return (
                style={{color: 'red'}}
                    self.FMFormData['custom'] ++;
                >I am a custom row, my value is: {fieldValue}, click me!</Text>