New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

@dooboo-ui/native-button-group

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@dooboo-ui/native-button-group

[![Npm Version](http://img.shields.io/npm/v/@dooboo-ui/native-button-group.svg?style=flat-square)](https://npmjs.org/package/@dooboo-ui/native-button-group) [![Downloads](http://img.shields.io/npm/dm/@dooboo-ui/native-button-group.svg?style=flat-square)](

0.4.1
unpublished
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created

ButtonGroup

Npm Version Downloads

[ButtonGroup] is an ios section like component. You can have as may selectors as you want.

ButtonGroup

Props

necessarytypesdefault
testIDstring
containerStyleStyleProp<ViewStyle>
styleStyleProp<ViewStyle>
viewStyleStyleProp<ViewStyle>
selectedViewStyleStyleProp<ViewStyle>
textStyleStyleProp<TextStyle>
selectedTextStyleStyleProp<TextStyle>
datastring[]['Option 1', 'Option 2']
onPress(i: number) => void

Installation

yarn add @dooboo-ui/native

or

yarn add @dooboo-ui/native-button-group

Getting started

  • Import

    import { ButtonGroup } from '@dooboo-ui/native';
    // or
    import ButtonGroup from '@dooboo-ui/native-button-group';
    
  • Usage

    function Page(props: Props) {
      const data = ['Option 1', 'Option 2', 'Option 3', 'Option 4'];
    
      const [option, setOption] = useState('Option 1');
    
      const selectOption = (index: number) => {
        setOption(data[index]);
        switch (index) {
          case 0:
            setOption('Option 1');
            break;
          case 1:
            setOption('Option 2');
            break;
        }
      };
    
      return (
        <Container>
          <ButtonGroup
            testID="BTN_GROUP"
            style={{ marginTop: 40 }}
            onPress={(index: number) => selectOption(index)}
            data={data}
          />
          <View
            style={{
              flex: 1,
              justifyContent: 'center',
              alignItems: 'center',
            }}
          >
            <Text
              style={{
                fontSize: 32,
              }}
            >
              {option}
            </Text>
          </View>
        </Container>
      );
    }
    

FAQs

Package last updated on 13 Mar 2020

Did you know?

Socket

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