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-formly-templates-md

v0.2.4

Published

Ready made materialized components for your react-native formly forms

Downloads

12

Readme

React-native-formly: Material Template

Getting Started

Prerequisites

This is a material template for react-native-formly. So make sure that it is installed first.

Installing

npm install react-native-formly-templates-md --save

Components

input

templateOptions Configuration:

| name | description | type | default |------------| ---------------------------------------|-------------------------------------------------|-------------- |label | Input Label | string | - |placeholder | Input placeholder | string | - |description | Input description | string | - |required | Input should have a value | bool | - |disabled | Input is disabled | bool | - |minlength | Minimum character length to be entered | number | - |maxlength | Maximum character length to be entered | number | - |type | Input text type | string of (text, number, url, email, password)| 'text' |pattern | The property that contains radio value | string regex |-

Example:

{
	key: 'myMaterialInput',
	type: 'input',
	templateOptions: {
		label: "Number Input",
		placeholder:"Write a number here",
		required:true,
	        minlength: 3,
	        type:"number"
	}
}

textarea

templateOptions Configuration:

| name | description | type | default |------------| ---------------------------------------|-------------------------------------------------|-------------- |label | Input Label | string | - |placeholder | Input placeholder | string | - |description | Input description | string | - |required | Input should have a value | bool | - |disabled | Input is disabled | bool | - |minlength | Minimum character length to be entered | number | - |maxlength | Maximum character length to be entered | number | - |type | Input text type | string of (text, number, url, email) | 'text' |pattern | The property that contains radio value | string regex |-

Example:

{
	key: 'myMaterialTextarea',
	type: 'textarea',
	templateOptions: {
		label: "Textarea",
		placeholder:"Say something here",
		required:true,
		maxlength: 200
	}
}
	

select

| name | description | type | default | |---------------|---------------------------------------------------------------|---------------|---------------| |label | Radio group Label| string | - | | |description | Radio group description| string | - | | |required | Radio group should have a value | bool | - | |disabled | Radio group is disabled| bool | - | | |minlength | Minimum character length to be entered | number | - | |maxlength | Maximum character length to be entered | number | - | |options | Array of select options to be rendered | array | [] | |labelProp | The property that contains radio label if option is object | string | 'name' | |valueProp | The property that contains radio value if option is object | string | 'value' | |pattern | The property that contains radio value | string regex | -

Example:

{
	key: 'myMaterialSelect',
	type: 'select',
	templateOptions: {
		label: 'Select',
		required: true,
		description : 'Select your type',
		options:[
			'string',
			2,
			{name:'label', value:'value'}
			]
	}
}

radio

| name | description | type | default | |---------------|---------------------------------------------------------------|---------------|---------------| |label | Radio group Label| string | - | | |description | Radio group description| string | - | | |required | Radio group should have a value | bool | - | |disabled | Radio group is disabled| bool | - | | |minlength | Minimum character length to be entered | number | - | |maxlength | Maximum character length to be entered | number | - | |options | Array of radio buttons to be rendered | array | [] | |labelProp | The property that contains radio label if option is object | string | 'name' | |valueProp | The property that contains radio value if option is object | string | 'value' | |pattern | The property that contains radio value | string regex | -

Example:

{
	key: 'myMaterialRadio',
	type: 'radio',
	templateOptions: {
		label: 'Radio Input',
		required:true,
		description : 'Select your type',
		options:[
			"string",
			2,
			{name:'array', value:[1,2,3]},
			{name:'date', value: new Date()},
			{name:'object', value:{prop1:'value1'}}
			]
	}
}

Configuring Validation

Available validations are:

  • required
  • url
  • email
  • number
  • pattern
  • minlength
  • maxlength

Customize validation message

You can customize any of the previous validations messages by adding a message to formly's MessagesConfig.

import { Formly, FormlyConfig } from 'react-native-formly';
let {MessagesConfig } = FormlyConfig;

MessagesConfig.addType([
  {
    name: 'required',
    message: "'This field is Required!!!'"
  },
  {
    name: 'number',
    message: "viewValue+' is not a number'"
  }
]);

Overriding validations

If you ever wanted to change a validation you can override it using formly's ValidationsConfig.

import { Formly, FormlyConfig } from 'react-native-formly';
let {ValidationsConfig} = FormlyConfig;

ValidationsConfig.addType({
 minlength: {
    expression: function ({ viewValue, modelValue, param }) {
      return viewValue && viewValue.length >= param;
    },
    message:"'Minimum length is '+ param"
  }
});

Make sure that you add this validations after requiring the template

Roadmap

  • [x] input
  • [x] radio
  • [x] textarea
  • [ ] checkbox
  • [ ] multicheckbox
  • [ ] customizable themes
  • [x] select