1.0.1 • Published 3 years ago

@beingrahulvyas/react-native-accordion v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-native-accordion

Animated accordion for React Native.

Installation

npm install @beingrahulvyas/react-native-accordion

Properties

PropDescription
headerA function that should return a component. It represets the header of accordion.
bodyA function that should return a component. It represets the body of accordion.
containerStylestyling for main accordion container
onToggleA function that return boolean value (expended -> true)

Example

import React from 'react';
import {StyleSheet, Text} from 'react-native';
import Accordian from '@beingrahulvyas/react-native-accordion';

const App = () => {
  return (
    <Accordian
        header={() => <Text style={styles.headerTextStyle}>Header</Text>}
        containerStyle={styles.acondianContainer}
        body={() => (
            <Text>
              Loremuswdc saucasdbcusdc bsduchsd bcsdcsdbsd cs
              dcbsdcsdbcsdbckbsdcsdcsdb cs dcbsdc sd csdbcsdbcsd v sdovisdf
              vbsdjv h
            </Text>
        )}
    />
  );
};

const styles = StyleSheet.create({
  headerTextStyle: {
    paddingHorizontal: 16,
    paddingVertical: 8,
    fontWeight: '600',
    color: '#000',
    borderBottomWidth: 1,
  },
  acondianContainer: {
    margin: 4,
    borderWidth: 1,
    borderColor: '#cacaca',
    borderRadius: 4,
    overflow: 'hidden',
  },
});