1.0.2-bata • Published 6 months ago

react-native-choice-button v1.0.2-bata

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

react-native-choice-button

Install the package:

$ npm i react-native-choice-button --save

Import the Button component:

import ChoiceButton from 'react-native-choice-button'

Usage

    const fruits = [
          { id: 1, name: "Apple" },
          { id: 2, name: "Banana" },
          { id: 3, name: "Orange" },
          { id: 4, name: "Mango" },
          { id: 5, name: "Strawberry" },
          { id: 6, name: "Grapes" },
          { id: 7, name: "Kiwi" },
          { id: 8, name: "Pineapple" },
          { id: 9, name: "Cherry" },
          { id: 10, name: "Watermelon" },
    ];


    <ChoiceButton  
        data={fruits}
        onPressCallback={(name, id) => {
          console.log(`Button pressed: name=${name}, id=${id}`);
        }}
    />

Images

API

PropTypeDescription
onPressCallbackfuncFunction to execute when the onPress event is triggered.
customContainerStyleViewStyleThe StyleSheet to apply to the root view
customButtonStyleViewStyleThe StyleSheet to apply to the button view
customTextStyleTextStyleThe StyleSheet to apply to the text
widthnumber
heightnumber
bgColorstring
fontSizenumber
fontFamilystring
borderColorstring
borderWidthnumber
borderRadiusnumber
marginVerticalnumber
selectedBgColorstring
selectedBdColorstring
paddingVerticalnumber
borderRadiusnumber
marginHorizontalnumber
defaultTextColorstring
selectedTextColorstring
paddingHorizontalnumber