npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-accordion-met

v2.0.0

Published

React Native Accordion Menu

Downloads

13

Readme

React Native Accordion (by Metin)

npm version dependencies Status styled with prettier Monthly download Total downloads

An easy, decent way of creating accordion menu for react native

Installation

npm i --save react-native-accordion-met

or

yarn add react-native-accordion-met

Usage

Include it...

import Accordion from 'react-native-accordion-met';

The idea...

    <Accordion>
      <Accordion.Item open={true}>
        <Accordion.Header>
          ...
        </Accordion.Header>
        <Accordion.Content>
          ...
        </Accordion.Content>
      </Accordion.Item>
      <Accordion.Item>
        <Accordion.Header>
          ...
        </Accordion.Header>
        <Accordion.Content>
          ...
        </Accordion.Content>
      </Accordion.Item>
    </Accordion>

A working example:

import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View
} from 'react-native';

import Accordion from 'react-native-accordion-met';

export default class App extends Component<{}> {
  render() {
    return (
      <View style={styles.container}>
        <Accordion>
          <Accordion.Item open={true}>
            <Accordion.Header>
              <Text>First Menu Item</Text>
            </Accordion.Header>
            <Accordion.Content>
              <Text>Content for first item</Text>
              <Text>Content for first item</Text>
              <Text>Content for first item</Text>
            </Accordion.Content>
          </Accordion.Item>
          <Accordion.Item>
            <Accordion.Header>
              <Text>Second Menu Item</Text>
            </Accordion.Header>
            <Accordion.Content>
              <Text>Content for second item</Text>
              <Text>Content for second item</Text>
              <Text>Content for second item</Text>
            </Accordion.Content>
          </Accordion.Item>
          <Accordion.Item>
            <Accordion.Header>
              <Text>Third Menu Item</Text>
            </Accordion.Header>
            <Accordion.Content>
              <Text>Content for third item</Text>
              <Text>Content for third item</Text>
              <Text>Content for third item</Text>
            </Accordion.Content>
          </Accordion.Item>
        </Accordion>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    marginTop: 22,
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
});

Some more styling:


import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View
} from 'react-native';

import Accordion from './react-native-accordion-met'

export default class App extends Component<{}> {
  render() {
    return (
      <View style={styles.container}>

        <Accordion style={styles.accordion} duration={1300}>
          <Accordion.Item style={styles.accordionItem} open={true}>
            <Accordion.Header style={styles.accordionTitle}>
              <Text style={styles.accordionTitleText}>First Menu Item</Text>
            </Accordion.Header>
            <Accordion.Content>
              <Text style={styles.accordionTitleText}>Content for first item</Text>
              <Text style={styles.accordionTitleText}>Content for first item</Text>
              <Text style={styles.accordionTitleText}>Content for first item</Text>
              <Text style={styles.accordionTitleText}>Content for first item</Text>
              <Text style={styles.accordionTitleText}>Content for first item</Text>
              <Text style={styles.accordionTitleText}>Content for first item</Text>
              <Text style={styles.accordionTitleText}>Content for first item</Text>
              <Text style={styles.accordionTitleText}>Content for first item</Text>
            </Accordion.Content>
          </Accordion.Item>
          <Accordion.Item style={styles.accordionItem}>
            <Accordion.Header style={styles.accordionTitle}>
              <Text style={styles.accordionTitleText}>Second Menu Item</Text>
            </Accordion.Header>
            <Accordion.Content>
              <Text style={styles.accordionTitleText}>Content for second item</Text>
              <Text style={styles.accordionTitleText}>Content for second item</Text>
              <Text style={styles.accordionTitleText}>Content for second item</Text>
              <Text style={styles.accordionTitleText}>Content for second item</Text>
              <Text style={styles.accordionTitleText}>Content for second item</Text>
              <Text style={styles.accordionTitleText}>Content for second item</Text>
            </Accordion.Content>
          </Accordion.Item>
          <Accordion.Item style={styles.accordionItem}>
            <Accordion.Header style={styles.accordionTitle}>
              <Text style={styles.accordionTitleText}>Third Menu Item</Text>
            </Accordion.Header>
            <Accordion.Content>
              <Text style={styles.accordionTitleText}>Content for 3 item</Text>
              <Text style={styles.accordionTitleText}>Content for 3 item</Text>
              <Text style={styles.accordionTitleText}>Content for 3 item</Text>
              <Text style={styles.accordionTitleText}>Content for 3 item</Text>
              <Text style={styles.accordionTitleText}>Content for 3 item</Text>
              <Text style={styles.accordionTitleText}>Content for 3 item</Text>
              <Text style={styles.accordionTitleText}>Content for 3 item</Text>
            </Accordion.Content>
          </Accordion.Item>
          <Accordion.Item style={styles.accordionItem}>
            <Accordion.Header style={styles.accordionTitle}>
              <Text style={styles.accordionTitleText}>Forth Menu Item</Text>
            </Accordion.Header>
            <Accordion.Content>
              <Text style={styles.accordionTitleText}>Content for 4 item</Text>
              <Text style={styles.accordionTitleText}>Content for 4 item</Text>
              <Text style={styles.accordionTitleText}>Content for 4 item</Text>
              <Text style={styles.accordionTitleText}>Content for 4 item</Text>
              <Text style={styles.accordionTitleText}>Content for 4 item</Text>
              <Text style={styles.accordionTitleText}>Content for 4 item</Text>
            </Accordion.Content>
          </Accordion.Item>
        </Accordion>

        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
      </View>
    );
  }
}



const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    marginTop: 22,
  },
  accordion: {
    backgroundColor: '#eee',
  },
  accordionTitle: {
    backgroundColor: '#f3f3f3',
    borderBottomWidth: 1,
    borderBottomColor: '#ddd',
    height: 50,
  },
  accordionItem: {
    backgroundColor: '#fefefe',
    borderBottomWidth: 1,
    borderBottomColor: '#ddd',
  },
  accordionTitleText: {
    marginLeft: 24,
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
});

Props for Accordion Component

| Name | Type | Note | |---|---|---| |duration|integer|Miliseconds for collapsing animation duration time |style|object|A StyleSheet rule name just as used for default RN Components.

Props for <Accordion.Item /> Component

| Name | Type | Note | |---|---|---| |open|boolean|true/false whether the item is opened. Be sure to use it only once for each accordion. |style|object|A StyleSheet rule name just as used for default RN Components.

Props for <Accordion.Header /> and <Accordion.Content /> Components

| Name | Type | Note | |---|---|---| |style|object|A StyleSheet rule name just as used for default RN Components.

LICENSE Copyright (c) 2017, Metin Alim

GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. http://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. ... https://github.com/metinalim/react-native-accordion-met/blob/master/LICENSE