npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-nested-form

v0.1.2

Published

复杂表单组件

Downloads

2

Readme

react native表单组件

react-native-nested-form用常见的表单提交功能,支持表单嵌套,最后通过表单对象获取到整个表单值对象

安装

npm install react-native-nested-form --save

使用示例

import Form from './src/form';

import Input from './src/form/input';

export default class RCTNativeNestedForm extends Component {

    constructor(props) {
    	 	
    	 	super(props);   
    		this.onPressed = this.onPressed.bind(this);
    }

    render() {

        return (
        
            <View style={{padding: 30}}>
         
                <Form ref={(form) => this.form = form}>
            
                    <Input property="name" labelText="用户名" placeholder="请输入用户名"/>
            
                    <Input property="password" labelText="密码" placeholder="请输入密码"/>
            
                    <Form group={true} property="hobbies">
        
                            <Input property="name" labelText="爱好一" placeholder="请输入爱好一"/>
        
                            <Input property="name" labelText="爱好二" placeholder="请输入爱好二"/>
           
                    	</Form>
                 
         
                </Form>
       
                <TouchableOpacity style={{width: 250, height: 35, marginTop: 30, justifyContent: 'center', alignItems: 'center', backgroundColor: '#40b0ff'}} onPress={this.onPressed}>
        
                    <Text>提交</Text>
 
            		</TouchableOpacity>
    
            </View>

        );

    }

    onPressed() {

        console.log('form data: \n' + JSON.stringify(this.form.data()));
    }
}

示例结果输出

{
    "name":"chenyunjie",
    "password":"123456",
    "hobbies":[
        {
            "name":"足球"
        },
        {
            "name":"篮球"
        }
    ]
}

说明

可自定义表单项,参考内置的Input实现,表单项需要实现

props

a. 每个表单项需要传递propery属性,表单的group=true时可以不传递
b. 非group类型的表单数据没有property参数,则不会将值记录到表单数据中去

方法:

取值:getValue

设值:setValue

属性:

表单标识:isFormCell=true

表单自身也可以存在setValue方法,该方法会根据表单结构和从给定的数据中按照props.property进行设置值