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

rn-easy-forms

v1.0.5

Published

An easy way to render forms and do form validation in React Native.

Downloads

3

Readme

React Native Easy Forms

This module allows you to create React Native forms by declaring your form as a Javascript object.

Features

  • Automatically validates fields for being empty or not
  • Supports auto-completion
  • Support auto completing places using Google Places Autocomplete API
  • Supports displaying a checkbox for toggling the display of secure text fields
  • Fully customizable appearance

Usage

yarn add rn-easy-forms
npm i --save rn-easy-forms

Example

import { Form } from 'rn-easy-forms'
import { View, Button } from 'react-native'

const signInFields = [
  {
    name: EMAIL_FIELD_NAME,
    placeholder: EMAIL_PLACEHOLDER
  },
  {
    name: PASSWORD_FIELD_NAME,
    placeholder: PASSWORD_PLACEHOLDER,
    secure: true
}]

class SignInForm extends React.Component {
  _signInAsync = async () => {
    let  validateResult  =  this.formRef.validate()
    if (validateResult) {
      //proceed to next page
    }
  }

  render() {
    return (
      <View>
      <Form
        ref={(el) => {this.formRef = el}}
        fieldList={signInFields}
      />
      <Button title="Sign In" onPress={this._signInAsync}  />
      </View>
    )
  }
}

Usage

Props

| Name | Type | Description | Required | |--|--|--|--| | fieldList |Array<Object>|Array of objects describing each field in the form | Y | suggestionProviders | Object | Key value pairs of String -> SuggestionProvider | N | fieldWithCheckboxStyle | Object | Styles for the container holding a field and a secure text entry checkbox | N

Spec

Field Object Keys

|Key | Value | Description | Required |--|--|--|--| | name | String | unique name of the field | Y | placeholder | String | placeholder for field input | N | autocompleteType | String | type of SuggestionProvider to use, a key with this SuggestionProvider must exist in the suggestionProviders prop passed to the form | N | additionalDataForSuggestionsProvider | Object | additional data used by the SuggestionsProvider for providing autocomplete suggestions | N | allowEmpty | Boolean | allows the field to be empty, default is false | N | secure | Boolean | makes the text entry secure | N | showSecureCheckbox | Boolean | if set, a checkbox will be displayed below the field toggling the display between hidden and plain text | N | keyboardType | String | set the keyboard type of the field | N

Suggestion Providers Example

{ "Google" : new GoogleSuggestionProvider("YOUR_API_KEY") }

For custom suggestion providers, your class can use have these methods(Typescript interface coming soon):

|Method | args | description | required |--|--|--|--| |async getSuggestions|input(String), sessionToken(String), additionalData(Object) | fetches autocomplete suggestions. uses an optional sessionToken, used to group autocomplete requests and accepts an arbitrary object defining any additional data used for the autocomplete request | Y |async onSelectSuggestion | item(Object), setAdditionalFields(Function), additionalData(Object), sessionToken(String) | Additional logic to be executed when an autocomplete suggestion is selected | N | renderFooter | | returns a footer component to render at the bottom of the autocomplete suggestions | N

API

|Method | args | description | return type |--|--|--|--| | validate | | validates the form, returns undefined if validation fails or an Object with key value pairs of {name: value} where the name is the unique name for the field | Object