1.1.0 • Published 4 years ago

react-native-drop-down-item v1.1.0

Weekly downloads
94
License
ISC
Repository
github
Last release
4 years ago

react-native-drop-down-item (Deprecated!)

Current package has been moved to @dooboo-ui/native-accordion

Npm Version Downloads Build Status License

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

Npm repo

https://www.npmjs.com/package/react-native-drop-down-item

Git repo

https://github.com/dooboolab/react-native-drop-down-item

Props

necessarytypesdefault
contentVisiblebooleanfalse
headerany<View/>
backgroundColorstringtransparent
titleBackgroundstringtransparent
contentBackgroundstringtransparent
underlineColorstringtransparent
visibleImageanyundefined
invisibleImageanyundefined

Getting started

$ npm install react-native-drop-down-item --save

  • Import

    import DropDownItem from "react-native-drop-down-item";
  • 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 (
                <DropDownItem
                  key={i}
                  style={styles.dropDownItem}
                  contentVisible={false}
                  invisibleImage={IC_ARR_DOWN}
                  visibleImage={IC_ARR_UP}
                  header={
                    <View>
                      <Text style={{
                        fontSize: 16,
                        color: 'blue',
                      }}>{param.title}</Text>
                    </View>
                  }
                >
                  <Text style={[
                    styles.txt,
                    {
                      fontSize: 20,
                    }
                  ]}>
                    {param.body}
                  </Text>
                </DropDownItem>
              );
            })
            : null
        }
        <View style={{ height: 96 }}/>
      </ScrollView>
    </View>
    });