Socket
Socket
Sign inDemoInstall

react-native-custom-radio-button

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-custom-radio-button

custom radio button for react native apps


Version published
Weekly downloads
36
increased by350%
Maintainers
1
Install size
286 kB
Created
Weekly downloads
 

Readme

Source

react-native-custom-radio-button

Simple and animated radio button component for React Native

Demo

Demo

Installation

npm i react-native-custom-radio-button --save

Getting started

Basic

import {RadioGroup, RadioButton} from 'react-native-custom-radio-button'

onSelect(index, value){
  this.setState({
    text: `${value}`
  })
}

render(){
  return(
    <View style={styles.container}>
    
      <RadioGroup
        onSelect = {(index, value) => this.onSelect(index, value)}
      >
        <RadioButton value={'React native'}>
          <Text style={styles.title}>React native</Text>
        </RadioButton>

        <RadioButton value={'Javascript'}>
          <Text style={styles.title}>Javascript</Text>
        </RadioButton>

        <RadioButton value={'Flexbox'}>
          <Text style={styles.title}>Flexbox</Text>
        </RadioButton>
      </RadioGroup>
      
      <Text style={styles.text}>{this.state.text}</Text>
      
    </View>
  )
}

Custom

   <RadioGroup
      size={24}
      thickness={2}
      selectedIndex={1}
      onSelect = {(index, value) => this.onSelect(index, value)}
    >
      <RadioButton 
        value='Red color'
        color='red'>
        <Text style={styles.title}>Red color</Text>
      </RadioButton>

      <RadioButton 
        value='Green color'
        color='green'>
        <Text style={styles.title}>Green color</Text>
      </RadioButton>

      <RadioButton 
        value='Blue color'
        color='blue'>
        <Text style={styles.title}>Blue color</Text>
      </RadioButton>
    </RadioGroup>

Configuration

Radio Group:
PropertyTypeDefaultDescription
sizenumber20radio button size
thicknessnumber1radio button border width
colorstring'#007AFF'radio button color
highlightColorstringnullselected radio button background
selectedIndexnumbernulldefault selected index of radio group
onSelectfunction(index, value)nullfunction to be invoked when radio button is selected

Contributing

Of course! Welcome :)

You can use following command in example dir:

Keywords

FAQs

Last updated on 02 Aug 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc