npm

Need private packages and team management tools?Check out npm Orgs. »

react-native-bpk-component-animate-height

3.0.17 • Public • Published

react-native-bpk-component-animate-height

Backpack React Native animate height component.

Installation

npm install react-native-bpk-component-animate-height --save-dev

Usage

import React, { Component } from 'react';
import { View, StyleSheet } from 'react-native';
import BpkText from 'react-native-bpk-component-text';
import BpkButton from 'react-native-bpk-component-button';
import { spacingBase } from 'bpk-tokens/tokens/base.react.native';
import BpkAnimateHeight from 'react-native-bpk-component-animate-height';
 
const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    padding: spacingBase,
  },
  animateHeight: {
    marginBottom: spacingBase,
  }
});
 
export default class App extends Component {
  constructor() {
    super();
 
    this.state = {
      expanded: false,
    };
 
  }
 
  onToggle = () => {
    this.setState({ expanded: !this.state.expanded });
  }
 
  render() {
    return (
      <View style={styles.container}>
        <BpkAnimateHeight
          expanded={this.state.expanded}
          style={styles.animateHeight}
        >
          <BpkText>
            Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean
            commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus
            et magnis dis parturient montes, nascetur ridiculus mus.
          </BpkText>
        </BpkAnimateHeight>
        <BpkButton title="Toggle" onPress={this.onToggle} />
      </View>
    );
  }
}

Props

Property PropType Required Default Value
children Node Yes -
expanded bool Yes -
animationDuration number No 400
expandDelay number No 0
collapseDelay number No 0

Keywords

none

install

npm i react-native-bpk-component-animate-height

Downloadsweekly downloads

283

version

3.0.17

license

Apache-2.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability