Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pietile-native-kit/expandable-view

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pietile-native-kit/expandable-view

View that changes its height with nice animation

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

ExpandableView

npm version

Manages content height gracefully allowing to alternate betweeen two states: expanded and collapsed. ExpandableView doesn't require setting content height explicitly and measures it automatically. Useful for building accordion-like components.

Installation

Using yarn

yarn add @pietile-native-kit/expandable-view

or using npm

npm install -S @pietile-native-kit/expandable-view

Usage

Usage is quite simple: put content in ExpandableView and control show property.

Example

import React, { useState } from 'react';

import ExpandableView from '@pietile-native-kit/expandable-view';
import { Text, TouchableHighlight, View, ViewPropTypes } from 'react-native';

function ExpandableViewExample({ style }) {
  const [show, setShow] = useState(true);

  function onPress() {
    setShow(!show);
  }

  return (
    <View>
      <TouchableHighlight onPress={onPress}>
        <Text style={{ padding: 8 }}>Toggle</Text>
      </TouchableHighlight>

      <ExpandableView show={show}>
        <Text style={{ fontSize: 86 }}>Expandable content</Text>
      </ExpandableView>
    </View>
  );
}

API

Properties

namedescriptiontypedefault
childrenContentNode-
contentStyleStyle of container that wraps children and used to measure content dimensionsstyle-
showShow or hide contentbooleanfalse
styleStyle of component itselfstyle-

License

Pietile ExpandableView is MIT License.

Keywords

FAQs

Package last updated on 01 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc