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

@dev-event/react-native-accordion

v2.0.4

Published

A performant interactive collapsed view with fully configurable options

Downloads

114

Readme

Thanks

Table of Contents

Installation

$ yarn add @dev-event/react-native-accordion

Features

  • Supported Reanimated 2;
  • Fully supported on React Native and Expo;
  • Simple API but fully customizable;
  • Arrow animation indicating whether the collapsible is expanded or not;
  • Property which unmount the collapsible when it is not expanded(very useful for performance! use wisely(Beta);

Usage

For more complete example open App.tsx

import React, { useState, useRef, useCallback } from "react";
import { StyleSheet, View, Text,  StatusBar} from "react-native";
import AnimatedAccordion from "@dev-event/react-native-accordion";


const App: React.FC = () => {
  const accordionRef = useRef<AnimatedAccordion>(null);

  const [show, setShow] = useState<boolean>(false);

  const handleContentTouchable = useCallback(() => {
    return <Text style={styles.title}>Sample header</Text>
  }, [])

  const handleContent = useCallback(() => {
    return <Text style={styles.message}>Sample content</Text>
  }, [])

  const handleOpenAccordion = useCallback(() => {
    accordionRef.current?.openAccordion();
  }, []);

  return (
    <>
      <StatusBar barStyle="dark-content" />
      <View style={styles.content}>
          <TouchableOpacity style={styles.button} onPress={handleOpenAccordion}>
            <Text>Open Accordion</Text>
          </TouchableOpacity>
          <AnimatedAccordion
            ref={accordionRef}
            sizeIcon={16}
            styleChevron={styles.icon}
            renderContent={handleContent}
            onChangeState={(isShow) => setShow(isShow)}
            styleTouchable={styles.touchable}
            activeBackgroundIcon={theme.light_gray}
            inactiveBackgroundIcon={theme.light_gray}
            handleContentTouchable={handleContentTouchable}
          />
      </View>
    </>
  );
};


const styles = StyleSheet.create({
  content:{
    flex: 1,
    backgroundColor: "#FFFFFF"
  },
  touchable: {
    backgroundColor: '#181829',
    height: 50,
  },
  title: {
    fontSize: 14,
    color: '#FFFFFF',
    fontWeight: '500',
  },
  message: {
    fontSize: 16,
    color: '#FFFFFF',
    fontWeight: '500',
  },
  icon: {
    height: 24,
    width: 24,
  },
  button: {
    padding: 16,
  },
});

Props

| name | description | required | type | default | | ---------------------------- | ------------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------- | ------- | | ref | Ref to get access to the Accordion View | NO | ref | | | isArrow | If set to false the arrow indicating whether the collapsible-view is expanded or not will not be displayed. | NO | boolean | true | | disabled | Enabled/disabled of clicks header(with arrow) | NO | boolean | false | | initExpand | If true then the collapsible will be expanded on mounting content(For example: with api) | NO | boolean | false | | colorIcon | Color tint icon arrow | NO | string | #16182B | | sizeIcon | Size icon arrow | NO | number | 16 | | otherProperty | Configuration TouchableWithoutFeedback | NO | ViewProps | | | isStatusFetching | Displays an indicator if the content is loaded from the API. | NO | boolean | false | | initialMountedContent | Start mounted content (Memory optimization) | YES | boolean | false | | isUnmountedContent | if true then the collapsible will unmount when closing animation ends. (Memory optimization) | NO | boolean | false | | activeBackgroundIcon | Expanded background color arrow | NO | string | #E5f6FF | | inactiveBackgroundIcon | InExpanded background color arrow | NO | string | #FFF0E4 | | contentHeight | Default height content (optimization) | NO | number | 0 | | handleIcon | Render custom icon | NO | JSX.Element | | | onAnimatedEndExpanded | Callback closed Accordion | NO | void | NO | | | | onAnimatedEndCollapsed | Callback opened Accordion | NO | void | | | handleCustomTouchable | Render custom header | NO | boolean | false | | handleContentTouchable | Render content header | NO | JSX.Element | | | handleIndicatorFetching | Render JSX.Element(Progress). Default - ActivityIndicator | NO | JSX.Element | | | renderContent | Render content | NO | JSX.Element | | | configExpanded | Configuration withTiming. | NO | Animated.WithTimingConfig | | | configCollapsed | Configuration withTiming. | NO | Animated.WithTimingConfig | | | styleChevron | Style Animated.View | NO | Animated.AnimateStyle | | | styleTouchable | Style Animated.View | NO | Animated.AnimateStyle | | | styleContainer | Style View | NO | ViewStyle | | | onChangeState | Callback onChange state Accordion(open/close) | NO | void | | | openAccordion | Available at ref link | NO | void | |

🎉 Example

Checkout the example here.

✌️ Contributing

Pull requests are always welcome! Feel free to open a new GitHub issue for any changes that can be made.

Author

Reach out to me at one of the following places!

  • E-mail [email protected]
  • Medium at https://medium.com/@effectwaaters
  • Instagram at https://www.instagram.com/dev_event/

License

License