0.7.0 • Published 4 years ago

@dooboo-ui/native-accordion v0.7.0

Weekly downloads
92
License
MIT
Repository
github
Last release
4 years ago

Accordion

Npm Version Downloads

Simple drop down item component for react-native. This component supports drop down toggle with animation.

image

Props

necessarytypesdefault
contentVisibleOnLoadbooleanfalse
headerany<View/>
backgroundColorstringtransparent
titleBackgroundstringtransparent
contentBackgroundstringtransparent
underlineColorstringtransparent
visibleElementReactElementnull
invisibleElementReactElementnull
styleStyleProp<ViewStyle>undefined
childrenReactElementundefined

Installation

yarn add @dooboo-ui/native

or

yarn add @dooboo-ui/native-accordion

Getting started

  • Import

    import { Accordion } from '@dooboo-ui/native';
    // or
    import Accordion from '@dooboo-ui/native-accordion';
  • Data

    state = {
      contents: [
        {
          title: 'Title 1',
          body: 'Hi. I love this component. What do you think?',
        },
        {
          title: 'See this one too',
          body: 'Yes. You can have more items.',
        },
        {
          title: 'Thrid thing',
          body:
            'What about very long text? What about very long text? What about very long text? What about very long text? What about very long text? What about very long text? What about very long text? What about very long text? What about very long text? What about very long text? What about very long text? What about very long text?',
        },
      ],
    };
  • Usage

    <View style={styles.container}>
      <ScrollView style={{ alignSelf: 'stretch' }}>
        {
          this.state.contents
            ? this.state.contents.map((param, i) => {
              return (
                <Accordion
                  key={i}
                  style={styles.Accordion}
                  contentVisible={false}
                  visibleElement={
                    <StyledImage
                      source={IC_ARR_UP}
                    />
                  }
                  invisibleElement={
                    <StyledImage
                      source={IC_ARR_DOWN}
                    />
                  }
                  header={
                    <View>
                      <Text style={{
                        fontSize: 16,
                        color: 'blue',
                      }}>{param.title}</Text>
                    </View>
                  }
                >
                  <Text style={[
                    styles.txt,
                    {
                      fontSize: 20,
                    }
                  ]}>
                    {param.body}
                  </Text>
                </Accordion>
              );
            })
            : null
        }
        <View style={{ height: 96 }}/>
      </ScrollView>
    </View>
    });
0.7.0

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.0

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.0

4 years ago