Giter Club home page Giter Club logo

react-native-radio's Introduction

react-native-radio-input

A pure react, easy to use and highly customizable radio group. As easy as html radio.

sample sample2

yarn add react-native-radio-input --save
yarn add react-native-vector-icons --save
react-native link

Examples

Basic

import RadioGroup,{Radio} from "react-native-radio-input";

...
getChecked = (value) => {
    // value = our checked value
    console.log(value)
  }
...
<RadioGroup getChecked={this.getChecked}>
    <Radio iconName={"lens"} label={"The first option"} value={"A"}/>
    <Radio iconName={"lens"} label={"The first option"} value={"B"}/>
    <Radio iconName={"lens"} label={"I need numbers"} value={1}/>
    <Radio label={"Is IconName Optional?"} value={"Yes"}/>
    <Radio label={"Show Sentence Value"} value={"This is a Sentence"}/>
</RadioGroup>
...

Moderate-To-Advanced

You can add styles, see the props

...
getChecked = (value) => {
    // value = our checked value
    console.log(value)
  }
...
<RadioGroup getChecked={this.getChecked} RadioGroupStyle={{flexDirection: "row" }}>
    <Radio iconName={"lens"} label={"The first option"} value={"A"} />
    <Radio iconName={"lens"} label={"The first option"} value={"B"}/>
    <Radio iconName={"lens"} label={"I need numbers"} value={1}/>
    <Radio label={"Is IconName Optional?"} value={"Yes"}/>
    <Radio label={"Show Sentence Value"} value={"This is a Sentence"}/>
</RadioGroup>
...

Styling

Style the radio group, radio button, the label, and the core of the button.

Icons

The core of the button is made of icons from react-native-vector-icons

Props

Radio Group

prop Proptype Required Default Examples
getChecked Function Yes null 1. getChecked=(value)=>{console.log(value)}
2. function getChecked(value){console.log(value)}
RadioGroupStyle React Native View Style No null RadioGroupStyle={{flexDirection:"row"}}
RadioStyle React Native View Style No null RadioStyle={{backgroundColor:"yellow"}}
IconStyle React Native Text Style No null IconStyle={{fontSize:12}}
labelStyle React Native Text Style No null labelStyle={{fontSize:12}}
coreStyle React Native Text Style No null coreStyle={{fontSize:12}}
getChecked - function to receive the selected value - usage - See [Basic](#Basic) - (Required) RadioGroupStyle - React Native View Style RadioStyle - React Native View Style IconStyle - React Native Text Style labelStyle - React Native Text Style coreStyle - React Native Text Style

Radio

prop Proptype Required Default Examples
iconGroup String No MaterialIcons iconGroup = {"MaterialIcons"}
iconName String No lens iconName = {"lens"}
label String Yes null label = {"This is item 1"}
value String or number Yes null value = {"A"}
iconGroup - based on [react-native-vector-icons](https://oblador.github.io/react-native-vector-icons) v4.6.0 by @oblador. All the icon groups are supported. Default is "MaterialIcons".

iconName - Any icon from the iconGroup mentioned. Default is "lens" - (Required).

label - Label that needs to be displayed by or under the radio button,

value - The return value for the radio button. (Required)

License

Apache 2.0

react-native-radio's People

Contributors

dependabot[bot] avatar solaomosola avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

react-native-radio's Issues

More radiogroup

How can I send radiogroup name to getChecked?

I have
0 - group
a - radio
b - radio
c - radio
d - radio
1 - group
a - radio
b - radio
2 - group
a - radio
b - radio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.