1.0.0 • Published 5 years ago

react-native-auto-collapsible v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

react-native-auto-collapsible

React-native view which automatically collapses or expands when content changes.

purpose

Useful for lists of items with dynamic contents to avoid jumping on view height change

usage

1) install npm install react-native-auto-collapsible --save / yarn add react-native-auto-collapsible 2) use

import AutoCollapsible from "react-native-auto-collapsible"

const render = (props) => (
    <AutoCollapsible>
        <MyComp {...props}/>
    </AutoCollapsible>
)

or as HOC

import {AutoCollapsibleHOC} from  "react-native-auto-collapsible"

const CollapsibleMyComp = AutoCollapsibleHOC({})(MyComp);

Props

  • resizeAnimation - sets custom animation
resizeAnimation = (animatedValue, newHeight) =>
      Animated.spring(animatedValue, {
        toValue: newHeight,
        duration: 200
      })