Coder Social home page Coder Social logo

malaa-tech / react-native-reanimated-accordion Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 0.0 462 KB

A simple animated expandable section for react native apps using reanimated ๐Ÿ’ณ

License: MIT License

JavaScript 23.70% TypeScript 76.30%
accordion android ios react-native reanimated reanimated3

react-native-reanimated-accordion's Introduction

react-native-reanimated-accordion

A simple animated expandable section for react native apps using reanimated

๐Ÿฆ„ Features

  • โœ… Customizable
  • โœ… Includes option to not render collapsed compnent. (For less rendring).
  • โœ… Uses Reanimated v3

How we use it

Installation

npm install react-native-reanimated-animated-accordion

or using yarn

yarn add react-native-reanimated-animated-accordion

โš ๏ธ Make sure you have react-native-reanimated installed in your project.

Usage

import Expandable from 'react-native-reanimated-animated-accordion';

<View
  style={{
    width: '80%',
    borderRadius: 20,
    backgroundColor: 'white',
    shadowOffset: {
      height: -2,
      width: 0,
    },
    elevation: 2,
    shadowRadius: 20,
    shadowOpacity: 0.07,
  }}
>
  <TouchableOpacity
    style={{
      padding: 20,
    }}
    onPress={() => {
      setExpanded(!expanded);
    }}
  >
    <Text>Toggle</Text>
  </TouchableOpacity>
  <View style={{ width: '100%' }}>
    <Expandable
      duration={speed}
      expanded={expanded}
    >
      <View style={{ width: '100%', padding: 20, paddingTop: 0 }}>
        <Text>
          Lorem ipsum dolor sit amet consectetur, adipisicing elit.
          Necessitatibus ab placeat alias commodi voluptatibus possimus
          ducimus sit repellat praesentium fugit similique aut quam nemo
          libero, aperiam deleniti modi natus quia!
        </Text>
        <Text>
          Lorem ipsum dolor sit amet consectetur, adipisicing elit.
          Necessitatibus ab placeat alias commodi voluptatibus possimus
          ducimus sit repellat praesentium fugit similique aut quam nemo
          libero, aperiam deleniti modi natus quia!
        </Text>

        <View
          style={{ marginTop: 20, width: '100%', alignItems: 'center' }}
        >
          <Image
            source={testImage}
            style={{ height: 100, width: 100, resizeMode: 'contain' }}
          />
        </View>
      </View>
    </Expandable>
  </View>
</View>

Reduce Rendering

If you would like to prevent collapsed components from being rendered, just add a renderWhenCollapsed={false}. this can help if you have heavy collapsed compoennts as it may reduce your boot time + ram.

<Expandable
  duration={speed}
  renderWhenCollapsed={false}
  expanded={expanded}
>
//
</Expandable>

License

MIT


Made with create-react-native-library

react-native-reanimated-accordion's People

Contributors

wadhahessam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.