New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-collapsible

Package Overview
Dependencies
Maintainers
2
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-collapsible

Animated collapsible component for React Native using the Animated API. Good for accordions, toggles etc

  • 1.6.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
74K
decreased by-59.17%
Maintainers
2
Weekly downloads
 
Created

What is react-native-collapsible?

The react-native-collapsible package provides components for creating collapsible views in React Native applications. It allows developers to easily create sections of content that can be expanded or collapsed, improving the user experience by managing the visibility of large amounts of content.

What are react-native-collapsible's main functionalities?

Collapsible Component

The Collapsible component allows you to create a section of content that can be expanded or collapsed. The 'collapsed' prop controls the visibility of the content.

import Collapsible from 'react-native-collapsible';
import { View, Text, Button } from 'react-native';
import React, { useState } from 'react';

const Example = () => {
  const [collapsed, setCollapsed] = useState(true);

  return (
    <View>
      <Button title="Toggle" onPress={() => setCollapsed(!collapsed)} />
      <Collapsible collapsed={collapsed}>
        <Text>This is collapsible content</Text>
      </Collapsible>
    </View>
  );
};

export default Example;

Accordion Component

The Accordion component allows you to create a list of sections that can be expanded or collapsed individually. It manages the state of which sections are currently expanded.

import Accordion from 'react-native-collapsible/Accordion';
import { View, Text } from 'react-native';
import React, { useState } from 'react';

const SECTIONS = [
  { title: 'First', content: 'Lorem ipsum...' },
  { title: 'Second', content: 'Lorem ipsum...' }
];

const Example = () => {
  const [activeSections, setActiveSections] = useState([]);

  const renderHeader = (section) => (
    <View><Text>{section.title}</Text></View>
  );

  const renderContent = (section) => (
    <View><Text>{section.content}</Text></View>
  );

  return (
    <Accordion
      sections={SECTIONS}
      activeSections={activeSections}
      renderHeader={renderHeader}
      renderContent={renderContent}
      onChange={setActiveSections}
    />
  );
};

export default Example;

Other packages similar to react-native-collapsible

Keywords

FAQs

Package last updated on 27 Aug 2024

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