Skip to content

punksta/react-native-auto-collapsible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-auto-collapsible

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

purpose

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

https://snack.expo.io/Sy0l5vruE - demo

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
      })

About

React-native view which automatically collapses or expands on content size changes

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published