Coder Social home page Coder Social logo

react-native-custom-radio-group's Introduction

react-native-custom-radio-group

A react native radio group component with custom radio button. The component enables single select radio button behaviour with default select option and customization of the button styles.

Example:
Example uses default styles by RadioGroup

Demo gif

Installation:

Add on you package.json:
"react-native-custom-radio-group": "https://github.com/bluedot-bd/react-native-custom-radio-group"

Props:

  • radioGroupList (Required) : An array of object; object => {label: '', value: ''}
  • onChange: CallBack with the value of selected radio button
  • initialValue: Value of the option to be initially selected
  • containerStyle: Style of the radio group container
  • buttonContainerStyle: Base style of the custom button container,
  • buttonTextStyle: Base style of the custom button label text,
  • buttonContainerActiveStyle: Added style of the custom button container when active,
  • buttonContainerInactiveStyle: Added style of the custom button container when inactive,
  • buttonTextActiveStyle: Added style of the custom button text when active,
  • buttonTextInactiveStyle: Added style of the custom button text when inactive

Usage:

import React, {Component} from 'react';
import {View, Text} from 'react-native';
import RadioGroup from 'react-native-custom-radio-group';
import {radioGroupList} from './radioGroupList.js'

export default class MyComponent extends Component {
  render () {
    return (
      <View>
        <Text> SELECT: </Text>
        <RadioGroup radioGroupList={radioGroupList}/>
      </View>);
  }
}
//radioGroupList.js
export const radioGroupList = [{
  label: 'Car',
  value: 'transport_car'
}, {
  label: 'Bike',
  value: 'transport_bike'
}, {
  label: 'Bus',
  value: 'transport_bus'
}];

react-native-custom-radio-group's People

Contributors

ayushinigam avatar mahmudunnabirain avatar

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.