├── .editorconfig
├── .expo
├── README.md
├── packager-info.json
└── settings.json
├── .gitattributes
├── .gitignore
├── .prettierrc.json
├── .yarnrc
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── babel.config.js
├── example
├── app.json
├── babel.config.js
├── index.js
├── metro.config.js
├── package.json
├── src
│ ├── App.tsx
│ ├── assets
│ │ ├── balls
│ │ │ ├── badminton
│ │ │ │ ├── badminton.png
│ │ │ │ ├── badminton@2x.png
│ │ │ │ └── badminton@3x.png
│ │ │ ├── baseball
│ │ │ │ ├── baseball.png
│ │ │ │ ├── baseball@2x.png
│ │ │ │ └── baseball@3x.png
│ │ │ ├── basketball
│ │ │ │ ├── basketball.png
│ │ │ │ ├── basketball@2x.png
│ │ │ │ └── basketball@3x.png
│ │ │ ├── football
│ │ │ │ ├── football.png
│ │ │ │ ├── football@2x.png
│ │ │ │ └── football@3x.png
│ │ │ ├── pingpong
│ │ │ │ ├── pingpong.png
│ │ │ │ ├── pingpong@2x.png
│ │ │ │ └── pingpong@3x.png
│ │ │ ├── soccer
│ │ │ │ ├── soccer.png
│ │ │ │ ├── soccer@2x.png
│ │ │ │ └── soccer@3x.png
│ │ │ ├── tennis
│ │ │ │ ├── tennis.png
│ │ │ │ ├── tennis@2x.png
│ │ │ │ └── tennis@3x.png
│ │ │ └── volly
│ │ │ │ ├── volly.png
│ │ │ │ ├── volly@2x.png
│ │ │ │ └── volly@3x.png
│ │ ├── banner
│ │ │ ├── 1.png
│ │ │ ├── 1@2x.png
│ │ │ └── 1@3x.png
│ │ ├── club
│ │ │ ├── CharltonAthletic
│ │ │ │ ├── CharltonAthletic.png
│ │ │ │ ├── CharltonAthletic@2x.png
│ │ │ │ └── CharltonAthletic@3x.png
│ │ │ ├── Middlesbrough
│ │ │ │ ├── Middlesbrough.png
│ │ │ │ ├── Middlesbrough@2x.png
│ │ │ │ └── Middlesbrough@3x.png
│ │ │ ├── arsenal
│ │ │ │ ├── arsenal.png
│ │ │ │ ├── arsenal@2x.png
│ │ │ │ └── arsenal@3x.png
│ │ │ ├── astonvilla
│ │ │ │ ├── astonvilla.png
│ │ │ │ ├── astonvilla@2x.png
│ │ │ │ └── astonvilla@3x.png
│ │ │ ├── chelsea
│ │ │ │ ├── chelsea.png
│ │ │ │ ├── chelsea@2x.png
│ │ │ │ └── chelsea@3x.png
│ │ │ ├── manchester
│ │ │ │ ├── manchester.png
│ │ │ │ ├── manchester@2x.png
│ │ │ │ └── manchester@3x.png
│ │ │ ├── real-betis
│ │ │ │ ├── Real-Betis.png
│ │ │ │ ├── Real-Betis@2x.png
│ │ │ │ └── Real-Betis@3x.png
│ │ │ ├── swanseaCity
│ │ │ │ ├── swanseaCity.png
│ │ │ │ ├── swanseaCity@2x.png
│ │ │ │ └── swanseaCity@3x.png
│ │ │ ├── tottenham
│ │ │ │ ├── tottenham.png
│ │ │ │ ├── tottenham@2x.png
│ │ │ │ └── tottenham@3x.png
│ │ │ └── valencia
│ │ │ │ ├── valencia.png
│ │ │ │ ├── valencia@2x.png
│ │ │ │ └── valencia@3x.png
│ │ ├── flags
│ │ │ ├── 1
│ │ │ │ ├── 1.png
│ │ │ │ ├── 1@2x.png
│ │ │ │ └── 1@3x.png
│ │ │ └── 2
│ │ │ │ ├── 2.png
│ │ │ │ ├── 2@2x.png
│ │ │ │ └── 2@3x.png
│ │ ├── index.ts
│ │ ├── notification
│ │ │ ├── notification.png
│ │ │ ├── notification@2x.png
│ │ │ └── notification@3x.png
│ │ ├── outlines
│ │ │ ├── chart
│ │ │ │ ├── Chart.png
│ │ │ │ ├── Chart@2x.png
│ │ │ │ └── Chart@3.png
│ │ │ ├── discovery
│ │ │ │ ├── Discovery.png
│ │ │ │ ├── Discovery@2x.png
│ │ │ │ └── Discovery@3x.png
│ │ │ ├── home
│ │ │ │ ├── Home.png
│ │ │ │ ├── Home@2x.png
│ │ │ │ └── Home@3x.png
│ │ │ └── profile
│ │ │ │ ├── Profile.png
│ │ │ │ ├── Profile@2x.png
│ │ │ │ └── Profile@3x.png
│ │ └── search
│ │ │ ├── search.png
│ │ │ ├── search@2x.png
│ │ │ └── search@3x.png
│ ├── components
│ │ ├── event
│ │ │ └── index.tsx
│ │ ├── index.ts
│ │ └── sport
│ │ │ └── index.tsx
│ ├── navigation
│ │ └── index.tsx
│ └── screens
│ │ ├── home
│ │ ├── constants.ts
│ │ ├── home.tsx
│ │ ├── index.ts
│ │ └── types.d.ts
│ │ └── index.ts
├── tsconfig.json
└── webpack.config.js
├── gif
└── giphy.gif
├── lib
├── commonjs
│ ├── accordion
│ │ ├── accordion.js
│ │ ├── accordion.js.map
│ │ ├── constant.js
│ │ ├── constant.js.map
│ │ ├── index.js
│ │ ├── index.js.map
│ │ ├── styles.js
│ │ ├── styles.js.map
│ │ ├── types.d.js
│ │ └── types.d.js.map
│ ├── chevron
│ │ ├── chevron.js
│ │ ├── chevron.js.map
│ │ ├── index.js
│ │ ├── index.js.map
│ │ ├── types.d.js
│ │ └── types.d.js.map
│ ├── hooks
│ │ ├── index.js
│ │ ├── index.js.map
│ │ ├── use-layout
│ │ │ ├── index.js
│ │ │ └── index.js.map
│ │ └── use-validator
│ │ │ ├── index.js
│ │ │ └── index.js.map
│ ├── index.js
│ └── index.js.map
├── module
│ ├── accordion
│ │ ├── accordion.js
│ │ ├── accordion.js.map
│ │ ├── constant.js
│ │ ├── constant.js.map
│ │ ├── index.js
│ │ ├── index.js.map
│ │ ├── styles.js
│ │ ├── styles.js.map
│ │ ├── types.d.js
│ │ └── types.d.js.map
│ ├── chevron
│ │ ├── chevron.js
│ │ ├── chevron.js.map
│ │ ├── index.js
│ │ ├── index.js.map
│ │ ├── types.d.js
│ │ └── types.d.js.map
│ ├── hooks
│ │ ├── index.js
│ │ ├── index.js.map
│ │ ├── use-layout
│ │ │ ├── index.js
│ │ │ └── index.js.map
│ │ └── use-validator
│ │ │ ├── index.js
│ │ │ └── index.js.map
│ ├── index.js
│ └── index.js.map
└── typescript
│ ├── accordion
│ ├── accordion.d.ts
│ ├── constant.d.ts
│ ├── index.d.ts
│ └── styles.d.ts
│ ├── chevron
│ ├── chevron.d.ts
│ └── index.d.ts
│ ├── hooks
│ ├── index.d.ts
│ ├── use-layout
│ │ └── index.d.ts
│ └── use-validator
│ │ └── index.d.ts
│ └── index.d.ts
├── package.json
├── scripts
└── bootstrap.js
├── src
├── accordion
│ ├── accordion.tsx
│ ├── constant.ts
│ ├── index.ts
│ ├── styles.ts
│ └── types.d.ts
├── chevron
│ ├── chevron.tsx
│ ├── index.ts
│ └── types.d.ts
├── hooks
│ ├── index.ts
│ ├── use-layout
│ │ └── index.ts
│ └── use-validator
│ │ └── index.ts
└── index.ts
├── tsconfig.build.json
└── tsconfig.json
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig helps developers define and maintain consistent
2 | # coding styles between different editors and IDEs
3 | # editorconfig.org
4 |
5 | root = true
6 |
7 | [*]
8 |
9 | indent_style = space
10 | indent_size = 2
11 |
12 | end_of_line = lf
13 | charset = utf-8
14 | trim_trailing_whitespace = true
15 | insert_final_newline = true
16 |
--------------------------------------------------------------------------------
/.expo/README.md:
--------------------------------------------------------------------------------
1 | > Why do I have a folder named ".expo" in my project?
2 |
3 | The ".expo" folder is created when an Expo project is started using "expo start" command.
4 |
5 | > What does the "packager-info.json" file contain?
6 |
7 | The "packager-info.json" file contains port numbers and process PIDs that are used to serve the application to the mobile device/simulator.
8 |
9 | > What does the "settings.json" file contain?
10 |
11 | The "settings.json" file contains the server configuration that is used to serve the application manifest.
12 |
13 | > Should I commit the ".expo" folder?
14 |
15 | No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine.
16 |
17 | Upon project creation, the ".expo" folder is already added to your ".gitignore" file.
18 |
--------------------------------------------------------------------------------
/.expo/packager-info.json:
--------------------------------------------------------------------------------
1 | {
2 | "devToolsPort": 19002,
3 | "expoServerPort": 19000,
4 | "packagerPort": 19000
5 | }
6 |
--------------------------------------------------------------------------------
/.expo/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "hostType": "lan",
3 | "lanType": "ip",
4 | "dev": true,
5 | "minify": false,
6 | "urlRandomness": null,
7 | "https": false,
8 | "scheme": null
9 | }
10 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.pbxproj -text
2 | # specific for windows script files
3 | *.bat text eol=crlf
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | yarn.lock
3 | .idea
4 |
5 | example/node_modules
6 | example/.expo
7 | example/yarn.lock
8 | example/.idea
9 |
--------------------------------------------------------------------------------
/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "printWidth": 90,
3 | "arrowParens": "avoid",
4 | "singleQuote": true,
5 | "tabWidth": 2,
6 | "trailingComma": "es5",
7 | "useTabs": false
8 | }
9 |
--------------------------------------------------------------------------------
/.yarnrc:
--------------------------------------------------------------------------------
1 | # Override Yarn command so we can automatically setup the repo on running `yarn`
2 |
3 | yarn-path "scripts/bootstrap.js"
4 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project.
4 |
5 | ## Development workflow
6 |
7 | To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
8 |
9 | ```sh
10 | yarn
11 | ```
12 |
13 | > While it's possible to use [`npm`](https://github.com/npm/cli), the tooling is built around [`yarn`](https://classic.yarnpkg.com/), so you'll have an easier time if you use `yarn` for development.
14 |
15 | While developing, you can run the [example app](/example/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app.
16 |
17 | To start the packager:
18 |
19 | ```sh
20 | yarn example start
21 | ```
22 |
23 | To run the example app on Android:
24 |
25 | ```sh
26 | yarn example android
27 | ```
28 |
29 | To run the example app on iOS:
30 |
31 | ```sh
32 | yarn example ios
33 | ```
34 |
35 | To run the example app on Web:
36 |
37 | ```sh
38 | yarn example web
39 | ```
40 |
41 | Make sure your code passes TypeScript and ESLint. Run the following to verify:
42 |
43 | ```sh
44 | yarn typescript
45 | yarn lint
46 | ```
47 |
48 | To fix formatting errors, run the following:
49 |
50 | ```sh
51 | yarn lint --fix
52 | ```
53 |
54 | Remember to add tests for your change if possible. Run the unit tests by:
55 |
56 | ```sh
57 | yarn test
58 | ```
59 |
60 | ### Commit message convention
61 |
62 | We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
63 |
64 | - `fix`: bug fixes, e.g. fix crash due to deprecated method.
65 | - `feat`: new features, e.g. add new method to the module.
66 | - `refactor`: code refactor, e.g. migrate from class components to hooks.
67 | - `docs`: changes into documentation, e.g. add usage example for the module..
68 | - `test`: adding or updating tests, e.g. add integration tests using detox.
69 | - `chore`: tooling changes, e.g. change CI config.
70 |
71 | Our pre-commit hooks verify that your commit message matches this format when committing.
72 |
73 | ### Linting and tests
74 |
75 | [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)
76 |
77 | We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.
78 |
79 | Our pre-commit hooks verify that the linter and tests pass when committing.
80 |
81 | ### Publishing to npm
82 |
83 | We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.
84 |
85 | To publish new versions, run the following:
86 |
87 | ```sh
88 | yarn release
89 | ```
90 |
91 | ### Scripts
92 |
93 | The `package.json` file contains various scripts for common tasks:
94 |
95 | - `yarn bootstrap`: setup project by installing all dependencies and pods.
96 | - `yarn typescript`: type-check files with TypeScript.
97 | - `yarn lint`: lint files with ESLint.
98 | - `yarn test`: run unit tests with Jest.
99 | - `yarn example start`: start the Metro server for the example app.
100 | - `yarn example android`: run the example app on Android.
101 | - `yarn example ios`: run the example app on iOS.
102 |
103 | ### Sending a pull request
104 |
105 | > **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
106 |
107 | When you're sending a pull request:
108 |
109 | - Prefer small pull requests focused on one change.
110 | - Verify that linters and tests are passing.
111 | - Review the documentation to make sure it looks good.
112 | - Follow the pull request template when opening a pull request.
113 | - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
114 |
115 | ## Code of Conduct
116 |
117 | ### Our Pledge
118 |
119 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
120 |
121 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
122 |
123 | ### Our Standards
124 |
125 | Examples of behavior that contributes to a positive environment for our community include:
126 |
127 | - Demonstrating empathy and kindness toward other people
128 | - Being respectful of differing opinions, viewpoints, and experiences
129 | - Giving and gracefully accepting constructive feedback
130 | - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
131 | - Focusing on what is best not just for us as individuals, but for the overall community
132 |
133 | Examples of unacceptable behavior include:
134 |
135 | - The use of sexualized language or imagery, and sexual attention or
136 | advances of any kind
137 | - Trolling, insulting or derogatory comments, and personal or political attacks
138 | - Public or private harassment
139 | - Publishing others' private information, such as a physical or email
140 | address, without their explicit permission
141 | - Other conduct which could reasonably be considered inappropriate in a
142 | professional setting
143 |
144 | ### Enforcement Responsibilities
145 |
146 | Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
147 |
148 | Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
149 |
150 | ### Scope
151 |
152 | This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
153 |
154 | ### Enforcement
155 |
156 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.
157 |
158 | All community leaders are obligated to respect the privacy and security of the reporter of any incident.
159 |
160 | ### Enforcement Guidelines
161 |
162 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
163 |
164 | #### 1. Correction
165 |
166 | **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
167 |
168 | **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
169 |
170 | #### 2. Warning
171 |
172 | **Community Impact**: A violation through a single incident or series of actions.
173 |
174 | **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
175 |
176 | #### 3. Temporary Ban
177 |
178 | **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
179 |
180 | **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
181 |
182 | #### 4. Permanent Ban
183 |
184 | **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
185 |
186 | **Consequence**: A permanent ban from any sort of public interaction within the community.
187 |
188 | ### Attribution
189 |
190 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
191 | available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
192 |
193 | Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
194 |
195 | [homepage]: https://www.contributor-covenant.org
196 |
197 | For answers to common questions about this code of conduct, see the FAQ at
198 | https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
199 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Aliaksei Petrusevich
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | React Native Accordion (Support Reanimated > 2.0 )
8 | Current Version Reanimated 2.4.1
9 | Made with ❤️ by developer for developers
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | ## Thanks
22 | Please, click on ⭐ button.
23 |
24 |
25 | ## Table of Contents
26 |
27 | - [Installation](#installation)
28 | - [Features](#features)
29 | - [Usage](#usage)
30 | - [Props](#props)
31 | - [Example](#example)
32 | - [Contributing](#contributing)
33 | - [Support](#support)
34 | - [License](#license)
35 |
36 |
37 | ## Installation
38 |
39 | React Native (0.60+):
40 |
41 | ```bash
42 | $ yarn add @dev-event/react-native-accordion
43 | ```
44 |
45 |
46 |
47 |
48 | ## Features
49 |
50 | - Supported Reanimated 2;
51 | - Fully supported on React Native and Expo;
52 | - Simple API but fully customizable;
53 | - Arrow animation indicating whether the collapsible is expanded or not;
54 | - Property which unmount the collapsible when it is not expanded(very useful for performance! use wisely(Beta);
55 |
56 | ## Usage
57 |
58 | For more complete example open [App.tsx](https://github.com/dev-event/react-native-accordion/blob/main/example/src/App.tsx)
59 |
60 | ```tsx
61 | import React, { useState, useRef, useCallback } from "react";
62 | import { StyleSheet, View, Text, StatusBar} from "react-native";
63 | import AnimatedAccordion from "@dev-event/react-native-accordion";
64 |
65 |
66 | const App: React.FC = () => {
67 | const accordionRef = useRef(null);
68 |
69 | const [show, setShow] = useState(false);
70 |
71 | const handleContentTouchable = useCallback(() => {
72 | return Sample header
73 | }, [])
74 |
75 | const handleContent = useCallback(() => {
76 | return Sample content
77 | }, [])
78 |
79 | const handleOpenAccordion = useCallback(() => {
80 | accordionRef.current?.openAccordion();
81 | }, []);
82 |
83 | return (
84 | <>
85 |
86 |
87 |
88 | Open Accordion
89 |
90 | setShow(isShow)}
96 | styleTouchable={styles.touchable}
97 | activeBackgroundIcon={theme.light_gray}
98 | inactiveBackgroundIcon={theme.light_gray}
99 | handleContentTouchable={handleContentTouchable}
100 | />
101 |
102 | >
103 | );
104 | };
105 |
106 |
107 | const styles = StyleSheet.create({
108 | content:{
109 | flex: 1,
110 | backgroundColor: "#FFFFFF"
111 | },
112 | touchable: {
113 | backgroundColor: '#181829',
114 | height: 50,
115 | },
116 | title: {
117 | fontSize: 14,
118 | color: '#FFFFFF',
119 | fontWeight: '500',
120 | },
121 | message: {
122 | fontSize: 16,
123 | color: '#FFFFFF',
124 | fontWeight: '500',
125 | },
126 | icon: {
127 | height: 24,
128 | width: 24,
129 | },
130 | button: {
131 | padding: 16,
132 | },
133 | });
134 |
135 | ```
136 |
137 | ## Props
138 |
139 | | name | description | required | type | default |
140 | | ---------------------------- | ------------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------- | ------- |
141 | | `ref` | Ref to get access to the Accordion View | NO | ref | |
142 | | `isArrow` | If set to false the arrow indicating whether the collapsible-view is expanded or not will not be displayed. | NO | boolean | true |
143 | | `disabled` | Enabled/disabled of clicks header(with arrow) | NO | boolean | false |
144 | | `initExpand` | If true then the collapsible will be expanded on mounting content(For example: with api) | NO | boolean | false |
145 | | `colorIcon` | Color tint icon arrow | NO | string | #16182B |
146 | | `sizeIcon` | Size icon arrow | NO | number | 16 |
147 | | `otherProperty` | Configuration [`TouchableWithoutFeedback`](https://reactnative.dev/docs/touchablewithoutfeedback) | NO | ViewProps | |
148 | | `isStatusFetching` | Displays an indicator if the content is loaded from the API. | NO | boolean | false |
149 | | `initialMountedContent` | Start mounted content (Memory optimization) | YES | boolean | false |
150 | | `isUnmountedContent` | if true then the collapsible will unmount when closing animation ends. (Memory optimization) | NO | boolean | false |
151 | | `activeBackgroundIcon` | Expanded background color arrow | NO | string | #E5f6FF |
152 | | `inactiveBackgroundIcon` | InExpanded background color arrow | NO | string | #FFF0E4 |
153 | | `contentHeight` | Default height content (optimization) | NO | number | 0 |
154 | | `handleIcon` | Render custom icon | NO | JSX.Element | |
155 | | `onAnimatedEndExpanded` | Callback closed Accordion | NO | void | NO | | |
156 | | `onAnimatedEndCollapsed` | Callback opened Accordion | NO | void | |
157 | | `handleCustomTouchable` | Render custom header | NO | boolean | false |
158 | | `handleContentTouchable` | Render content header | NO | JSX.Element | |
159 | | `handleIndicatorFetching` | Render JSX.Element(Progress). Default - ActivityIndicator | NO | JSX.Element | |
160 | | `renderContent` | Render content | NO | JSX.Element | |
161 | | `configExpanded` | Configuration [`withTiming`](https://docs.swmansion.com/react-native-reanimated/docs/api/withTiming). | NO | Animated.WithTimingConfig | |
162 | | `configCollapsed` | Configuration [`withTiming`](https://docs.swmansion.com/react-native-reanimated/docs/api/withTiming). | NO | Animated.WithTimingConfig | |
163 | | `styleChevron` | Style Animated.View | NO | Animated.AnimateStyle | |
164 | | `styleTouchable` | Style Animated.View | NO | Animated.AnimateStyle | |
165 | | `styleContainer` | Style View | NO | ViewStyle | |
166 | | `onChangeState` | Callback onChange state Accordion(open/close) | NO | void | |
167 | | `openAccordion` | Available at ref link | NO | void | |
168 |
169 | Built With ❤️
170 |
171 | - [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated)
172 | - [react-native-redash](https://github.com/wcandillon/react-native-redash)
173 | - [react-native-svg](https://github.com/react-native-community/react-native-svg)
174 | - [@react-native-community/bob](https://github.com/react-native-community/bob)
175 |
176 |
177 |
178 | ## 🎉 Example
179 |
180 | Checkout the example [here](https://github.com/dev-event/react-native-accordion/tree/main/example/src).
181 |
182 | ## ✌️ Contributing
183 |
184 | Pull requests are always welcome! Feel free to open a new GitHub issue for any changes that can be made.
185 |
186 | ## Author
187 |
188 | Reach out to me at one of the following places!
189 |
190 | - E-mail effectwaater@gmail.com
191 | - Medium at https://medium.com/@effectwaaters
192 | - Instagram at https://www.instagram.com/dev_event/
193 |
194 |
195 | ## License
196 |
197 | [](http://badges.mit-license.org)
198 |
199 | - **[MIT license](http://opensource.org/licenses/mit-license.php)**
200 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ['module:metro-react-native-babel-preset'],
3 | plugins: ['react-native-reanimated/plugin'],
4 | };
5 |
--------------------------------------------------------------------------------
/example/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-accordion-example",
3 | "displayName": "Accordion Example",
4 | "expo": {
5 | "name": "react-native-accordion-example",
6 | "slug": "react-native-accordion-example",
7 | "description": "Example app for react-native-accordion",
8 | "privacy": "public",
9 | "version": "1.0.0",
10 | "platforms": [
11 | "ios",
12 | "android",
13 | "web"
14 | ],
15 | "ios": {
16 | "supportsTablet": true
17 | },
18 | "assetBundlePatterns": [
19 | "**/*"
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/example/babel.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const pak = require('../package.json');
3 |
4 | module.exports = function (api) {
5 | api.cache(true);
6 |
7 | return {
8 | presets: ['babel-preset-expo'],
9 | plugins: [
10 | [
11 | 'module-resolver',
12 | {
13 | extensions: ['.tsx', '.ts', '.js', '.json'],
14 | alias: {
15 | // For development, we want to alias the library to the source
16 | [pak.name]: path.join(__dirname, '..', pak.source),
17 | },
18 | },
19 | ],
20 | 'react-native-reanimated/plugin',
21 | ],
22 | };
23 | };
24 |
--------------------------------------------------------------------------------
/example/index.js:
--------------------------------------------------------------------------------
1 | import { registerRootComponent } from 'expo';
2 |
3 | import App from './src/App';
4 |
5 | // registerRootComponent calls AppRegistry.registerComponent('main', () => App);
6 | // It also ensures that whether you load the app in the Expo client or in a native build,
7 | // the environment is set up appropriately
8 | registerRootComponent(App);
9 |
--------------------------------------------------------------------------------
/example/metro.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const blacklist = require('metro-config/src/defaults/blacklist');
3 | const escape = require('escape-string-regexp');
4 | const pak = require('../package.json');
5 |
6 | const root = path.resolve(__dirname, '..');
7 |
8 | const modules = Object.keys({
9 | ...pak.peerDependencies,
10 | });
11 |
12 | module.exports = {
13 | projectRoot: __dirname,
14 | watchFolders: [root],
15 |
16 | // We need to make sure that only one version is loaded for peerDependencies
17 | // So we blacklist them at the root, and alias them to the versions in example's node_modules
18 | resolver: {
19 | blacklistRE: blacklist(
20 | modules.map(
21 | (m) =>
22 | new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
23 | )
24 | ),
25 |
26 | extraNodeModules: modules.reduce((acc, name) => {
27 | acc[name] = path.join(__dirname, 'node_modules', name);
28 | return acc;
29 | }, {}),
30 | },
31 |
32 | transformer: {
33 | getTransformOptions: async () => ({
34 | transform: {
35 | experimentalImportSupport: false,
36 | inlineRequires: true,
37 | },
38 | }),
39 | },
40 | };
41 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-accordion-example",
3 | "description": "Example app for react-native-accordion",
4 | "version": "0.0.1",
5 | "private": true,
6 | "main": "index",
7 | "scripts": {
8 | "android": "expo start --android",
9 | "ios": "expo start --ios -c",
10 | "web": "expo start --web",
11 | "start": "expo start -c",
12 | "test": "jest"
13 | },
14 | "dependencies": {
15 | "@react-native-community/masked-view": "0.1.10",
16 | "@react-navigation/bottom-tabs": "5.11.11",
17 | "@react-navigation/native": "5.9.4",
18 | "@react-navigation/stack": "5.14.5",
19 | "expo": "40.0.0",
20 | "expo-splash-screen": "~0.8.1",
21 | "expo-status-bar": "~1.0.3",
22 | "react": "16.13.1",
23 | "react-dom": "16.13.1",
24 | "react-native": "0.63.4",
25 | "react-native-gesture-handler": "~1.8.0",
26 | "react-native-reanimated": "2.1.0",
27 | "react-native-redash": "16.0.11",
28 | "react-native-safe-area-context": "3.1.9",
29 | "react-native-screens": "~2.15.2",
30 | "react-native-svg": "12.1.1",
31 | "react-native-unimodules": "~0.12.0",
32 | "react-native-web": "~0.14.9"
33 | },
34 | "devDependencies": {
35 | "@babel/core": "~7.12.10",
36 | "@babel/runtime": "^7.9.6",
37 | "babel-plugin-module-resolver": "4.0.0",
38 | "babel-preset-expo": "8.3.0",
39 | "expo-cli": "4.0.13"
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/example/src/App.tsx:
--------------------------------------------------------------------------------
1 | import { StatusBar } from 'expo-status-bar';
2 | import React from 'react';
3 | import { SafeAreaProvider } from 'react-native-safe-area-context';
4 | import { BottomBarNavigator } from './navigation';
5 | import { NavigationContainer } from '@react-navigation/native';
6 |
7 | export default function App() {
8 | return (
9 |
10 |
11 |
12 |
13 |
14 |
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/example/src/assets/balls/badminton/badminton.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/badminton/badminton.png
--------------------------------------------------------------------------------
/example/src/assets/balls/badminton/badminton@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/badminton/badminton@2x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/badminton/badminton@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/badminton/badminton@3x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/baseball/baseball.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/baseball/baseball.png
--------------------------------------------------------------------------------
/example/src/assets/balls/baseball/baseball@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/baseball/baseball@2x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/baseball/baseball@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/baseball/baseball@3x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/basketball/basketball.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/basketball/basketball.png
--------------------------------------------------------------------------------
/example/src/assets/balls/basketball/basketball@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/basketball/basketball@2x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/basketball/basketball@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/basketball/basketball@3x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/football/football.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/football/football.png
--------------------------------------------------------------------------------
/example/src/assets/balls/football/football@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/football/football@2x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/football/football@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/football/football@3x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/pingpong/pingpong.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/pingpong/pingpong.png
--------------------------------------------------------------------------------
/example/src/assets/balls/pingpong/pingpong@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/pingpong/pingpong@2x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/pingpong/pingpong@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/pingpong/pingpong@3x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/soccer/soccer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/soccer/soccer.png
--------------------------------------------------------------------------------
/example/src/assets/balls/soccer/soccer@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/soccer/soccer@2x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/soccer/soccer@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/soccer/soccer@3x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/tennis/tennis.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/tennis/tennis.png
--------------------------------------------------------------------------------
/example/src/assets/balls/tennis/tennis@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/tennis/tennis@2x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/tennis/tennis@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/tennis/tennis@3x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/volly/volly.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/volly/volly.png
--------------------------------------------------------------------------------
/example/src/assets/balls/volly/volly@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/volly/volly@2x.png
--------------------------------------------------------------------------------
/example/src/assets/balls/volly/volly@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/balls/volly/volly@3x.png
--------------------------------------------------------------------------------
/example/src/assets/banner/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/banner/1.png
--------------------------------------------------------------------------------
/example/src/assets/banner/1@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/banner/1@2x.png
--------------------------------------------------------------------------------
/example/src/assets/banner/1@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/banner/1@3x.png
--------------------------------------------------------------------------------
/example/src/assets/club/CharltonAthletic/CharltonAthletic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/CharltonAthletic/CharltonAthletic.png
--------------------------------------------------------------------------------
/example/src/assets/club/CharltonAthletic/CharltonAthletic@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/CharltonAthletic/CharltonAthletic@2x.png
--------------------------------------------------------------------------------
/example/src/assets/club/CharltonAthletic/CharltonAthletic@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/CharltonAthletic/CharltonAthletic@3x.png
--------------------------------------------------------------------------------
/example/src/assets/club/Middlesbrough/Middlesbrough.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/Middlesbrough/Middlesbrough.png
--------------------------------------------------------------------------------
/example/src/assets/club/Middlesbrough/Middlesbrough@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/Middlesbrough/Middlesbrough@2x.png
--------------------------------------------------------------------------------
/example/src/assets/club/Middlesbrough/Middlesbrough@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/Middlesbrough/Middlesbrough@3x.png
--------------------------------------------------------------------------------
/example/src/assets/club/arsenal/arsenal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/arsenal/arsenal.png
--------------------------------------------------------------------------------
/example/src/assets/club/arsenal/arsenal@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/arsenal/arsenal@2x.png
--------------------------------------------------------------------------------
/example/src/assets/club/arsenal/arsenal@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/arsenal/arsenal@3x.png
--------------------------------------------------------------------------------
/example/src/assets/club/astonvilla/astonvilla.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/astonvilla/astonvilla.png
--------------------------------------------------------------------------------
/example/src/assets/club/astonvilla/astonvilla@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/astonvilla/astonvilla@2x.png
--------------------------------------------------------------------------------
/example/src/assets/club/astonvilla/astonvilla@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/astonvilla/astonvilla@3x.png
--------------------------------------------------------------------------------
/example/src/assets/club/chelsea/chelsea.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/chelsea/chelsea.png
--------------------------------------------------------------------------------
/example/src/assets/club/chelsea/chelsea@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/chelsea/chelsea@2x.png
--------------------------------------------------------------------------------
/example/src/assets/club/chelsea/chelsea@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/chelsea/chelsea@3x.png
--------------------------------------------------------------------------------
/example/src/assets/club/manchester/manchester.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/manchester/manchester.png
--------------------------------------------------------------------------------
/example/src/assets/club/manchester/manchester@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/manchester/manchester@2x.png
--------------------------------------------------------------------------------
/example/src/assets/club/manchester/manchester@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/manchester/manchester@3x.png
--------------------------------------------------------------------------------
/example/src/assets/club/real-betis/Real-Betis.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/real-betis/Real-Betis.png
--------------------------------------------------------------------------------
/example/src/assets/club/real-betis/Real-Betis@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/real-betis/Real-Betis@2x.png
--------------------------------------------------------------------------------
/example/src/assets/club/real-betis/Real-Betis@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/real-betis/Real-Betis@3x.png
--------------------------------------------------------------------------------
/example/src/assets/club/swanseaCity/swanseaCity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/swanseaCity/swanseaCity.png
--------------------------------------------------------------------------------
/example/src/assets/club/swanseaCity/swanseaCity@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/swanseaCity/swanseaCity@2x.png
--------------------------------------------------------------------------------
/example/src/assets/club/swanseaCity/swanseaCity@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/swanseaCity/swanseaCity@3x.png
--------------------------------------------------------------------------------
/example/src/assets/club/tottenham/tottenham.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/tottenham/tottenham.png
--------------------------------------------------------------------------------
/example/src/assets/club/tottenham/tottenham@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/tottenham/tottenham@2x.png
--------------------------------------------------------------------------------
/example/src/assets/club/tottenham/tottenham@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/tottenham/tottenham@3x.png
--------------------------------------------------------------------------------
/example/src/assets/club/valencia/valencia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/valencia/valencia.png
--------------------------------------------------------------------------------
/example/src/assets/club/valencia/valencia@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/valencia/valencia@2x.png
--------------------------------------------------------------------------------
/example/src/assets/club/valencia/valencia@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/club/valencia/valencia@3x.png
--------------------------------------------------------------------------------
/example/src/assets/flags/1/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/flags/1/1.png
--------------------------------------------------------------------------------
/example/src/assets/flags/1/1@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/flags/1/1@2x.png
--------------------------------------------------------------------------------
/example/src/assets/flags/1/1@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/flags/1/1@3x.png
--------------------------------------------------------------------------------
/example/src/assets/flags/2/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/flags/2/2.png
--------------------------------------------------------------------------------
/example/src/assets/flags/2/2@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/flags/2/2@2x.png
--------------------------------------------------------------------------------
/example/src/assets/flags/2/2@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/flags/2/2@3x.png
--------------------------------------------------------------------------------
/example/src/assets/index.ts:
--------------------------------------------------------------------------------
1 | export const assets = {
2 | search: require('./search/search.png'),
3 | notification: require('./notification/notification.png'),
4 | flag_1: require('./flags/1/1.png'),
5 | flag_2: require('./flags/2/2.png'),
6 | banner: require('./banner/1.png'),
7 | badminton: require('./balls/badminton/badminton.png'),
8 | baseball: require('./balls/baseball/baseball.png'),
9 | basketball: require('./balls/basketball/basketball.png'),
10 | soccer: require('./balls/soccer/soccer.png'),
11 | tennis: require('./balls/tennis/tennis.png'),
12 | volly: require('./balls/volly/volly.png'),
13 | pingpong: require('./balls/pingpong/pingpong.png'),
14 | football: require('./balls/football/football.png'),
15 | arsenal: require('./club/arsenal/arsenal.png'),
16 | astonvilla: require('./club/astonvilla/astonvilla.png'),
17 | chelsea: require('./club/chelsea/chelsea.png'),
18 | charlton_athletic: require('./club/CharltonAthletic/CharltonAthletic.png'),
19 | manchester: require('./club/manchester/manchester.png'),
20 | middlesbrough: require('./club/Middlesbrough/Middlesbrough.png'),
21 | swansea_city: require('./club/swanseaCity/swanseaCity.png'),
22 | tottenham: require('./club/tottenham/tottenham.png'),
23 | real_betis: require('./club/real-betis/Real-Betis.png'),
24 | valencia: require('./club/valencia/valencia.png'),
25 |
26 | home: require('./outlines/home/Home.png'),
27 | chart: require('./outlines/chart/Chart.png'),
28 | discovery: require('./outlines/discovery/Discovery.png'),
29 | profile: require('./outlines/profile/Profile.png'),
30 | };
31 |
--------------------------------------------------------------------------------
/example/src/assets/notification/notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/notification/notification.png
--------------------------------------------------------------------------------
/example/src/assets/notification/notification@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/notification/notification@2x.png
--------------------------------------------------------------------------------
/example/src/assets/notification/notification@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/notification/notification@3x.png
--------------------------------------------------------------------------------
/example/src/assets/outlines/chart/Chart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/outlines/chart/Chart.png
--------------------------------------------------------------------------------
/example/src/assets/outlines/chart/Chart@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/outlines/chart/Chart@2x.png
--------------------------------------------------------------------------------
/example/src/assets/outlines/chart/Chart@3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/outlines/chart/Chart@3.png
--------------------------------------------------------------------------------
/example/src/assets/outlines/discovery/Discovery.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/outlines/discovery/Discovery.png
--------------------------------------------------------------------------------
/example/src/assets/outlines/discovery/Discovery@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/outlines/discovery/Discovery@2x.png
--------------------------------------------------------------------------------
/example/src/assets/outlines/discovery/Discovery@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/outlines/discovery/Discovery@3x.png
--------------------------------------------------------------------------------
/example/src/assets/outlines/home/Home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/outlines/home/Home.png
--------------------------------------------------------------------------------
/example/src/assets/outlines/home/Home@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/outlines/home/Home@2x.png
--------------------------------------------------------------------------------
/example/src/assets/outlines/home/Home@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/outlines/home/Home@3x.png
--------------------------------------------------------------------------------
/example/src/assets/outlines/profile/Profile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/outlines/profile/Profile.png
--------------------------------------------------------------------------------
/example/src/assets/outlines/profile/Profile@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/outlines/profile/Profile@2x.png
--------------------------------------------------------------------------------
/example/src/assets/outlines/profile/Profile@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/outlines/profile/Profile@3x.png
--------------------------------------------------------------------------------
/example/src/assets/search/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/search/search.png
--------------------------------------------------------------------------------
/example/src/assets/search/search@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/search/search@2x.png
--------------------------------------------------------------------------------
/example/src/assets/search/search@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/example/src/assets/search/search@3x.png
--------------------------------------------------------------------------------
/example/src/components/event/index.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import {
3 | StyleSheet,
4 | Text,
5 | Image,
6 | Alert,
7 | Pressable,
8 | View,
9 | ImageProps,
10 | } from 'react-native';
11 | import { FC } from 'react';
12 | type IEvent = {
13 | type: string;
14 | iconOne: ImageProps;
15 | iconTwo: ImageProps;
16 | scoreOne: number;
17 | scoreTwo: number;
18 | commandOne: string;
19 | commandTwo: string;
20 | };
21 | const Event: FC = ({
22 | type,
23 | iconOne,
24 | iconTwo,
25 | scoreOne,
26 | scoreTwo,
27 | commandOne,
28 | commandTwo,
29 | }) => (
30 | Alert.alert('Click', commandOne)}
33 | >
34 |
35 |
36 |
41 |
42 |
43 |
48 |
49 |
50 |
51 |
52 | {commandOne}
53 | {scoreOne}
54 |
55 |
56 | {'vs'}
57 | {'-'}
58 |
59 |
60 | {commandTwo}
61 | {scoreTwo}
62 |
63 |
64 |
65 |
66 | {type}
67 |
68 |
69 | );
70 | export { Event };
71 |
72 | const styles = StyleSheet.create({
73 | sport: {
74 | flexDirection: 'row',
75 | paddingStart: 12,
76 | backgroundColor: '#2B2B3D',
77 | borderRadius: 8,
78 | },
79 | icons: {
80 | flex: 0.2,
81 | flexDirection: 'row',
82 | alignItems: 'center',
83 | height: 80,
84 | },
85 |
86 | teams: {
87 | flex: 0.7,
88 | flexDirection: 'row',
89 | paddingHorizontal: 6,
90 | justifyContent: 'space-between',
91 | },
92 | type: {
93 | flex: 0.1,
94 | alignItems: 'center',
95 | justifyContent: 'center',
96 | backgroundColor: '#222232',
97 | },
98 |
99 | team: {
100 | fontSize: 18,
101 | color: '#FFFFFF',
102 | },
103 | score: {
104 | fontSize: 18,
105 | color: '#FFFFFF',
106 | },
107 | typeItem: {
108 | fontSize: 18,
109 | color: '#FFFFFF',
110 | },
111 | sportIcon: {
112 | height: 30,
113 | width: 30,
114 | alignSelf: 'center',
115 | },
116 | shape: {
117 | height: 38,
118 | width: 38,
119 | backgroundColor: '#222232',
120 | borderRadius: 32 / 2,
121 | alignSelf: 'center',
122 | justifyContent: 'center',
123 | },
124 | symbol: {
125 | fontSize: 18,
126 | color: '#FFFFFF',
127 | textAlign: 'center',
128 | alignSelf: 'center',
129 | },
130 | contentTeam: {
131 | flex: 0.5,
132 | justifyContent: 'center',
133 | alignItems: 'center',
134 | },
135 | contentVs: {
136 | justifyContent: 'center',
137 | },
138 | });
139 |
--------------------------------------------------------------------------------
/example/src/components/index.ts:
--------------------------------------------------------------------------------
1 | export * from './sport';
2 | export * from './event';
3 |
--------------------------------------------------------------------------------
/example/src/components/sport/index.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import {
3 | StyleSheet,
4 | Text,
5 | Image,
6 | TouchableHighlight,
7 | Alert,
8 | ImageProps,
9 | } from 'react-native';
10 | import { FC } from 'react';
11 |
12 | type ISport = {
13 | title: string;
14 | image: ImageProps;
15 | };
16 | const Sport: FC = ({ title, image }) => (
17 | Alert.alert('Click', title)}
21 | >
22 | <>
23 |
24 | {title}
25 | >
26 |
27 | );
28 | export { Sport };
29 |
30 | const styles = StyleSheet.create({
31 | sport: {
32 | paddingVertical: 24,
33 | paddingHorizontal: 24,
34 | backgroundColor: '#222232',
35 | marginRight: 12,
36 | borderRadius: 8,
37 | },
38 | sportItem: {
39 | fontSize: 22,
40 | color: '#FFFFFF',
41 | marginTop: 12,
42 | },
43 |
44 | sportIcon: {
45 | height: 32,
46 | width: 32,
47 | alignSelf: 'center',
48 | },
49 | });
50 |
--------------------------------------------------------------------------------
/example/src/navigation/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
3 | import { assets } from '../assets';
4 | import { HomeScreen } from '../screens';
5 | import { Image } from 'react-native';
6 |
7 | export enum tabs {
8 | home = 'home',
9 | discovery = 'discovery',
10 | chart = 'chart',
11 | account = 'account',
12 | }
13 | export type BottomTabParamList = {
14 | [tabs.home]: undefined;
15 | [tabs.discovery]: undefined;
16 | [tabs.chart]: undefined;
17 | [tabs.account]: undefined;
18 | };
19 |
20 | const { Navigator, Screen } = createBottomTabNavigator();
21 |
22 | const BottomBarNavigator = (): React.ReactElement => (
23 |
38 | ,
44 | }}
45 | />
46 | (
52 |
53 | ),
54 | }}
55 | />
56 |
57 | (
63 |
68 | ),
69 | }}
70 | />
71 |
72 | (
78 |
79 | ),
80 | }}
81 | />
82 |
83 | );
84 |
85 | export { BottomBarNavigator };
86 |
--------------------------------------------------------------------------------
/example/src/screens/home/constants.ts:
--------------------------------------------------------------------------------
1 | import type { Array, Sports } from './types';
2 | import { assets } from '../../assets';
3 |
4 | export const sports: Sports[] = [
5 | { image: assets.pingpong, title: 'Ping-pong' },
6 | { image: assets.badminton, title: 'Badminton' },
7 | { image: assets.baseball, title: 'Baseball' },
8 | { image: assets.football, title: 'Football' },
9 | { image: assets.tennis, title: 'Tennis' },
10 | { image: assets.basketball, title: 'Basketball' },
11 | ];
12 |
13 | export const array: Array[] = [
14 | {
15 | image: assets.flag_1,
16 | title: 'La League',
17 | county: 'Spain',
18 | events: [
19 | {
20 | command: {
21 | one: 'Barcelona',
22 | two: 'Liverpoll',
23 | },
24 | icon: {
25 | one: assets.real_betis,
26 | two: assets.tottenham,
27 | },
28 | score: {
29 | one: 3,
30 | two: 4,
31 | },
32 | type: 'KL',
33 | },
34 | ],
35 | },
36 | {
37 | image: assets.flag_2,
38 | title: 'Basketball League',
39 | county: 'Belarus',
40 | events: [
41 | {
42 | command: {
43 | one: 'BATE',
44 | two: 'Liverpoll',
45 | },
46 | icon: {
47 | one: assets.real_betis,
48 | two: assets.tottenham,
49 | },
50 | score: {
51 | one: 3,
52 | two: 4,
53 | },
54 | type: 'HT',
55 | },
56 | ],
57 | },
58 | {
59 | image: assets.flag_1,
60 | title: 'Football League',
61 | county: 'Belarus',
62 | events: [
63 | {
64 | command: {
65 | one: 'Real Madrid',
66 | two: 'Moscow',
67 | },
68 | icon: {
69 | one: assets.real_betis,
70 | two: assets.tottenham,
71 | },
72 | score: {
73 | one: 3,
74 | two: 4,
75 | },
76 | type: 'HR',
77 | },
78 | ],
79 | },
80 | ];
81 |
--------------------------------------------------------------------------------
/example/src/screens/home/home.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {
3 | StyleSheet,
4 | View,
5 | Text,
6 | SafeAreaView,
7 | Image,
8 | ScrollView,
9 | } from 'react-native';
10 | import AnimatedAccordion from '../../../../src';
11 | import { FC, useCallback } from 'react';
12 | import { assets } from '../../assets';
13 | import { Sport, Event } from '../../components';
14 | import { sports, array } from './constants';
15 |
16 | const HomeScreen: FC = () => {
17 | const handleContent = useCallback(
18 | (data) =>
19 | data.map(({ command, icon, score, type }) => (
20 |
30 | )),
31 | []
32 | );
33 |
34 | const hasHeader = (
35 |
36 | LiveScore
37 |
38 |
43 |
48 |
49 |
50 | );
51 |
52 | const hasBanner = (
53 |
58 | );
59 |
60 | const hasSports = (
61 |
62 |
70 | {sports.map(({ image, title }) => (
71 |
72 | ))}
73 |
74 |
75 | );
76 |
77 | return (
78 |
79 |
83 | {hasHeader}
84 | {hasBanner}
85 | {hasSports}
86 | {array.map(({ image, events, county, title }) => (
87 | console.log('expanded')}
91 | onAnimatedEndCollapsed={() => console.log('collapsed')}
92 | handleContentTouchable={() => (
93 |
94 |
99 |
100 | {title}
101 | {county}
102 |
103 |
104 | )}
105 | renderContent={() => handleContent(events)}
106 | styleTouchable={styles.touchable}
107 | styleContainer={styles.content}
108 | />
109 | ))}
110 |
111 |
112 | );
113 | };
114 | export default HomeScreen;
115 |
116 | const styles = StyleSheet.create({
117 | container: {
118 | flex: 1,
119 | backgroundColor: '#181829',
120 | },
121 |
122 | league: {
123 | fontSize: 22,
124 | color: '#FFFFFF',
125 | },
126 | content: {
127 | paddingHorizontal: 18,
128 | },
129 | item: {
130 | flexDirection: 'row',
131 | alignItems: 'center',
132 | },
133 | sports: {
134 | flexDirection: 'row',
135 | alignItems: 'center',
136 | paddingStart: 18,
137 | },
138 | header: {
139 | paddingHorizontal: 18,
140 | alignItems: 'center',
141 | flexDirection: 'row',
142 | justifyContent: 'space-between',
143 | marginVertical: 24,
144 | },
145 | liveScore: {
146 | fontSize: 24,
147 | color: '#FFFFFF',
148 | },
149 | touchable: {
150 | backgroundColor: '#181829',
151 | },
152 | row: {
153 | flexDirection: 'row',
154 | justifyContent: 'flex-start',
155 | alignItems: 'center',
156 | },
157 | flag_1: {
158 | height: 28,
159 | width: 28,
160 | marginRight: 18,
161 | },
162 | notification: {
163 | height: 28,
164 | width: 28,
165 | },
166 | search: {
167 | height: 22,
168 | width: 22,
169 | marginRight: 18,
170 | },
171 | title: {
172 | marginStart: 12,
173 | fontSize: 20,
174 | color: '#0b0e25',
175 | },
176 | message: {
177 | fontSize: 14,
178 | color: '#AAAAAA',
179 | },
180 | banner: {
181 | alignSelf: 'center',
182 | height: 220,
183 | width: '90%',
184 | },
185 | sportsContent: {
186 | height: 200,
187 | },
188 | });
189 |
--------------------------------------------------------------------------------
/example/src/screens/home/index.ts:
--------------------------------------------------------------------------------
1 | export { default as HomeScreen } from './home';
2 |
3 | /**
4 | * export types
5 | */
6 | export type { Array } from './types';
7 |
--------------------------------------------------------------------------------
/example/src/screens/home/types.d.ts:
--------------------------------------------------------------------------------
1 | import { ImageProps } from 'react-native';
2 |
3 | export type Sports = {
4 | image: string;
5 | title: string;
6 | };
7 |
8 | type Events = {
9 | command: ICommand;
10 | icon: IIcon;
11 | score: IScore;
12 | type: string;
13 | };
14 |
15 | type IScore = {
16 | [key: string]: number;
17 | };
18 | type IIcon = {
19 | [key: string]: string;
20 | };
21 | type ICommand = {
22 | [key: string]: string;
23 | };
24 |
25 | export type Array = {
26 | image: ImageProps;
27 | title: string;
28 | county: string;
29 | events: Events[];
30 | };
31 |
--------------------------------------------------------------------------------
/example/src/screens/index.ts:
--------------------------------------------------------------------------------
1 | export * from './home';
2 |
--------------------------------------------------------------------------------
/example/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {},
3 | "extends": "expo/tsconfig.base"
4 | }
5 |
--------------------------------------------------------------------------------
/example/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const createExpoWebpackConfigAsync = require('@expo/webpack-config');
3 | const { resolver } = require('./metro.config');
4 |
5 | const root = path.resolve(__dirname, '..');
6 | const node_modules = path.join(__dirname, 'node_modules');
7 |
8 | module.exports = async function (env, argv) {
9 | const config = await createExpoWebpackConfigAsync(env, argv);
10 |
11 | config.module.rules.push({
12 | test: /\.(js|jsx|ts|tsx)$/,
13 | include: path.resolve(root, 'src'),
14 | use: 'babel-loader',
15 | });
16 |
17 | // We need to make sure that only one version is loaded for peerDependencies
18 | // So we alias them to the versions in example's node_modules
19 | Object.assign(config.resolve.alias, {
20 | ...resolver.extraNodeModules,
21 | 'react-native-web': path.join(node_modules, 'react-native-web'),
22 | });
23 |
24 | return config;
25 | };
26 |
--------------------------------------------------------------------------------
/gif/giphy.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-chief/react-native-accordion/c273e3dc58841109fe911484f57d6d56c7ada32d/gif/giphy.gif
--------------------------------------------------------------------------------
/lib/commonjs/accordion/accordion.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | Object.defineProperty(exports, "__esModule", {
4 | value: true
5 | });
6 | exports.default = void 0;
7 |
8 | var _react = _interopRequireWildcard(require("react"));
9 |
10 | var _reactNative = require("react-native");
11 |
12 | var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
13 |
14 | var _chevron = _interopRequireDefault(require("../chevron"));
15 |
16 | var _styles = require("./styles");
17 |
18 | var _hooks = require("../hooks");
19 |
20 | var _constant = require("./constant");
21 |
22 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23 |
24 | function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25 |
26 | function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27 |
28 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
29 |
30 | var _default = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
31 | (0, _hooks.useValidator)(props); //props configuration
32 |
33 | const {
34 | isArrow = _constant.DEFAULT_VISIBLE_CHEVRON,
35 | sizeIcon = _constant.DEFAULT_SIZE_TINT_CHEVRON,
36 | disabled = _constant.DEFAULT_DISABLED_HEAD_ACCORDION,
37 | colorIcon = _constant.DEFAULT_TINT_CHEVRON,
38 | initExpand = _constant.DEFAULT_EXPANDED_CONTENT_ACCORDION,
39 | handleIcon,
40 | styleChevron,
41 | contentHeight = _constant.DEFAULT_HEIGHT_CONTENT,
42 | renderContent,
43 | otherProperty,
44 | onChangeState,
45 | styleTouchable,
46 | configExpanded,
47 | styleContainer,
48 | configCollapsed,
49 | isStatusFetching = _constant.DEFAULT_PROGRESS_LOADING_API,
50 | isUnmountedContent = _constant.DEFAULT_UNMOUNTED_CONTENT_ACCORDION,
51 | activeBackgroundIcon = _constant.DEFAULT_ACTIVE_BACKGROUND_CHEVRON,
52 | initialMountedContent = _constant.DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION,
53 | handleCustomTouchable,
54 | onAnimatedEndExpanded,
55 | onAnimatedEndCollapsed,
56 | handleContentTouchable,
57 | inactiveBackgroundIcon = _constant.DEFAULT_INACTIVE_BACKGROUND_CHEVRON,
58 | handleIndicatorFetching
59 | } = props;
60 | const [layout, onLayout] = (0, _hooks.useLayout)(0);
61 | const open = (0, _reactNativeReanimated.useSharedValue)(initExpand);
62 | const [isUnmounted, setUnmountedContent] = (0, _react.useState)(isUnmountedContent);
63 | const [isMounted, setMounted] = (0, _react.useState)(initialMountedContent);
64 | const handleHeightContent = (0, _react.useMemo)(() => renderContent === null ? 0 : contentHeight || layout.height || _constant.DEFAULT_CONTENT_HEIGHT, [contentHeight, layout.height, renderContent]);
65 | const size = (0, _reactNativeReanimated.useSharedValue)(handleHeightContent);
66 | (0, _react.useImperativeHandle)(ref, () => ({
67 | openAccordion
68 | }));
69 | (0, _react.useEffect)(() => {
70 | (0, _reactNativeReanimated.runOnUI)(() => {
71 | 'worklet';
72 |
73 | if (initExpand && isMounted && handleHeightContent) {
74 | size.value = handleHeightContent;
75 | }
76 | })();
77 | }, [handleHeightContent, initExpand, isMounted, size]);
78 | (0, _react.useEffect)(() => {
79 | (0, _reactNativeReanimated.runOnUI)(() => {
80 | 'worklet';
81 |
82 | if (!isStatusFetching && handleHeightContent) {
83 | size.value = handleHeightContent;
84 | }
85 | })();
86 | }, [handleHeightContent, isStatusFetching, size]);
87 | const progress = (0, _reactNativeReanimated.useDerivedValue)(() => open.value ? (0, _reactNativeReanimated.withTiming)(1, configExpanded, created) : (0, _reactNativeReanimated.withTiming)(0, configCollapsed, unmount));
88 | const style = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
89 | height: size.value * progress.value + 1,
90 | opacity: progress.value === 0 ? 0 : 1
91 | }));
92 | const created = (0, _react.useCallback)(() => {
93 | if (onAnimatedEndExpanded !== undefined) {
94 | (0, _reactNativeReanimated.runOnJS)(onAnimatedEndExpanded)();
95 | }
96 | }, [onAnimatedEndExpanded]);
97 | const unmount = (0, _react.useCallback)(() => {
98 | if (onAnimatedEndCollapsed !== undefined) {
99 | (0, _reactNativeReanimated.runOnJS)(onAnimatedEndCollapsed)();
100 | }
101 |
102 | if (isUnmountedContent) {
103 | (0, _reactNativeReanimated.runOnJS)(setUnmountedContent)(true);
104 | return;
105 | }
106 | }, [isUnmountedContent, onAnimatedEndCollapsed]);
107 | const openAccordion = (0, _react.useCallback)(() => {
108 | if (size.value === 0) {
109 | if (!isMounted) setMounted(true);
110 | (0, _reactNativeReanimated.runOnUI)(setUnmountedContent)(false);
111 | (0, _reactNativeReanimated.runOnUI)(() => {
112 | 'worklet';
113 |
114 | size.value = handleHeightContent;
115 | })();
116 | }
117 |
118 | open.value = !open.value;
119 | onChangeState && onChangeState(!open.value);
120 | }, [handleHeightContent, isMounted, onChangeState, open, size]);
121 | const hasLoader = (0, _react.useMemo)(() => isStatusFetching ? handleIndicatorFetching ? handleIndicatorFetching() : /*#__PURE__*/_react.default.createElement(_reactNative.ActivityIndicator, {
122 | size: "small",
123 | color: "#AAAAAA",
124 | style: _styles.styles.indicator
125 | }) : /*#__PURE__*/_react.default.createElement(_chevron.default, {
126 | sizeIcon: sizeIcon,
127 | progress: progress,
128 | colorIcon: colorIcon,
129 | handleIcon: handleIcon,
130 | styleChevron: styleChevron,
131 | activeBackgroundIcon: activeBackgroundIcon,
132 | inactiveBackgroundIcon: inactiveBackgroundIcon
133 | }), [progress, sizeIcon, colorIcon, handleIcon, styleChevron, isStatusFetching, activeBackgroundIcon, inactiveBackgroundIcon, handleIndicatorFetching]);
134 | const renderHeader = (0, _react.useCallback)(() => {
135 | if (handleCustomTouchable === null) {
136 | return null;
137 | }
138 |
139 | return handleCustomTouchable !== undefined ? handleCustomTouchable() : /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
140 | style: [_styles.styles.header, styleTouchable]
141 | }, handleContentTouchable ? handleContentTouchable() : null, isArrow ? hasLoader : null);
142 | }, [isArrow, hasLoader, styleTouchable, handleCustomTouchable, handleContentTouchable]);
143 | const content = (0, _react.useCallback)(() => {
144 | if (isUnmounted && !open.value) {
145 | return null;
146 | }
147 |
148 | return isMounted && renderContent ? renderContent() : null;
149 | }, [isMounted, isUnmounted, open.value, renderContent]);
150 | const contentStyle = (0, _react.useMemo)(() => [_styles.styles.container, styleContainer], [styleContainer]);
151 | const containerAnimatedStyle = (0, _react.useMemo)(() => [_styles.styles.content, style], [style]);
152 | return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableWithoutFeedback, _extends({
153 | onPress: openAccordion,
154 | disabled: disabled || isStatusFetching
155 | }, otherProperty), renderHeader()), /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
156 | style: containerAnimatedStyle
157 | }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
158 | onLayout: onLayout,
159 | style: contentStyle
160 | }, content())));
161 | });
162 |
163 | exports.default = _default;
164 | //# sourceMappingURL=accordion.js.map
--------------------------------------------------------------------------------
/lib/commonjs/accordion/accordion.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["forwardRef","props","ref","useValidator","isArrow","DEFAULT_VISIBLE_CHEVRON","sizeIcon","DEFAULT_SIZE_TINT_CHEVRON","disabled","DEFAULT_DISABLED_HEAD_ACCORDION","colorIcon","DEFAULT_TINT_CHEVRON","initExpand","DEFAULT_EXPANDED_CONTENT_ACCORDION","handleIcon","styleChevron","contentHeight","DEFAULT_HEIGHT_CONTENT","renderContent","otherProperty","onChangeState","styleTouchable","configExpanded","styleContainer","configCollapsed","isStatusFetching","DEFAULT_PROGRESS_LOADING_API","isUnmountedContent","DEFAULT_UNMOUNTED_CONTENT_ACCORDION","activeBackgroundIcon","DEFAULT_ACTIVE_BACKGROUND_CHEVRON","initialMountedContent","DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION","handleCustomTouchable","onAnimatedEndExpanded","onAnimatedEndCollapsed","handleContentTouchable","inactiveBackgroundIcon","DEFAULT_INACTIVE_BACKGROUND_CHEVRON","handleIndicatorFetching","layout","onLayout","useLayout","open","useSharedValue","isUnmounted","setUnmountedContent","useState","isMounted","setMounted","handleHeightContent","useMemo","height","DEFAULT_CONTENT_HEIGHT","size","useImperativeHandle","openAccordion","useEffect","runOnUI","value","progress","useDerivedValue","withTiming","created","unmount","style","useAnimatedStyle","opacity","useCallback","undefined","runOnJS","hasLoader","styles","indicator","renderHeader","header","content","contentStyle","container","containerAnimatedStyle"],"sources":["accordion.tsx"],"sourcesContent":["import React, {\n useCallback,\n forwardRef,\n useMemo,\n useEffect,\n useState,\n useImperativeHandle,\n Ref,\n} from 'react';\nimport {\n ActivityIndicator,\n TouchableWithoutFeedback,\n View,\n ViewStyle,\n} from 'react-native';\nimport Animated, {\n useSharedValue,\n useAnimatedStyle,\n useDerivedValue,\n withTiming,\n runOnUI,\n runOnJS,\n} from 'react-native-reanimated';\nimport Chevron from '../chevron';\nimport type { IAccordionProps } from './types';\nimport { styles } from './styles';\nimport { useLayout, useValidator } from '../hooks';\nimport {\n DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION,\n DEFAULT_UNMOUNTED_CONTENT_ACCORDION,\n DEFAULT_INACTIVE_BACKGROUND_CHEVRON,\n DEFAULT_EXPANDED_CONTENT_ACCORDION,\n DEFAULT_ACTIVE_BACKGROUND_CHEVRON,\n DEFAULT_DISABLED_HEAD_ACCORDION,\n DEFAULT_PROGRESS_LOADING_API,\n DEFAULT_SIZE_TINT_CHEVRON,\n DEFAULT_VISIBLE_CHEVRON,\n DEFAULT_HEIGHT_CONTENT,\n DEFAULT_TINT_CHEVRON,\n DEFAULT_CONTENT_HEIGHT,\n} from './constant';\n\nexport default forwardRef((props: IAccordionProps, ref: Ref) => {\n useValidator(props);\n //props configuration\n const {\n isArrow = DEFAULT_VISIBLE_CHEVRON,\n sizeIcon = DEFAULT_SIZE_TINT_CHEVRON,\n disabled = DEFAULT_DISABLED_HEAD_ACCORDION,\n colorIcon = DEFAULT_TINT_CHEVRON,\n initExpand = DEFAULT_EXPANDED_CONTENT_ACCORDION,\n handleIcon,\n styleChevron,\n contentHeight = DEFAULT_HEIGHT_CONTENT,\n renderContent,\n otherProperty,\n onChangeState,\n styleTouchable,\n configExpanded,\n styleContainer,\n configCollapsed,\n isStatusFetching = DEFAULT_PROGRESS_LOADING_API,\n isUnmountedContent = DEFAULT_UNMOUNTED_CONTENT_ACCORDION,\n activeBackgroundIcon = DEFAULT_ACTIVE_BACKGROUND_CHEVRON,\n initialMountedContent = DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION,\n handleCustomTouchable,\n onAnimatedEndExpanded,\n onAnimatedEndCollapsed,\n handleContentTouchable,\n inactiveBackgroundIcon = DEFAULT_INACTIVE_BACKGROUND_CHEVRON,\n handleIndicatorFetching,\n } = props;\n\n const [layout, onLayout] = useLayout(0);\n const open = useSharedValue(initExpand);\n const [isUnmounted, setUnmountedContent] =\n useState(isUnmountedContent);\n const [isMounted, setMounted] = useState(initialMountedContent);\n\n const handleHeightContent = useMemo(\n () =>\n renderContent === null\n ? 0\n : contentHeight || layout.height || DEFAULT_CONTENT_HEIGHT,\n [contentHeight, layout.height, renderContent]\n );\n\n const size = useSharedValue(handleHeightContent);\n\n useImperativeHandle(ref, () => ({\n openAccordion,\n }));\n\n useEffect(() => {\n runOnUI(() => {\n 'worklet';\n if (initExpand && isMounted && handleHeightContent) {\n size.value = handleHeightContent;\n }\n })();\n }, [handleHeightContent, initExpand, isMounted, size]);\n\n useEffect(() => {\n runOnUI(() => {\n 'worklet';\n if (!isStatusFetching && handleHeightContent) {\n size.value = handleHeightContent;\n }\n })();\n }, [handleHeightContent, isStatusFetching, size]);\n\n const progress = useDerivedValue(() =>\n open.value\n ? withTiming(1, configExpanded, created)\n : withTiming(0, configCollapsed, unmount)\n );\n\n const style = useAnimatedStyle>(() => ({\n height: size.value * progress.value + 1,\n opacity: progress.value === 0 ? 0 : 1,\n }));\n\n const created = useCallback(() => {\n if (onAnimatedEndExpanded !== undefined) {\n runOnJS(onAnimatedEndExpanded)();\n }\n }, [onAnimatedEndExpanded]);\n\n const unmount = useCallback(() => {\n if (onAnimatedEndCollapsed !== undefined) {\n runOnJS(onAnimatedEndCollapsed)();\n }\n\n if (isUnmountedContent) {\n runOnJS(setUnmountedContent)(true);\n return;\n }\n }, [isUnmountedContent, onAnimatedEndCollapsed]);\n\n const openAccordion = useCallback(() => {\n if (size.value === 0) {\n if (!isMounted) setMounted(true);\n runOnUI(setUnmountedContent)(false);\n runOnUI(() => {\n 'worklet';\n size.value = handleHeightContent;\n })();\n }\n open.value = !open.value;\n onChangeState && onChangeState(!open.value);\n }, [handleHeightContent, isMounted, onChangeState, open, size]);\n\n const hasLoader = useMemo(\n () =>\n isStatusFetching ? (\n handleIndicatorFetching ? (\n handleIndicatorFetching()\n ) : (\n \n )\n ) : (\n \n ),\n [\n progress,\n sizeIcon,\n colorIcon,\n handleIcon,\n styleChevron,\n isStatusFetching,\n activeBackgroundIcon,\n inactiveBackgroundIcon,\n handleIndicatorFetching,\n ]\n );\n\n const renderHeader = useCallback(() => {\n if (handleCustomTouchable === null) {\n return null;\n }\n return handleCustomTouchable !== undefined ? (\n handleCustomTouchable()\n ) : (\n \n {handleContentTouchable ? handleContentTouchable() : null}\n {isArrow ? hasLoader : null}\n \n );\n }, [\n isArrow,\n hasLoader,\n styleTouchable,\n handleCustomTouchable,\n handleContentTouchable,\n ]);\n\n const content = useCallback(() => {\n if (isUnmounted && !open.value) {\n return null;\n }\n\n return isMounted && renderContent ? renderContent() : null;\n }, [isMounted, isUnmounted, open.value, renderContent]);\n\n const contentStyle = useMemo(\n () => [styles.container, styleContainer],\n [styleContainer]\n );\n const containerAnimatedStyle = useMemo<\n Animated.AnimatedStyleProp[]\n >(() => [styles.content, style], [style]);\n\n return (\n <>\n \n {renderHeader()}\n \n\n \n \n {content()}\n \n \n >\n );\n});\n"],"mappings":";;;;;;;AAAA;;AASA;;AAMA;;AAQA;;AAEA;;AACA;;AACA;;;;;;;;;;4B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,CAACA,KAAD,CAFF,CAA/B;EAIA,oBACE,yEACE,6BAAC,qCAAD;IACE,OAAO,EAAET,aADX;IAEE,QAAQ,EAAEhD,QAAQ,IAAIiB;EAFxB,GAGMN,aAHN,GAKGuD,YAAY,EALf,CADF,eASE,6BAAC,8BAAD,CAAU,IAAV;IAAe,KAAK,EAAEK;EAAtB,gBACE,6BAAC,iBAAD;IAAM,QAAQ,EAAEtC,QAAhB;IAA0B,KAAK,EAAEoC;EAAjC,GACGD,OAAO,EADV,CADF,CATF,CADF;AAiBD,CAvMc,C"}
--------------------------------------------------------------------------------
/lib/commonjs/accordion/constant.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | Object.defineProperty(exports, "__esModule", {
4 | value: true
5 | });
6 | exports.DEFAULT_VISIBLE_CHEVRON = exports.DEFAULT_UNMOUNTED_CONTENT_ACCORDION = exports.DEFAULT_TINT_CHEVRON = exports.DEFAULT_SIZE_TINT_CHEVRON = exports.DEFAULT_PROGRESS_LOADING_API = exports.DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION = exports.DEFAULT_INACTIVE_BACKGROUND_CHEVRON = exports.DEFAULT_HEIGHT_CONTENT = exports.DEFAULT_EXPANDED_CONTENT_ACCORDION = exports.DEFAULT_DISABLED_HEAD_ACCORDION = exports.DEFAULT_CONTENT_HEIGHT = exports.DEFAULT_ACTIVE_BACKGROUND_CHEVRON = void 0;
7 | const DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION = true;
8 | exports.DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION = DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION;
9 | const DEFAULT_UNMOUNTED_CONTENT_ACCORDION = false;
10 | exports.DEFAULT_UNMOUNTED_CONTENT_ACCORDION = DEFAULT_UNMOUNTED_CONTENT_ACCORDION;
11 | const DEFAULT_INACTIVE_BACKGROUND_CHEVRON = '#fff0e4';
12 | exports.DEFAULT_INACTIVE_BACKGROUND_CHEVRON = DEFAULT_INACTIVE_BACKGROUND_CHEVRON;
13 | const DEFAULT_EXPANDED_CONTENT_ACCORDION = false;
14 | exports.DEFAULT_EXPANDED_CONTENT_ACCORDION = DEFAULT_EXPANDED_CONTENT_ACCORDION;
15 | const DEFAULT_ACTIVE_BACKGROUND_CHEVRON = '#e5f6ff';
16 | exports.DEFAULT_ACTIVE_BACKGROUND_CHEVRON = DEFAULT_ACTIVE_BACKGROUND_CHEVRON;
17 | const DEFAULT_DISABLED_HEAD_ACCORDION = false;
18 | exports.DEFAULT_DISABLED_HEAD_ACCORDION = DEFAULT_DISABLED_HEAD_ACCORDION;
19 | const DEFAULT_PROGRESS_LOADING_API = false;
20 | exports.DEFAULT_PROGRESS_LOADING_API = DEFAULT_PROGRESS_LOADING_API;
21 | const DEFAULT_SIZE_TINT_CHEVRON = 16; // height x width
22 |
23 | exports.DEFAULT_SIZE_TINT_CHEVRON = DEFAULT_SIZE_TINT_CHEVRON;
24 | const DEFAULT_VISIBLE_CHEVRON = true;
25 | exports.DEFAULT_VISIBLE_CHEVRON = DEFAULT_VISIBLE_CHEVRON;
26 | const DEFAULT_CONTENT_HEIGHT = 100;
27 | exports.DEFAULT_CONTENT_HEIGHT = DEFAULT_CONTENT_HEIGHT;
28 | const DEFAULT_HEIGHT_CONTENT = 0; //optimize method
29 |
30 | exports.DEFAULT_HEIGHT_CONTENT = DEFAULT_HEIGHT_CONTENT;
31 | const DEFAULT_TINT_CHEVRON = '#16182b';
32 | exports.DEFAULT_TINT_CHEVRON = DEFAULT_TINT_CHEVRON;
33 | //# sourceMappingURL=constant.js.map
--------------------------------------------------------------------------------
/lib/commonjs/accordion/constant.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION","DEFAULT_UNMOUNTED_CONTENT_ACCORDION","DEFAULT_INACTIVE_BACKGROUND_CHEVRON","DEFAULT_EXPANDED_CONTENT_ACCORDION","DEFAULT_ACTIVE_BACKGROUND_CHEVRON","DEFAULT_DISABLED_HEAD_ACCORDION","DEFAULT_PROGRESS_LOADING_API","DEFAULT_SIZE_TINT_CHEVRON","DEFAULT_VISIBLE_CHEVRON","DEFAULT_CONTENT_HEIGHT","DEFAULT_HEIGHT_CONTENT","DEFAULT_TINT_CHEVRON"],"sources":["constant.ts"],"sourcesContent":["const DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION = true;\nconst DEFAULT_UNMOUNTED_CONTENT_ACCORDION = false;\nconst DEFAULT_INACTIVE_BACKGROUND_CHEVRON = '#fff0e4';\nconst DEFAULT_EXPANDED_CONTENT_ACCORDION = false;\nconst DEFAULT_ACTIVE_BACKGROUND_CHEVRON = '#e5f6ff';\nconst DEFAULT_DISABLED_HEAD_ACCORDION = false;\nconst DEFAULT_PROGRESS_LOADING_API = false;\nconst DEFAULT_SIZE_TINT_CHEVRON = 16; // height x width\nconst DEFAULT_VISIBLE_CHEVRON = true;\nconst DEFAULT_CONTENT_HEIGHT = 100;\nconst DEFAULT_HEIGHT_CONTENT = 0; //optimize method\nconst DEFAULT_TINT_CHEVRON = '#16182b';\n\nexport {\n DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION,\n DEFAULT_UNMOUNTED_CONTENT_ACCORDION,\n DEFAULT_INACTIVE_BACKGROUND_CHEVRON,\n DEFAULT_EXPANDED_CONTENT_ACCORDION,\n DEFAULT_ACTIVE_BACKGROUND_CHEVRON,\n DEFAULT_DISABLED_HEAD_ACCORDION,\n DEFAULT_PROGRESS_LOADING_API,\n DEFAULT_SIZE_TINT_CHEVRON,\n DEFAULT_VISIBLE_CHEVRON,\n DEFAULT_CONTENT_HEIGHT,\n DEFAULT_HEIGHT_CONTENT,\n DEFAULT_TINT_CHEVRON,\n};\n"],"mappings":";;;;;;AAAA,MAAMA,yCAAyC,GAAG,IAAlD;;AACA,MAAMC,mCAAmC,GAAG,KAA5C;;AACA,MAAMC,mCAAmC,GAAG,SAA5C;;AACA,MAAMC,kCAAkC,GAAG,KAA3C;;AACA,MAAMC,iCAAiC,GAAG,SAA1C;;AACA,MAAMC,+BAA+B,GAAG,KAAxC;;AACA,MAAMC,4BAA4B,GAAG,KAArC;;AACA,MAAMC,yBAAyB,GAAG,EAAlC,C,CAAsC;;;AACtC,MAAMC,uBAAuB,GAAG,IAAhC;;AACA,MAAMC,sBAAsB,GAAG,GAA/B;;AACA,MAAMC,sBAAsB,GAAG,CAA/B,C,CAAkC;;;AAClC,MAAMC,oBAAoB,GAAG,SAA7B"}
--------------------------------------------------------------------------------
/lib/commonjs/accordion/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | Object.defineProperty(exports, "__esModule", {
4 | value: true
5 | });
6 | Object.defineProperty(exports, "default", {
7 | enumerable: true,
8 | get: function () {
9 | return _accordion.default;
10 | }
11 | });
12 |
13 | var _accordion = _interopRequireDefault(require("./accordion"));
14 |
15 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/lib/commonjs/accordion/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './accordion';\nexport type { IAccordionProps } from './types';\n"],"mappings":";;;;;;;;;;;;AAAA"}
--------------------------------------------------------------------------------
/lib/commonjs/accordion/styles.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | Object.defineProperty(exports, "__esModule", {
4 | value: true
5 | });
6 | exports.styles = void 0;
7 |
8 | var _reactNative = require("react-native");
9 |
10 | const styles = _reactNative.StyleSheet.create({
11 | content: {
12 | overflow: 'hidden'
13 | },
14 | container: {
15 | position: 'absolute',
16 | top: 0,
17 | left: 0,
18 | right: 0
19 | },
20 | header: {
21 | backgroundColor: '#f5f5f7',
22 | flexDirection: 'row',
23 | alignItems: 'center',
24 | justifyContent: 'space-between',
25 | paddingVertical: 14,
26 | paddingHorizontal: 12,
27 | height: 80
28 | },
29 | title: {
30 | fontSize: 16,
31 | fontWeight: 'bold'
32 | },
33 | indicator: {
34 | marginLeft: 12
35 | }
36 | });
37 |
38 | exports.styles = styles;
39 | //# sourceMappingURL=styles.js.map
--------------------------------------------------------------------------------
/lib/commonjs/accordion/styles.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["styles","StyleSheet","create","content","overflow","container","position","top","left","right","header","backgroundColor","flexDirection","alignItems","justifyContent","paddingVertical","paddingHorizontal","height","title","fontSize","fontWeight","indicator","marginLeft"],"sources":["styles.ts"],"sourcesContent":["import { StyleSheet } from 'react-native';\n\nconst styles = StyleSheet.create({\n content: {\n overflow: 'hidden',\n },\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n },\n header: {\n backgroundColor: '#f5f5f7',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingVertical: 14,\n paddingHorizontal: 12,\n height: 80\n },\n title: {\n fontSize: 16,\n fontWeight: 'bold',\n },\n indicator:{\n marginLeft: 12\n }\n});\n\nexport { styles };\n"],"mappings":";;;;;;;AAAA;;AAEA,MAAMA,MAAM,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EAC/BC,OAAO,EAAE;IACPC,QAAQ,EAAE;EADH,CADsB;EAI/BC,SAAS,EAAE;IACTC,QAAQ,EAAE,UADD;IAETC,GAAG,EAAE,CAFI;IAGTC,IAAI,EAAE,CAHG;IAITC,KAAK,EAAE;EAJE,CAJoB;EAU/BC,MAAM,EAAE;IACNC,eAAe,EAAE,SADX;IAENC,aAAa,EAAE,KAFT;IAGNC,UAAU,EAAE,QAHN;IAINC,cAAc,EAAE,eAJV;IAKNC,eAAe,EAAE,EALX;IAMNC,iBAAiB,EAAE,EANb;IAONC,MAAM,EAAE;EAPF,CAVuB;EAmB/BC,KAAK,EAAE;IACLC,QAAQ,EAAE,EADL;IAELC,UAAU,EAAE;EAFP,CAnBwB;EAuB/BC,SAAS,EAAC;IACRC,UAAU,EAAG;EADL;AAvBqB,CAAlB,CAAf"}
--------------------------------------------------------------------------------
/lib/commonjs/accordion/types.d.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | Object.defineProperty(exports, "__esModule", {
4 | value: true
5 | });
6 | //# sourceMappingURL=types.d.js.map
--------------------------------------------------------------------------------
/lib/commonjs/accordion/types.d.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":[],"sources":["types.d.ts"],"sourcesContent":["import { FC } from 'react';\nimport { ViewStyle, ViewProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nexport interface IAccordionProps {\n /**\n * active/inactive TouchableWithoutFeedback\n */\n otherProperty?: ViewProps;\n\n /**\n * active/inactive TouchableWithoutFeedback\n */\n disabled?: boolean;\n\n /**\n * if active then the collapsible will be expanded on mounting.:\n */\n initExpand?: boolean;\n\n /**\n * Handle height helps to calculate the internal container and sheet layouts,\n * if `renderContent` is provided, the library internally will calculate its layout,\n * unless `contentHeight` is provided.\n */\n contentHeight: number;\n\n /**\n * unmounted content animated end\n */\n isUnmountedContent?: boolean;\n\n /**\n * initialMountedContent default start,\n */\n initialMountedContent: boolean;\n\n /**\n *\n */\n isStatusFetching: boolean;\n\n /**\n *\n */\n handleCustomTouchable?: () => FC | null;\n\n /**\n *\n */\n handleIndicatorFetching?: () => FC | null;\n\n /**\n *\n */\n renderContent?: () => JSX.Element | null;\n\n /**\n * callback change state hide/show content\n */\n onChangeState?: (value: boolean) => void;\n\n /**\n *\n */\n onAnimatedEndExpanded?: () => void;\n\n /**\n *\n */\n onAnimatedEndCollapsed?: () => void;\n\n /**\n *\n */\n handleContentTouchable?: () => JSX.Element | null;\n /**\n * component icon.\n */\n handleIcon?: () => FC | null;\n\n /**\n * active background arrow\n */\n\n activeBackgroundIcon?: string;\n\n /**\n * inactive background arrow\n */\n inactiveBackgroundIcon?: string;\n\n /**\n * color icon\n */\n colorIcon?: string;\n /**\n * size arrow icon\n */\n sizeIcon?: number;\n\n isArrow?: boolean;\n\n /**\n *\n */\n styleChevron?: ViewStyle;\n\n /**\n *\n */\n styleTouchable?: Animated.AnimateStyle;\n\n /**\n *\n */\n styleContainer?: ViewStyle;\n /**\n *\n */\n\n configExpanded?: Animated.WithTimingConfig;\n\n /**\n *\n */\n configCollapsed?: Animated.WithTimingConfig;\n}\n"],"mappings":""}
--------------------------------------------------------------------------------
/lib/commonjs/chevron/chevron.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | Object.defineProperty(exports, "__esModule", {
4 | value: true
5 | });
6 | exports.default = void 0;
7 |
8 | var _react = _interopRequireWildcard(require("react"));
9 |
10 | var _reactNative = require("react-native");
11 |
12 | var _reactNativeSvg = _interopRequireWildcard(require("react-native-svg"));
13 |
14 | var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
15 |
16 | var _reactNativeRedash = require("react-native-redash");
17 |
18 | function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19 |
20 | function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21 |
22 | const Chevron = _ref => {
23 | let {
24 | sizeIcon,
25 | progress,
26 | colorIcon,
27 | handleIcon,
28 | styleChevron,
29 | activeBackgroundIcon,
30 | inactiveBackgroundIcon
31 | } = _ref;
32 | const style = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
33 | // @ts-ignore
34 | backgroundColor: (0, _reactNativeRedash.mixColor)(progress.value, inactiveBackgroundIcon, activeBackgroundIcon),
35 | transform: [{
36 | rotateZ: `${(0, _reactNativeRedash.mix)(progress.value, 0, Math.PI)}rad`
37 | }]
38 | }));
39 | const hasIcon = (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_reactNativeSvg.default, {
40 | width: sizeIcon,
41 | height: sizeIcon,
42 | viewBox: "0 0 24 24",
43 | fill: "none",
44 | strokeWidth: 2,
45 | strokeLinecap: "round",
46 | strokeLinejoin: "round"
47 | }, /*#__PURE__*/_react.default.createElement(_reactNativeSvg.Path, {
48 | d: "M6 9l6 6 6-6",
49 | stroke: colorIcon
50 | })), [colorIcon, sizeIcon]);
51 | const renderIcon = (0, _react.useCallback)(() => {
52 | if (handleIcon === null) {
53 | return null;
54 | }
55 |
56 | return handleIcon !== undefined ? handleIcon(progress) : hasIcon;
57 | }, [handleIcon, hasIcon, progress]);
58 | const containerAnimatedStyle = (0, _react.useMemo)(() => [styles.container, style, styleChevron], [style, styleChevron]);
59 | return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
60 | style: containerAnimatedStyle
61 | }, renderIcon());
62 | };
63 |
64 | var _default = Chevron;
65 | exports.default = _default;
66 |
67 | const styles = _reactNative.StyleSheet.create({
68 | container: {
69 | height: 30,
70 | width: 30,
71 | borderRadius: 30 / 2,
72 | justifyContent: 'center',
73 | alignItems: 'center',
74 | backgroundColor: '#525251'
75 | }
76 | });
77 | //# sourceMappingURL=chevron.js.map
--------------------------------------------------------------------------------
/lib/commonjs/chevron/chevron.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["Chevron","sizeIcon","progress","colorIcon","handleIcon","styleChevron","activeBackgroundIcon","inactiveBackgroundIcon","style","useAnimatedStyle","backgroundColor","mixColor","value","transform","rotateZ","mix","Math","PI","hasIcon","useMemo","renderIcon","useCallback","undefined","containerAnimatedStyle","styles","container","StyleSheet","create","height","width","borderRadius","justifyContent","alignItems"],"sources":["chevron.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport { StyleSheet, ViewStyle } from 'react-native';\nimport Svg, { Path } from 'react-native-svg';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport { mix, mixColor } from 'react-native-redash';\nimport type { IChevronProps } from './types';\n\nconst Chevron = ({\n sizeIcon,\n progress,\n colorIcon,\n handleIcon,\n styleChevron,\n activeBackgroundIcon,\n inactiveBackgroundIcon,\n}: IChevronProps) => {\n const style = useAnimatedStyle>(() => ({\n // @ts-ignore\n backgroundColor: mixColor(\n progress.value,\n inactiveBackgroundIcon,\n activeBackgroundIcon\n ),\n transform: [{ rotateZ: `${mix(progress.value, 0, Math.PI)}rad` }],\n }));\n\n const hasIcon = useMemo(\n () => (\n \n \n \n ),\n [colorIcon, sizeIcon]\n );\n const renderIcon = useCallback(() => {\n if (handleIcon === null) {\n return null;\n }\n\n return handleIcon !== undefined ? handleIcon(progress) : hasIcon;\n }, [handleIcon, hasIcon, progress]);\n\n const containerAnimatedStyle = useMemo<\n Animated.AnimatedStyleProp[]\n >(() => [styles.container, style, styleChevron], [style, styleChevron]);\n\n return (\n {renderIcon()} \n );\n};\n\nexport default Chevron;\n\nconst styles = StyleSheet.create({\n container: {\n height: 30,\n width: 30,\n borderRadius: 30 / 2,\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: '#525251',\n },\n});\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAGA,MAAMA,OAAO,GAAG,QAQK;EAAA,IARJ;IACfC,QADe;IAEfC,QAFe;IAGfC,SAHe;IAIfC,UAJe;IAKfC,YALe;IAMfC,oBANe;IAOfC;EAPe,CAQI;EACnB,MAAMC,KAAK,GAAG,IAAAC,uCAAA,EAAwD,OAAO;IAC3E;IACAC,eAAe,EAAE,IAAAC,2BAAA,EACfT,QAA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G,MAAM,EAAE,EADC;IAETC,KAAK,EAAE,EAFE;IAGTC,YAAY,EAAE,KAAK,CAHV;IAITC,cAAc,EAAE,QAJP;IAKTC,UAAU,EAAE,QALH;IAMTtB,eAAe,EAAE;EANR;AADoB,CAAlB,CAAf"}
--------------------------------------------------------------------------------
/lib/commonjs/chevron/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | Object.defineProperty(exports, "__esModule", {
4 | value: true
5 | });
6 | Object.defineProperty(exports, "default", {
7 | enumerable: true,
8 | get: function () {
9 | return _chevron.default;
10 | }
11 | });
12 |
13 | var _chevron = _interopRequireDefault(require("./chevron"));
14 |
15 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/lib/commonjs/chevron/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './chevron';\nexport type { IChevronProps } from './types';\n"],"mappings":";;;;;;;;;;;;AAAA"}
--------------------------------------------------------------------------------
/lib/commonjs/chevron/types.d.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | Object.defineProperty(exports, "__esModule", {
4 | value: true
5 | });
6 | //# sourceMappingURL=types.d.js.map
--------------------------------------------------------------------------------
/lib/commonjs/chevron/types.d.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":[],"sources":["types.d.ts"],"sourcesContent":["import Animated from 'react-native-reanimated';\nimport { FC } from 'react';\nimport { ViewStyle } from 'react-native';\nexport interface IChevronProps {\n progress: Animated.SharedValue;\n sizeIcon?: number;\n /**\n * Component icon.\n */\n handleIcon?: (progress: Animated.SharedValue) => FC | null;\n\n /**\n * color active background arrow\n */\n activeBackgroundIcon: string;\n /**\n * color inactive background arrow\n */\n inactiveBackgroundIcon: string;\n\n styleChevron?: Animated.AnimateStyle;\n colorIcon?: string;\n}\n"],"mappings":""}
--------------------------------------------------------------------------------
/lib/commonjs/hooks/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | Object.defineProperty(exports, "__esModule", {
4 | value: true
5 | });
6 | Object.defineProperty(exports, "useLayout", {
7 | enumerable: true,
8 | get: function () {
9 | return _useLayout.default;
10 | }
11 | });
12 | Object.defineProperty(exports, "useValidator", {
13 | enumerable: true,
14 | get: function () {
15 | return _useValidator.default;
16 | }
17 | });
18 |
19 | var _useLayout = _interopRequireDefault(require("./use-layout"));
20 |
21 | var _useValidator = _interopRequireDefault(require("./use-validator"));
22 |
23 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/lib/commonjs/hooks/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default as useLayout } from './use-layout';\nexport { default as useValidator } from './use-validator';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA"}
--------------------------------------------------------------------------------
/lib/commonjs/hooks/use-layout/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | Object.defineProperty(exports, "__esModule", {
4 | value: true
5 | });
6 | exports.default = void 0;
7 |
8 | var _react = _interopRequireWildcard(require("react"));
9 |
10 | function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11 |
12 | function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13 |
14 | const useLayout = defaultHeight => {
15 | const [layout, setLayout] = (0, _react.useState)({
16 | height: defaultHeight || 0,
17 | width: 0,
18 | measured: false
19 | });
20 |
21 | const onLayout = _react.default.useCallback(e => {
22 | const {
23 | height,
24 | width
25 | } = e.nativeEvent.layout;
26 |
27 | if (height === layout.height && width === layout.width) {
28 | return;
29 | }
30 |
31 | setLayout({
32 | height,
33 | width,
34 | measured: true
35 | });
36 | }, [layout.height, layout.width]);
37 |
38 | return [layout, onLayout];
39 | };
40 |
41 | var _default = useLayout;
42 | exports.default = _default;
43 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/lib/commonjs/hooks/use-layout/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["useLayout","defaultHeight","layout","setLayout","useState","height","width","measured","onLayout","React","useCallback","e","nativeEvent"],"sources":["index.ts"],"sourcesContent":["import React, { useState } from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\n\nconst useLayout = (defaultHeight?: number) => {\n const [layout, setLayout] = useState<{\n height: number;\n width: number;\n measured: boolean;\n }>({ height: defaultHeight || 0, width: 0, measured: false });\n\n const onLayout = React.useCallback(\n (e: LayoutChangeEvent) => {\n const { height, width } = e.nativeEvent.layout;\n\n if (height === layout.height && width === layout.width) {\n return;\n }\n\n setLayout({\n height,\n width,\n measured: true,\n });\n },\n [layout.height, layout.width]\n );\n\n return [layout, onLayout] as const;\n};\n\nexport default useLayout;\n"],"mappings":";;;;;;;AAAA;;;;;;AAGA,MAAMA,SAAS,GAAIC,aAAD,IAA4B;EAC5C,MAAM,CAACC,MAAD,EAASC,SAAT,IAAsB,IAAAC,eAAA,EAIzB;IAAEC,MAAM,EAAEJ,aAAa,IAAI,CAA3B;IAA8BK,KAAK,EAAE,CAArC;IAAwCC,QAAQ,EAAE;EAAlD,CAJyB,CAA5B;;EAMA,MAAMC,QAAQ,GAAGC,cAAA,CAAMC,WAAN,CACdC,CAAD,IAA0B;IACxB,MAAM;MAAEN,MAAF;MAAUC;IAAV,IAAoBK,CAAC,CAACC,WAAF,CAAcV,MAAxC;;IAEA,IAAIG,MAAM,KAAKH,MAAM,CAACG,MAAlB,IAA4BC,KAAK,KAAKJ,MAAM,CAACI,KAAjD,EAAwD;MACtD;IACD;;IAEDH,SAAS,CAAC;MACRE,MADQ;MAERC,KAFQ;MAGRC,QAAQ,EAAE;IAHF,CAAD,CAAT;EAKD,CAbc,EAcf,CAACL,MAAM,CAACG,MAAR,EAAgBH,MAAM,CAACI,KAAvB,CAde,CAAjB;;EAiBA,OAAO,CAACJ,MAAD,EAASM,QAAT,CAAP;AACD,CAzBD;;eA2BeR,S"}
--------------------------------------------------------------------------------
/lib/commonjs/hooks/use-validator/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | Object.defineProperty(exports, "__esModule", {
4 | value: true
5 | });
6 | exports.default = void 0;
7 |
8 | var _react = require("react");
9 |
10 | var _invariant = _interopRequireDefault(require("invariant"));
11 |
12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 |
14 | const useValidator = _ref => {
15 | let {
16 | initialMountedContent
17 | } = _ref;
18 | (0, _react.useMemo)(() => {
19 | (0, _invariant.default)(typeof initialMountedContent === 'boolean', `'initialMountedContent' was provided but with wrong type ! expected type is a boolean.`); // eslint-disable-next-line react-hooks/exhaustive-deps
20 | }, []);
21 | };
22 |
23 | var _default = useValidator;
24 | exports.default = _default;
25 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/lib/commonjs/hooks/use-validator/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["useValidator","initialMountedContent","useMemo","invariant"],"sources":["index.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport invariant from 'invariant';\nimport type { IAccordionProps } from '../../accordion';\n\nconst useValidator = ({ initialMountedContent }: IAccordionProps) => {\n useMemo(() => {\n invariant(\n typeof initialMountedContent === 'boolean',\n `'initialMountedContent' was provided but with wrong type ! expected type is a boolean.`\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n};\n\nexport default useValidator;\n"],"mappings":";;;;;;;AAAA;;AACA;;;;AAGA,MAAMA,YAAY,GAAG,QAAgD;EAAA,IAA/C;IAAEC;EAAF,CAA+C;EACnE,IAAAC,cAAA,EAAQ,MAAM;IACZ,IAAAC,kBAAA,EACE,OAAOF,qBAAP,KAAiC,SADnC,EAEG,wFAFH,EADY,CAKZ;EACD,CAND,EAMG,EANH;AAOD,CARD;;eAUeD,Y"}
--------------------------------------------------------------------------------
/lib/commonjs/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | Object.defineProperty(exports, "__esModule", {
4 | value: true
5 | });
6 | Object.defineProperty(exports, "default", {
7 | enumerable: true,
8 | get: function () {
9 | return _accordion.default;
10 | }
11 | });
12 |
13 | var _accordion = _interopRequireDefault(require("./accordion"));
14 |
15 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/lib/commonjs/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './accordion';\n// default types\nexport type { IAccordionProps } from './accordion';\n"],"mappings":";;;;;;;;;;;;AAAA"}
--------------------------------------------------------------------------------
/lib/module/accordion/accordion.js:
--------------------------------------------------------------------------------
1 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2 |
3 | import React, { useCallback, forwardRef, useMemo, useEffect, useState, useImperativeHandle } from 'react';
4 | import { ActivityIndicator, TouchableWithoutFeedback, View } from 'react-native';
5 | import Animated, { useSharedValue, useAnimatedStyle, useDerivedValue, withTiming, runOnUI, runOnJS } from 'react-native-reanimated';
6 | import Chevron from '../chevron';
7 | import { styles } from './styles';
8 | import { useLayout, useValidator } from '../hooks';
9 | import { DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION, DEFAULT_UNMOUNTED_CONTENT_ACCORDION, DEFAULT_INACTIVE_BACKGROUND_CHEVRON, DEFAULT_EXPANDED_CONTENT_ACCORDION, DEFAULT_ACTIVE_BACKGROUND_CHEVRON, DEFAULT_DISABLED_HEAD_ACCORDION, DEFAULT_PROGRESS_LOADING_API, DEFAULT_SIZE_TINT_CHEVRON, DEFAULT_VISIBLE_CHEVRON, DEFAULT_HEIGHT_CONTENT, DEFAULT_TINT_CHEVRON, DEFAULT_CONTENT_HEIGHT } from './constant';
10 | export default /*#__PURE__*/forwardRef((props, ref) => {
11 | useValidator(props); //props configuration
12 |
13 | const {
14 | isArrow = DEFAULT_VISIBLE_CHEVRON,
15 | sizeIcon = DEFAULT_SIZE_TINT_CHEVRON,
16 | disabled = DEFAULT_DISABLED_HEAD_ACCORDION,
17 | colorIcon = DEFAULT_TINT_CHEVRON,
18 | initExpand = DEFAULT_EXPANDED_CONTENT_ACCORDION,
19 | handleIcon,
20 | styleChevron,
21 | contentHeight = DEFAULT_HEIGHT_CONTENT,
22 | renderContent,
23 | otherProperty,
24 | onChangeState,
25 | styleTouchable,
26 | configExpanded,
27 | styleContainer,
28 | configCollapsed,
29 | isStatusFetching = DEFAULT_PROGRESS_LOADING_API,
30 | isUnmountedContent = DEFAULT_UNMOUNTED_CONTENT_ACCORDION,
31 | activeBackgroundIcon = DEFAULT_ACTIVE_BACKGROUND_CHEVRON,
32 | initialMountedContent = DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION,
33 | handleCustomTouchable,
34 | onAnimatedEndExpanded,
35 | onAnimatedEndCollapsed,
36 | handleContentTouchable,
37 | inactiveBackgroundIcon = DEFAULT_INACTIVE_BACKGROUND_CHEVRON,
38 | handleIndicatorFetching
39 | } = props;
40 | const [layout, onLayout] = useLayout(0);
41 | const open = useSharedValue(initExpand);
42 | const [isUnmounted, setUnmountedContent] = useState(isUnmountedContent);
43 | const [isMounted, setMounted] = useState(initialMountedContent);
44 | const handleHeightContent = useMemo(() => renderContent === null ? 0 : contentHeight || layout.height || DEFAULT_CONTENT_HEIGHT, [contentHeight, layout.height, renderContent]);
45 | const size = useSharedValue(handleHeightContent);
46 | useImperativeHandle(ref, () => ({
47 | openAccordion
48 | }));
49 | useEffect(() => {
50 | runOnUI(() => {
51 | 'worklet';
52 |
53 | if (initExpand && isMounted && handleHeightContent) {
54 | size.value = handleHeightContent;
55 | }
56 | })();
57 | }, [handleHeightContent, initExpand, isMounted, size]);
58 | useEffect(() => {
59 | runOnUI(() => {
60 | 'worklet';
61 |
62 | if (!isStatusFetching && handleHeightContent) {
63 | size.value = handleHeightContent;
64 | }
65 | })();
66 | }, [handleHeightContent, isStatusFetching, size]);
67 | const progress = useDerivedValue(() => open.value ? withTiming(1, configExpanded, created) : withTiming(0, configCollapsed, unmount));
68 | const style = useAnimatedStyle(() => ({
69 | height: size.value * progress.value + 1,
70 | opacity: progress.value === 0 ? 0 : 1
71 | }));
72 | const created = useCallback(() => {
73 | if (onAnimatedEndExpanded !== undefined) {
74 | runOnJS(onAnimatedEndExpanded)();
75 | }
76 | }, [onAnimatedEndExpanded]);
77 | const unmount = useCallback(() => {
78 | if (onAnimatedEndCollapsed !== undefined) {
79 | runOnJS(onAnimatedEndCollapsed)();
80 | }
81 |
82 | if (isUnmountedContent) {
83 | runOnJS(setUnmountedContent)(true);
84 | return;
85 | }
86 | }, [isUnmountedContent, onAnimatedEndCollapsed]);
87 | const openAccordion = useCallback(() => {
88 | if (size.value === 0) {
89 | if (!isMounted) setMounted(true);
90 | runOnUI(setUnmountedContent)(false);
91 | runOnUI(() => {
92 | 'worklet';
93 |
94 | size.value = handleHeightContent;
95 | })();
96 | }
97 |
98 | open.value = !open.value;
99 | onChangeState && onChangeState(!open.value);
100 | }, [handleHeightContent, isMounted, onChangeState, open, size]);
101 | const hasLoader = useMemo(() => isStatusFetching ? handleIndicatorFetching ? handleIndicatorFetching() : /*#__PURE__*/React.createElement(ActivityIndicator, {
102 | size: "small",
103 | color: "#AAAAAA",
104 | style: styles.indicator
105 | }) : /*#__PURE__*/React.createElement(Chevron, {
106 | sizeIcon: sizeIcon,
107 | progress: progress,
108 | colorIcon: colorIcon,
109 | handleIcon: handleIcon,
110 | styleChevron: styleChevron,
111 | activeBackgroundIcon: activeBackgroundIcon,
112 | inactiveBackgroundIcon: inactiveBackgroundIcon
113 | }), [progress, sizeIcon, colorIcon, handleIcon, styleChevron, isStatusFetching, activeBackgroundIcon, inactiveBackgroundIcon, handleIndicatorFetching]);
114 | const renderHeader = useCallback(() => {
115 | if (handleCustomTouchable === null) {
116 | return null;
117 | }
118 |
119 | return handleCustomTouchable !== undefined ? handleCustomTouchable() : /*#__PURE__*/React.createElement(Animated.View, {
120 | style: [styles.header, styleTouchable]
121 | }, handleContentTouchable ? handleContentTouchable() : null, isArrow ? hasLoader : null);
122 | }, [isArrow, hasLoader, styleTouchable, handleCustomTouchable, handleContentTouchable]);
123 | const content = useCallback(() => {
124 | if (isUnmounted && !open.value) {
125 | return null;
126 | }
127 |
128 | return isMounted && renderContent ? renderContent() : null;
129 | }, [isMounted, isUnmounted, open.value, renderContent]);
130 | const contentStyle = useMemo(() => [styles.container, styleContainer], [styleContainer]);
131 | const containerAnimatedStyle = useMemo(() => [styles.content, style], [style]);
132 | return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TouchableWithoutFeedback, _extends({
133 | onPress: openAccordion,
134 | disabled: disabled || isStatusFetching
135 | }, otherProperty), renderHeader()), /*#__PURE__*/React.createElement(Animated.View, {
136 | style: containerAnimatedStyle
137 | }, /*#__PURE__*/React.createElement(View, {
138 | onLayout: onLayout,
139 | style: contentStyle
140 | }, content())));
141 | });
142 | //# sourceMappingURL=accordion.js.map
--------------------------------------------------------------------------------
/lib/module/accordion/accordion.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["React","useCallback","forwardRef","useMemo","useEffect","useState","useImperativeHandle","ActivityIndicator","TouchableWithoutFeedback","View","Animated","useSharedValue","useAnimatedStyle","useDerivedValue","withTiming","runOnUI","runOnJS","Chevron","styles","useLayout","useValidator","DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION","DEFAULT_UNMOUNTED_CONTENT_ACCORDION","DEFAULT_INACTIVE_BACKGROUND_CHEVRON","DEFAULT_EXPANDED_CONTENT_ACCORDION","DEFAULT_ACTIVE_BACKGROUND_CHEVRON","DEFAULT_DISABLED_HEAD_ACCORDION","DEFAULT_PROGRESS_LOADING_API","DEFAULT_SIZE_TINT_CHEVRON","DEFAULT_VISIBLE_CHEVRON","DEFAULT_HEIGHT_CONTENT","DEFAULT_TINT_CHEVRON","DEFAULT_CONTENT_HEIGHT","props","ref","isArrow","sizeIcon","disabled","colorIcon","initExpand","handleIcon","styleChevron","contentHeight","renderContent","otherProperty","onChangeState","styleTouchable","configExpanded","styleContainer","configCollapsed","isStatusFetching","isUnmountedContent","activeBackgroundIcon","initialMountedContent","handleCustomTouchable","onAnimatedEndExpanded","onAnimatedEndCollapsed","handleContentTouchable","inactiveBackgroundIcon","handleIndicatorFetching","layout","onLayout","open","isUnmounted","setUnmountedContent","isMounted","setMounted","handleHeightContent","height","size","openAccordion","value","progress","created","unmount","style","opacity","undefined","hasLoader","indicator","renderHeader","header","content","contentStyle","container","containerAnimatedStyle"],"sources":["accordion.tsx"],"sourcesContent":["import React, {\n useCallback,\n forwardRef,\n useMemo,\n useEffect,\n useState,\n useImperativeHandle,\n Ref,\n} from 'react';\nimport {\n ActivityIndicator,\n TouchableWithoutFeedback,\n View,\n ViewStyle,\n} from 'react-native';\nimport Animated, {\n useSharedValue,\n useAnimatedStyle,\n useDerivedValue,\n withTiming,\n runOnUI,\n runOnJS,\n} from 'react-native-reanimated';\nimport Chevron from '../chevron';\nimport type { IAccordionProps } from './types';\nimport { styles } from './styles';\nimport { useLayout, useValidator } from '../hooks';\nimport {\n DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION,\n DEFAULT_UNMOUNTED_CONTENT_ACCORDION,\n DEFAULT_INACTIVE_BACKGROUND_CHEVRON,\n DEFAULT_EXPANDED_CONTENT_ACCORDION,\n DEFAULT_ACTIVE_BACKGROUND_CHEVRON,\n DEFAULT_DISABLED_HEAD_ACCORDION,\n DEFAULT_PROGRESS_LOADING_API,\n DEFAULT_SIZE_TINT_CHEVRON,\n DEFAULT_VISIBLE_CHEVRON,\n DEFAULT_HEIGHT_CONTENT,\n DEFAULT_TINT_CHEVRON,\n DEFAULT_CONTENT_HEIGHT,\n} from './constant';\n\nexport default forwardRef((props: IAccordionProps, ref: Ref) => {\n useValidator(props);\n //props configuration\n const {\n isArrow = DEFAULT_VISIBLE_CHEVRON,\n sizeIcon = DEFAULT_SIZE_TINT_CHEVRON,\n disabled = DEFAULT_DISABLED_HEAD_ACCORDION,\n colorIcon = DEFAULT_TINT_CHEVRON,\n initExpand = DEFAULT_EXPANDED_CONTENT_ACCORDION,\n handleIcon,\n styleChevron,\n contentHeight = DEFAULT_HEIGHT_CONTENT,\n renderContent,\n otherProperty,\n onChangeState,\n styleTouchable,\n configExpanded,\n styleContainer,\n configCollapsed,\n isStatusFetching = DEFAULT_PROGRESS_LOADING_API,\n isUnmountedContent = DEFAULT_UNMOUNTED_CONTENT_ACCORDION,\n activeBackgroundIcon = DEFAULT_ACTIVE_BACKGROUND_CHEVRON,\n initialMountedContent = DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION,\n handleCustomTouchable,\n onAnimatedEndExpanded,\n onAnimatedEndCollapsed,\n handleContentTouchable,\n inactiveBackgroundIcon = DEFAULT_INACTIVE_BACKGROUND_CHEVRON,\n handleIndicatorFetching,\n } = props;\n\n const [layout, onLayout] = useLayout(0);\n const open = useSharedValue(initExpand);\n const [isUnmounted, setUnmountedContent] =\n useState(isUnmountedContent);\n const [isMounted, setMounted] = useState(initialMountedContent);\n\n const handleHeightContent = useMemo(\n () =>\n renderContent === null\n ? 0\n : contentHeight || layout.height || DEFAULT_CONTENT_HEIGHT,\n [contentHeight, layout.height, renderContent]\n );\n\n const size = useSharedValue(handleHeightContent);\n\n useImperativeHandle(ref, () => ({\n openAccordion,\n }));\n\n useEffect(() => {\n runOnUI(() => {\n 'worklet';\n if (initExpand && isMounted && handleHeightContent) {\n size.value = handleHeightContent;\n }\n })();\n }, [handleHeightContent, initExpand, isMounted, size]);\n\n useEffect(() => {\n runOnUI(() => {\n 'worklet';\n if (!isStatusFetching && handleHeightContent) {\n size.value = handleHeightContent;\n }\n })();\n }, [handleHeightContent, isStatusFetching, size]);\n\n const progress = useDerivedValue(() =>\n open.value\n ? withTiming(1, configExpanded, created)\n : withTiming(0, configCollapsed, unmount)\n );\n\n const style = useAnimatedStyle>(() => ({\n height: size.value * progress.value + 1,\n opacity: progress.value === 0 ? 0 : 1,\n }));\n\n const created = useCallback(() => {\n if (onAnimatedEndExpanded !== undefined) {\n runOnJS(onAnimatedEndExpanded)();\n }\n }, [onAnimatedEndExpanded]);\n\n const unmount = useCallback(() => {\n if (onAnimatedEndCollapsed !== undefined) {\n runOnJS(onAnimatedEndCollapsed)();\n }\n\n if (isUnmountedContent) {\n runOnJS(setUnmountedContent)(true);\n return;\n }\n }, [isUnmountedContent, onAnimatedEndCollapsed]);\n\n const openAccordion = useCallback(() => {\n if (size.value === 0) {\n if (!isMounted) setMounted(true);\n runOnUI(setUnmountedContent)(false);\n runOnUI(() => {\n 'worklet';\n size.value = handleHeightContent;\n })();\n }\n open.value = !open.value;\n onChangeState && onChangeState(!open.value);\n }, [handleHeightContent, isMounted, onChangeState, open, size]);\n\n const hasLoader = useMemo(\n () =>\n isStatusFetching ? (\n handleIndicatorFetching ? (\n handleIndicatorFetching()\n ) : (\n \n )\n ) : (\n \n ),\n [\n progress,\n sizeIcon,\n colorIcon,\n handleIcon,\n styleChevron,\n isStatusFetching,\n activeBackgroundIcon,\n inactiveBackgroundIcon,\n handleIndicatorFetching,\n ]\n );\n\n const renderHeader = useCallback(() => {\n if (handleCustomTouchable === null) {\n return null;\n }\n return handleCustomTouchable !== undefined ? (\n handleCustomTouchable()\n ) : (\n \n {handleContentTouchable ? handleContentTouchable() : null}\n {isArrow ? hasLoader : null}\n \n );\n }, [\n isArrow,\n hasLoader,\n styleTouchable,\n handleCustomTouchable,\n handleContentTouchable,\n ]);\n\n const content = useCallback(() => {\n if (isUnmounted && !open.value) {\n return null;\n }\n\n return isMounted && renderContent ? renderContent() : null;\n }, [isMounted, isUnmounted, open.value, renderContent]);\n\n const contentStyle = useMemo(\n () => [styles.container, styleContainer],\n [styleContainer]\n );\n const containerAnimatedStyle = useMemo<\n Animated.AnimatedStyleProp[]\n >(() => [styles.content, style], [style]);\n\n return (\n <>\n \n {renderHeader()}\n \n\n \n \n {content()}\n \n \n >\n );\n});\n"],"mappings":";;AAAA,OAAOA,KAAP,IACEC,WADF,EAEEC,UAFF,EAGEC,OAHF,EAIEC,SAJF,EAKEC,QALF,EAMEC,mBANF,QAQO,OARP;AASA,SACEC,iBADF,EAEEC,wBAFF,EAGEC,IAHF,QAKO,cALP;AAMA,OAAOC,QAAP,IACEC,cADF,EAEEC,gBAFF,EAGEC,eAHF,EAIEC,UAJF,EAKEC,OALF,EAMEC,OANF,QAOO,yBAPP;AAQA,OAAOC,OAAP,MAAoB,YAApB;AAEA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,SAAT,EAAoBC,YAApB,QAAwC,UAAxC;AACA,SACEC,yCADF,EAEEC,mCAFF,EAGEC,mCAHF,EAIEC,kCAJF,EAKEC,iCALF,EAMEC,+BANF,EAOEC,4BAPF,EAQEC,yBARF,EASEC,uBATF,EAUEC,sBAVF,EAWEC,oBAXF,EAYEC,sBAZF,QAaO,YAbP;AAeA,4BAAe9B,UAAU,CAAC,CAAC+B,KAAD,EA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MN,aAHN,GAKGoC,YAAY,EALf,CADF,eASE,oBAAC,QAAD,CAAU,IAAV;IAAe,KAAK,EAAEK;EAAtB,gBACE,oBAAC,IAAD;IAAM,QAAQ,EAAExB,QAAhB;IAA0B,KAAK,EAAEsB;EAAjC,GACGD,OAAO,EADV,CADF,CATF,CADF;AAiBD,CAvMwB,CAAzB"}
--------------------------------------------------------------------------------
/lib/module/accordion/constant.js:
--------------------------------------------------------------------------------
1 | const DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION = true;
2 | const DEFAULT_UNMOUNTED_CONTENT_ACCORDION = false;
3 | const DEFAULT_INACTIVE_BACKGROUND_CHEVRON = '#fff0e4';
4 | const DEFAULT_EXPANDED_CONTENT_ACCORDION = false;
5 | const DEFAULT_ACTIVE_BACKGROUND_CHEVRON = '#e5f6ff';
6 | const DEFAULT_DISABLED_HEAD_ACCORDION = false;
7 | const DEFAULT_PROGRESS_LOADING_API = false;
8 | const DEFAULT_SIZE_TINT_CHEVRON = 16; // height x width
9 |
10 | const DEFAULT_VISIBLE_CHEVRON = true;
11 | const DEFAULT_CONTENT_HEIGHT = 100;
12 | const DEFAULT_HEIGHT_CONTENT = 0; //optimize method
13 |
14 | const DEFAULT_TINT_CHEVRON = '#16182b';
15 | export { DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION, DEFAULT_UNMOUNTED_CONTENT_ACCORDION, DEFAULT_INACTIVE_BACKGROUND_CHEVRON, DEFAULT_EXPANDED_CONTENT_ACCORDION, DEFAULT_ACTIVE_BACKGROUND_CHEVRON, DEFAULT_DISABLED_HEAD_ACCORDION, DEFAULT_PROGRESS_LOADING_API, DEFAULT_SIZE_TINT_CHEVRON, DEFAULT_VISIBLE_CHEVRON, DEFAULT_CONTENT_HEIGHT, DEFAULT_HEIGHT_CONTENT, DEFAULT_TINT_CHEVRON };
16 | //# sourceMappingURL=constant.js.map
--------------------------------------------------------------------------------
/lib/module/accordion/constant.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION","DEFAULT_UNMOUNTED_CONTENT_ACCORDION","DEFAULT_INACTIVE_BACKGROUND_CHEVRON","DEFAULT_EXPANDED_CONTENT_ACCORDION","DEFAULT_ACTIVE_BACKGROUND_CHEVRON","DEFAULT_DISABLED_HEAD_ACCORDION","DEFAULT_PROGRESS_LOADING_API","DEFAULT_SIZE_TINT_CHEVRON","DEFAULT_VISIBLE_CHEVRON","DEFAULT_CONTENT_HEIGHT","DEFAULT_HEIGHT_CONTENT","DEFAULT_TINT_CHEVRON"],"sources":["constant.ts"],"sourcesContent":["const DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION = true;\nconst DEFAULT_UNMOUNTED_CONTENT_ACCORDION = false;\nconst DEFAULT_INACTIVE_BACKGROUND_CHEVRON = '#fff0e4';\nconst DEFAULT_EXPANDED_CONTENT_ACCORDION = false;\nconst DEFAULT_ACTIVE_BACKGROUND_CHEVRON = '#e5f6ff';\nconst DEFAULT_DISABLED_HEAD_ACCORDION = false;\nconst DEFAULT_PROGRESS_LOADING_API = false;\nconst DEFAULT_SIZE_TINT_CHEVRON = 16; // height x width\nconst DEFAULT_VISIBLE_CHEVRON = true;\nconst DEFAULT_CONTENT_HEIGHT = 100;\nconst DEFAULT_HEIGHT_CONTENT = 0; //optimize method\nconst DEFAULT_TINT_CHEVRON = '#16182b';\n\nexport {\n DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION,\n DEFAULT_UNMOUNTED_CONTENT_ACCORDION,\n DEFAULT_INACTIVE_BACKGROUND_CHEVRON,\n DEFAULT_EXPANDED_CONTENT_ACCORDION,\n DEFAULT_ACTIVE_BACKGROUND_CHEVRON,\n DEFAULT_DISABLED_HEAD_ACCORDION,\n DEFAULT_PROGRESS_LOADING_API,\n DEFAULT_SIZE_TINT_CHEVRON,\n DEFAULT_VISIBLE_CHEVRON,\n DEFAULT_CONTENT_HEIGHT,\n DEFAULT_HEIGHT_CONTENT,\n DEFAULT_TINT_CHEVRON,\n};\n"],"mappings":"AAAA,MAAMA,yCAAyC,GAAG,IAAlD;AACA,MAAMC,mCAAmC,GAAG,KAA5C;AACA,MAAMC,mCAAmC,GAAG,SAA5C;AACA,MAAMC,kCAAkC,GAAG,KAA3C;AACA,MAAMC,iCAAiC,GAAG,SAA1C;AACA,MAAMC,+BAA+B,GAAG,KAAxC;AACA,MAAMC,4BAA4B,GAAG,KAArC;AACA,MAAMC,yBAAyB,GAAG,EAAlC,C,CAAsC;;AACtC,MAAMC,uBAAuB,GAAG,IAAhC;AACA,MAAMC,sBAAsB,GAAG,GAA/B;AACA,MAAMC,sBAAsB,GAAG,CAA/B,C,CAAkC;;AAClC,MAAMC,oBAAoB,GAAG,SAA7B;AAEA,SACEX,yCADF,EAEEC,mCAFF,EAGEC,mCAHF,EAIEC,kCAJF,EAKEC,iCALF,EAMEC,+BANF,EAOEC,4BAPF,EAQEC,yBARF,EASEC,uBATF,EAUEC,sBAVF,EAWEC,sBAXF,EAYEC,oBAZF"}
--------------------------------------------------------------------------------
/lib/module/accordion/index.js:
--------------------------------------------------------------------------------
1 | export { default } from './accordion';
2 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/lib/module/accordion/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["default"],"sources":["index.ts"],"sourcesContent":["export { default } from './accordion';\nexport type { IAccordionProps } from './types';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,aAAxB"}
--------------------------------------------------------------------------------
/lib/module/accordion/styles.js:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 | const styles = StyleSheet.create({
3 | content: {
4 | overflow: 'hidden'
5 | },
6 | container: {
7 | position: 'absolute',
8 | top: 0,
9 | left: 0,
10 | right: 0
11 | },
12 | header: {
13 | backgroundColor: '#f5f5f7',
14 | flexDirection: 'row',
15 | alignItems: 'center',
16 | justifyContent: 'space-between',
17 | paddingVertical: 14,
18 | paddingHorizontal: 12,
19 | height: 80
20 | },
21 | title: {
22 | fontSize: 16,
23 | fontWeight: 'bold'
24 | },
25 | indicator: {
26 | marginLeft: 12
27 | }
28 | });
29 | export { styles };
30 | //# sourceMappingURL=styles.js.map
--------------------------------------------------------------------------------
/lib/module/accordion/styles.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["StyleSheet","styles","create","content","overflow","container","position","top","left","right","header","backgroundColor","flexDirection","alignItems","justifyContent","paddingVertical","paddingHorizontal","height","title","fontSize","fontWeight","indicator","marginLeft"],"sources":["styles.ts"],"sourcesContent":["import { StyleSheet } from 'react-native';\n\nconst styles = StyleSheet.create({\n content: {\n overflow: 'hidden',\n },\n container: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n },\n header: {\n backgroundColor: '#f5f5f7',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingVertical: 14,\n paddingHorizontal: 12,\n height: 80\n },\n title: {\n fontSize: 16,\n fontWeight: 'bold',\n },\n indicator:{\n marginLeft: 12\n }\n});\n\nexport { styles };\n"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AAEA,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAX,CAAkB;EAC/BC,OAAO,EAAE;IACPC,QAAQ,EAAE;EADH,CADsB;EAI/BC,SAAS,EAAE;IACTC,QAAQ,EAAE,UADD;IAETC,GAAG,EAAE,CAFI;IAGTC,IAAI,EAAE,CAHG;IAITC,KAAK,EAAE;EAJE,CAJoB;EAU/BC,MAAM,EAAE;IACNC,eAAe,EAAE,SADX;IAENC,aAAa,EAAE,KAFT;IAGNC,UAAU,EAAE,QAHN;IAINC,cAAc,EAAE,eAJV;IAKNC,eAAe,EAAE,EALX;IAMNC,iBAAiB,EAAE,EANb;IAONC,MAAM,EAAE;EAPF,CAVuB;EAmB/BC,KAAK,EAAE;IACLC,QAAQ,EAAE,EADL;IAELC,UAAU,EAAE;EAFP,CAnBwB;EAuB/BC,SAAS,EAAC;IACRC,UAAU,EAAG;EADL;AAvBqB,CAAlB,CAAf;AA4BA,SAASrB,MAAT"}
--------------------------------------------------------------------------------
/lib/module/accordion/types.d.js:
--------------------------------------------------------------------------------
1 | export {};
2 | //# sourceMappingURL=types.d.js.map
--------------------------------------------------------------------------------
/lib/module/accordion/types.d.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":[],"sources":["types.d.ts"],"sourcesContent":["import { FC } from 'react';\nimport { ViewStyle, ViewProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nexport interface IAccordionProps {\n /**\n * active/inactive TouchableWithoutFeedback\n */\n otherProperty?: ViewProps;\n\n /**\n * active/inactive TouchableWithoutFeedback\n */\n disabled?: boolean;\n\n /**\n * if active then the collapsible will be expanded on mounting.:\n */\n initExpand?: boolean;\n\n /**\n * Handle height helps to calculate the internal container and sheet layouts,\n * if `renderContent` is provided, the library internally will calculate its layout,\n * unless `contentHeight` is provided.\n */\n contentHeight: number;\n\n /**\n * unmounted content animated end\n */\n isUnmountedContent?: boolean;\n\n /**\n * initialMountedContent default start,\n */\n initialMountedContent: boolean;\n\n /**\n *\n */\n isStatusFetching: boolean;\n\n /**\n *\n */\n handleCustomTouchable?: () => FC | null;\n\n /**\n *\n */\n handleIndicatorFetching?: () => FC | null;\n\n /**\n *\n */\n renderContent?: () => JSX.Element | null;\n\n /**\n * callback change state hide/show content\n */\n onChangeState?: (value: boolean) => void;\n\n /**\n *\n */\n onAnimatedEndExpanded?: () => void;\n\n /**\n *\n */\n onAnimatedEndCollapsed?: () => void;\n\n /**\n *\n */\n handleContentTouchable?: () => JSX.Element | null;\n /**\n * component icon.\n */\n handleIcon?: () => FC | null;\n\n /**\n * active background arrow\n */\n\n activeBackgroundIcon?: string;\n\n /**\n * inactive background arrow\n */\n inactiveBackgroundIcon?: string;\n\n /**\n * color icon\n */\n colorIcon?: string;\n /**\n * size arrow icon\n */\n sizeIcon?: number;\n\n isArrow?: boolean;\n\n /**\n *\n */\n styleChevron?: ViewStyle;\n\n /**\n *\n */\n styleTouchable?: Animated.AnimateStyle;\n\n /**\n *\n */\n styleContainer?: ViewStyle;\n /**\n *\n */\n\n configExpanded?: Animated.WithTimingConfig;\n\n /**\n *\n */\n configCollapsed?: Animated.WithTimingConfig;\n}\n"],"mappings":""}
--------------------------------------------------------------------------------
/lib/module/chevron/chevron.js:
--------------------------------------------------------------------------------
1 | import React, { useCallback, useMemo } from 'react';
2 | import { StyleSheet } from 'react-native';
3 | import Svg, { Path } from 'react-native-svg';
4 | import Animated, { useAnimatedStyle } from 'react-native-reanimated';
5 | import { mix, mixColor } from 'react-native-redash';
6 |
7 | const Chevron = _ref => {
8 | let {
9 | sizeIcon,
10 | progress,
11 | colorIcon,
12 | handleIcon,
13 | styleChevron,
14 | activeBackgroundIcon,
15 | inactiveBackgroundIcon
16 | } = _ref;
17 | const style = useAnimatedStyle(() => ({
18 | // @ts-ignore
19 | backgroundColor: mixColor(progress.value, inactiveBackgroundIcon, activeBackgroundIcon),
20 | transform: [{
21 | rotateZ: `${mix(progress.value, 0, Math.PI)}rad`
22 | }]
23 | }));
24 | const hasIcon = useMemo(() => /*#__PURE__*/React.createElement(Svg, {
25 | width: sizeIcon,
26 | height: sizeIcon,
27 | viewBox: "0 0 24 24",
28 | fill: "none",
29 | strokeWidth: 2,
30 | strokeLinecap: "round",
31 | strokeLinejoin: "round"
32 | }, /*#__PURE__*/React.createElement(Path, {
33 | d: "M6 9l6 6 6-6",
34 | stroke: colorIcon
35 | })), [colorIcon, sizeIcon]);
36 | const renderIcon = useCallback(() => {
37 | if (handleIcon === null) {
38 | return null;
39 | }
40 |
41 | return handleIcon !== undefined ? handleIcon(progress) : hasIcon;
42 | }, [handleIcon, hasIcon, progress]);
43 | const containerAnimatedStyle = useMemo(() => [styles.container, style, styleChevron], [style, styleChevron]);
44 | return /*#__PURE__*/React.createElement(Animated.View, {
45 | style: containerAnimatedStyle
46 | }, renderIcon());
47 | };
48 |
49 | export default Chevron;
50 | const styles = StyleSheet.create({
51 | container: {
52 | height: 30,
53 | width: 30,
54 | borderRadius: 30 / 2,
55 | justifyContent: 'center',
56 | alignItems: 'center',
57 | backgroundColor: '#525251'
58 | }
59 | });
60 | //# sourceMappingURL=chevron.js.map
--------------------------------------------------------------------------------
/lib/module/chevron/chevron.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["React","useCallback","useMemo","StyleSheet","Svg","Path","Animated","useAnimatedStyle","mix","mixColor","Chevron","sizeIcon","progress","colorIcon","handleIcon","styleChevron","activeBackgroundIcon","inactiveBackgroundIcon","style","backgroundColor","value","transform","rotateZ","Math","PI","hasIcon","renderIcon","undefined","containerAnimatedStyle","styles","container","create","height","width","borderRadius","justifyContent","alignItems"],"sources":["chevron.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport { StyleSheet, ViewStyle } from 'react-native';\nimport Svg, { Path } from 'react-native-svg';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport { mix, mixColor } from 'react-native-redash';\nimport type { IChevronProps } from './types';\n\nconst Chevron = ({\n sizeIcon,\n progress,\n colorIcon,\n handleIcon,\n styleChevron,\n activeBackgroundIcon,\n inactiveBackgroundIcon,\n}: IChevronProps) => {\n const style = useAnimatedStyle>(() => ({\n // @ts-ignore\n backgroundColor: mixColor(\n progress.value,\n inactiveBackgroundIcon,\n activeBackgroundIcon\n ),\n transform: [{ rotateZ: `${mix(progress.value, 0, Math.PI)}rad` }],\n }));\n\n const hasIcon = useMemo(\n () => (\n \n \n \n ),\n [colorIcon, sizeIcon]\n );\n const renderIcon = useCallback(() => {\n if (handleIcon === null) {\n return null;\n }\n\n return handleIcon !== undefined ? handleIcon(progress) : hasIcon;\n }, [handleIcon, hasIcon, progress]);\n\n const containerAnimatedStyle = useMemo<\n Animated.AnimatedStyleProp[]\n >(() => [styles.container, style, styleChevron], [style, styleChevron]);\n\n return (\n {renderIcon()} \n );\n};\n\nexport default Chevron;\n\nconst styles = StyleSheet.create({\n container: {\n height: 30,\n width: 30,\n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OAAO,IAAP;IACD;;IAED,OAAOA,UAAU,KAAKa,SAAf,GAA2Bb,UAAU,CAACF,QAAD,CAArC,GAAkDa,OAAzD;EACD,CAN6B,EAM3B,CAACX,UAAD,EAAaW,OAAb,EAAsBb,QAAtB,CAN2B,CAA9B;EAQA,MAAMgB,sBAAsB,GAAG1B,OAAO,CAEpC,MAAM,CAAC2B,MAAM,CAACC,SAAR,EAAmBZ,KAAnB,EAA0BH,YAA1B,CAF8B,EAEW,CAACG,KAAD,EAAQH,YAAR,CAFX,CAAtC;EAIA,oBACE,oBAAC,QAAD,CAAU,IAAV;IAAe,KAAK,EAAEa;EAAtB,GAA+CF,UAAU,EAAzD,CADF;AAGD,CAlDD;;AAoDA,eAAehB,OAAf;AAEA,MAAMmB,MAAM,GAAG1B,UAAU,CAAC4B,MAAX,CAAkB;EAC/BD,SAAS,EAAE;IACTE,MAAM,EAAE,EADC;IAETC,KAAK,EAAE,EAFE;IAGTC,YAAY,EAAE,KAAK,CAHV;IAITC,cAAc,EAAE,QAJP;IAKTC,UAAU,EAAE,QALH;IAMTjB,eAAe,EAAE;EANR;AADoB,CAAlB,CAAf"}
--------------------------------------------------------------------------------
/lib/module/chevron/index.js:
--------------------------------------------------------------------------------
1 | export { default } from './chevron';
2 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/lib/module/chevron/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["default"],"sources":["index.ts"],"sourcesContent":["export { default } from './chevron';\nexport type { IChevronProps } from './types';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,WAAxB"}
--------------------------------------------------------------------------------
/lib/module/chevron/types.d.js:
--------------------------------------------------------------------------------
1 | export {};
2 | //# sourceMappingURL=types.d.js.map
--------------------------------------------------------------------------------
/lib/module/chevron/types.d.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":[],"sources":["types.d.ts"],"sourcesContent":["import Animated from 'react-native-reanimated';\nimport { FC } from 'react';\nimport { ViewStyle } from 'react-native';\nexport interface IChevronProps {\n progress: Animated.SharedValue;\n sizeIcon?: number;\n /**\n * Component icon.\n */\n handleIcon?: (progress: Animated.SharedValue) => FC | null;\n\n /**\n * color active background arrow\n */\n activeBackgroundIcon: string;\n /**\n * color inactive background arrow\n */\n inactiveBackgroundIcon: string;\n\n styleChevron?: Animated.AnimateStyle;\n colorIcon?: string;\n}\n"],"mappings":""}
--------------------------------------------------------------------------------
/lib/module/hooks/index.js:
--------------------------------------------------------------------------------
1 | export { default as useLayout } from './use-layout';
2 | export { default as useValidator } from './use-validator';
3 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/lib/module/hooks/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["default","useLayout","useValidator"],"sources":["index.ts"],"sourcesContent":["export { default as useLayout } from './use-layout';\nexport { default as useValidator } from './use-validator';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,SAApB,QAAqC,cAArC;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,iBAAxC"}
--------------------------------------------------------------------------------
/lib/module/hooks/use-layout/index.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 |
3 | const useLayout = defaultHeight => {
4 | const [layout, setLayout] = useState({
5 | height: defaultHeight || 0,
6 | width: 0,
7 | measured: false
8 | });
9 | const onLayout = React.useCallback(e => {
10 | const {
11 | height,
12 | width
13 | } = e.nativeEvent.layout;
14 |
15 | if (height === layout.height && width === layout.width) {
16 | return;
17 | }
18 |
19 | setLayout({
20 | height,
21 | width,
22 | measured: true
23 | });
24 | }, [layout.height, layout.width]);
25 | return [layout, onLayout];
26 | };
27 |
28 | export default useLayout;
29 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/lib/module/hooks/use-layout/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["React","useState","useLayout","defaultHeight","layout","setLayout","height","width","measured","onLayout","useCallback","e","nativeEvent"],"sources":["index.ts"],"sourcesContent":["import React, { useState } from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\n\nconst useLayout = (defaultHeight?: number) => {\n const [layout, setLayout] = useState<{\n height: number;\n width: number;\n measured: boolean;\n }>({ height: defaultHeight || 0, width: 0, measured: false });\n\n const onLayout = React.useCallback(\n (e: LayoutChangeEvent) => {\n const { height, width } = e.nativeEvent.layout;\n\n if (height === layout.height && width === layout.width) {\n return;\n }\n\n setLayout({\n height,\n width,\n measured: true,\n });\n },\n [layout.height, layout.width]\n );\n\n return [layout, onLayout] as const;\n};\n\nexport default useLayout;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAAgC,OAAhC;;AAGA,MAAMC,SAAS,GAAIC,aAAD,IAA4B;EAC5C,MAAM,CAACC,MAAD,EAASC,SAAT,IAAsBJ,QAAQ,CAIjC;IAAEK,MAAM,EAAEH,aAAa,IAAI,CAA3B;IAA8BI,KAAK,EAAE,CAArC;IAAwCC,QAAQ,EAAE;EAAlD,CAJiC,CAApC;EAMA,MAAMC,QAAQ,GAAGT,KAAK,CAACU,WAAN,CACdC,CAAD,IAA0B;IACxB,MAAM;MAAEL,MAAF;MAAUC;IAAV,IAAoBI,CAAC,CAACC,WAAF,CAAcR,MAAxC;;IAEA,IAAIE,MAAM,KAAKF,MAAM,CAACE,MAAlB,IAA4BC,KAAK,KAAKH,MAAM,CAACG,KAAjD,EAAwD;MACtD;IACD;;IAEDF,SAAS,CAAC;MACRC,MADQ;MAERC,KAFQ;MAGRC,QAAQ,EAAE;IAHF,CAAD,CAAT;EAKD,CAbc,EAcf,CAACJ,MAAM,CAACE,MAAR,EAAgBF,MAAM,CAACG,KAAvB,CAde,CAAjB;EAiBA,OAAO,CAACH,MAAD,EAASK,QAAT,CAAP;AACD,CAzBD;;AA2BA,eAAeP,SAAf"}
--------------------------------------------------------------------------------
/lib/module/hooks/use-validator/index.js:
--------------------------------------------------------------------------------
1 | import { useMemo } from 'react';
2 | import invariant from 'invariant';
3 |
4 | const useValidator = _ref => {
5 | let {
6 | initialMountedContent
7 | } = _ref;
8 | useMemo(() => {
9 | invariant(typeof initialMountedContent === 'boolean', `'initialMountedContent' was provided but with wrong type ! expected type is a boolean.`); // eslint-disable-next-line react-hooks/exhaustive-deps
10 | }, []);
11 | };
12 |
13 | export default useValidator;
14 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/lib/module/hooks/use-validator/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["useMemo","invariant","useValidator","initialMountedContent"],"sources":["index.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport invariant from 'invariant';\nimport type { IAccordionProps } from '../../accordion';\n\nconst useValidator = ({ initialMountedContent }: IAccordionProps) => {\n useMemo(() => {\n invariant(\n typeof initialMountedContent === 'boolean',\n `'initialMountedContent' was provided but with wrong type ! expected type is a boolean.`\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n};\n\nexport default useValidator;\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AACA,OAAOC,SAAP,MAAsB,WAAtB;;AAGA,MAAMC,YAAY,GAAG,QAAgD;EAAA,IAA/C;IAAEC;EAAF,CAA+C;EACnEH,OAAO,CAAC,MAAM;IACZC,SAAS,CACP,OAAOE,qBAAP,KAAiC,SAD1B,EAEN,wFAFM,CAAT,CADY,CAKZ;EACD,CANM,EAMJ,EANI,CAAP;AAOD,CARD;;AAUA,eAAeD,YAAf"}
--------------------------------------------------------------------------------
/lib/module/index.js:
--------------------------------------------------------------------------------
1 | export { default } from './accordion'; // default types
2 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/lib/module/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"names":["default"],"sources":["index.ts"],"sourcesContent":["export { default } from './accordion';\n// default types\nexport type { IAccordionProps } from './accordion';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,aAAxB,C,CACA"}
--------------------------------------------------------------------------------
/lib/typescript/accordion/accordion.d.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import type { IAccordionProps } from './types';
3 | declare const _default: React.ForwardRefExoticComponent>;
4 | export default _default;
5 |
--------------------------------------------------------------------------------
/lib/typescript/accordion/constant.d.ts:
--------------------------------------------------------------------------------
1 | declare const DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION = true;
2 | declare const DEFAULT_UNMOUNTED_CONTENT_ACCORDION = false;
3 | declare const DEFAULT_INACTIVE_BACKGROUND_CHEVRON = "#fff0e4";
4 | declare const DEFAULT_EXPANDED_CONTENT_ACCORDION = false;
5 | declare const DEFAULT_ACTIVE_BACKGROUND_CHEVRON = "#e5f6ff";
6 | declare const DEFAULT_DISABLED_HEAD_ACCORDION = false;
7 | declare const DEFAULT_PROGRESS_LOADING_API = false;
8 | declare const DEFAULT_SIZE_TINT_CHEVRON = 16;
9 | declare const DEFAULT_VISIBLE_CHEVRON = true;
10 | declare const DEFAULT_CONTENT_HEIGHT = 100;
11 | declare const DEFAULT_HEIGHT_CONTENT = 0;
12 | declare const DEFAULT_TINT_CHEVRON = "#16182b";
13 | export { DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION, DEFAULT_UNMOUNTED_CONTENT_ACCORDION, DEFAULT_INACTIVE_BACKGROUND_CHEVRON, DEFAULT_EXPANDED_CONTENT_ACCORDION, DEFAULT_ACTIVE_BACKGROUND_CHEVRON, DEFAULT_DISABLED_HEAD_ACCORDION, DEFAULT_PROGRESS_LOADING_API, DEFAULT_SIZE_TINT_CHEVRON, DEFAULT_VISIBLE_CHEVRON, DEFAULT_CONTENT_HEIGHT, DEFAULT_HEIGHT_CONTENT, DEFAULT_TINT_CHEVRON, };
14 |
--------------------------------------------------------------------------------
/lib/typescript/accordion/index.d.ts:
--------------------------------------------------------------------------------
1 | export { default } from './accordion';
2 | export type { IAccordionProps } from './types';
3 |
--------------------------------------------------------------------------------
/lib/typescript/accordion/styles.d.ts:
--------------------------------------------------------------------------------
1 | declare const styles: {
2 | content: {
3 | overflow: "hidden";
4 | };
5 | container: {
6 | position: "absolute";
7 | top: number;
8 | left: number;
9 | right: number;
10 | };
11 | header: {
12 | backgroundColor: string;
13 | flexDirection: "row";
14 | alignItems: "center";
15 | justifyContent: "space-between";
16 | paddingVertical: number;
17 | paddingHorizontal: number;
18 | height: number;
19 | };
20 | title: {
21 | fontSize: number;
22 | fontWeight: "bold";
23 | };
24 | indicator: {
25 | marginLeft: number;
26 | };
27 | };
28 | export { styles };
29 |
--------------------------------------------------------------------------------
/lib/typescript/chevron/chevron.d.ts:
--------------------------------------------------------------------------------
1 | import type { IChevronProps } from './types';
2 | declare const Chevron: ({ sizeIcon, progress, colorIcon, handleIcon, styleChevron, activeBackgroundIcon, inactiveBackgroundIcon, }: IChevronProps) => JSX.Element;
3 | export default Chevron;
4 |
--------------------------------------------------------------------------------
/lib/typescript/chevron/index.d.ts:
--------------------------------------------------------------------------------
1 | export { default } from './chevron';
2 | export type { IChevronProps } from './types';
3 |
--------------------------------------------------------------------------------
/lib/typescript/hooks/index.d.ts:
--------------------------------------------------------------------------------
1 | export { default as useLayout } from './use-layout';
2 | export { default as useValidator } from './use-validator';
3 |
--------------------------------------------------------------------------------
/lib/typescript/hooks/use-layout/index.d.ts:
--------------------------------------------------------------------------------
1 | import type { LayoutChangeEvent } from 'react-native';
2 | declare const useLayout: (defaultHeight?: number) => readonly [{
3 | height: number;
4 | width: number;
5 | measured: boolean;
6 | }, (e: LayoutChangeEvent) => void];
7 | export default useLayout;
8 |
--------------------------------------------------------------------------------
/lib/typescript/hooks/use-validator/index.d.ts:
--------------------------------------------------------------------------------
1 | import type { IAccordionProps } from '../../accordion';
2 | declare const useValidator: ({ initialMountedContent }: IAccordionProps) => void;
3 | export default useValidator;
4 |
--------------------------------------------------------------------------------
/lib/typescript/index.d.ts:
--------------------------------------------------------------------------------
1 | export { default } from './accordion';
2 | export type { IAccordionProps } from './accordion';
3 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@dev-event/react-native-accordion",
3 | "version": "2.0.4",
4 | "description": "A performant interactive collapsed view with fully configurable options",
5 | "main": "lib/commonjs/index",
6 | "module": "lib/module/index",
7 | "types": "lib/typescript/index.d.ts",
8 | "react-native": "src/index",
9 | "source": "src/index",
10 | "files": [
11 | "src",
12 | "lib",
13 | "android",
14 | "ios",
15 | "cpp",
16 | "react-native-accordion.podspec",
17 | "!lib/typescript/example",
18 | "!android/build",
19 | "!ios/build",
20 | "!**/__tests__",
21 | "!**/__fixtures__",
22 | "!**/__mocks__"
23 | ],
24 | "scripts": {
25 | "test": "jest",
26 | "typescript": "tsc --noEmit",
27 | "prepare": "bob build",
28 | "release": "release-it",
29 | "lint": "eslint \"**/*.{js,ts,tsx}\"",
30 | "example": "yarn --cwd example",
31 | "pods": "cd example && pod-install --quiet",
32 | "bootstrap": "yarn example && yarn && yarn pods",
33 | "clean": "watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start --reset-cache"
34 | },
35 | "keywords": [
36 | "react-native",
37 | "expo",
38 | "ios",
39 | "android",
40 | "collapsed",
41 | "accordion",
42 | "expanded",
43 | "animated view"
44 | ],
45 | "repository": "https://github.com/dev-event/react-native-accordion",
46 | "author": "dev-event (https://github.com/dev-event)",
47 | "license": "MIT",
48 | "bugs": {
49 | "url": "https://github.com/dev-event/react-native-accordion/issues"
50 | },
51 | "homepage": "https://github.com/dev-event/react-native-accordion#readme",
52 | "publishConfig": {
53 | "registry": "https://registry.npmjs.org/"
54 | },
55 | "devDependencies": {
56 | "@commitlint/config-conventional": "^11.0.0",
57 | "@react-native-community/eslint-config": "^2.0.0",
58 | "@release-it/conventional-changelog": "^2.0.0",
59 | "@types/jest": "^26.0.0",
60 | "@types/react": "~16.9.35",
61 | "@types/react-native": "~0.63.2",
62 | "commitlint": "^11.0.0",
63 | "eslint": "^7.2.0",
64 | "eslint-config-prettier": "^7.0.0",
65 | "eslint-plugin-prettier": "^3.1.3",
66 | "husky": "^4.2.5",
67 | "jest": "^26.0.1",
68 | "pod-install": "^0.1.0",
69 | "prettier": "^2.0.5",
70 | "react": "16.13.1",
71 | "react-native": "0.63.4",
72 | "react-native-builder-bob": "^0.18.0",
73 | "release-it": "^14.2.2",
74 | "typescript": "~4.0.0"
75 | },
76 | "peerDependencies": {
77 | "react": "*",
78 | "react-native": "*",
79 | "react-native-reanimated": "2.1.0"
80 | },
81 | "jest": {
82 | "preset": "react-native",
83 | "modulePathIgnorePatterns": [
84 | "/example/node_modules",
85 | "/lib/"
86 | ]
87 | },
88 | "husky": {
89 | "hooks": {
90 | "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
91 | "pre-commit": "yarn lint && yarn typescript"
92 | }
93 | },
94 | "commitlint": {
95 | "extends": [
96 | "@commitlint/config-conventional"
97 | ]
98 | },
99 | "release-it": {
100 | "git": {
101 | "commitMessage": "chore: release ${version}",
102 | "tagName": "v${version}"
103 | },
104 | "npm": {
105 | "publish": true
106 | },
107 | "github": {
108 | "release": true
109 | },
110 | "plugins": {
111 | "@release-it/conventional-changelog": {
112 | "preset": "angular"
113 | }
114 | }
115 | },
116 | "eslintConfig": {
117 | "root": true,
118 | "extends": [
119 | "@react-native-community",
120 | "prettier"
121 | ]
122 | },
123 | "eslintIgnore": [
124 | "node_modules/",
125 | "lib/"
126 | ],
127 | "prettier": {
128 | "quoteProps": "consistent",
129 | "singleQuote": true,
130 | "tabWidth": 2,
131 | "trailingComma": "es5",
132 | "useTabs": false
133 | },
134 | "react-native-builder-bob": {
135 | "source": "src",
136 | "output": "lib",
137 | "targets": [
138 | "commonjs",
139 | "module",
140 | [
141 | "typescript",
142 | {
143 | "project": "tsconfig.build.json"
144 | }
145 | ]
146 | ]
147 | },
148 | "dependencies": {
149 | "invariant": "2.2.4",
150 | "react-native-reanimated": "2.4.1",
151 | "react-native-redash": "16.0.11",
152 | "react-native-svg": "12.3.0"
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/scripts/bootstrap.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const child_process = require('child_process');
3 |
4 | const root = path.resolve(__dirname, '..');
5 | const args = process.argv.slice(2);
6 | const options = {
7 | cwd: process.cwd(),
8 | env: process.env,
9 | stdio: 'inherit',
10 | encoding: 'utf-8',
11 | };
12 |
13 | let result;
14 |
15 | if (process.cwd() !== root || args.length) {
16 | // We're not in the root of the project, or additional arguments were passed
17 | // In this case, forward the command to `yarn`
18 | result = child_process.spawnSync('yarn', args, options);
19 | } else {
20 | // If `yarn` is run without arguments, perform bootstrap
21 | result = child_process.spawnSync('yarn', ['bootstrap'], options);
22 | }
23 |
24 | process.exitCode = result.status;
25 |
--------------------------------------------------------------------------------
/src/accordion/accordion.tsx:
--------------------------------------------------------------------------------
1 | import React, {
2 | useCallback,
3 | forwardRef,
4 | useMemo,
5 | useEffect,
6 | useState,
7 | useImperativeHandle,
8 | Ref,
9 | } from 'react';
10 | import {
11 | ActivityIndicator,
12 | TouchableWithoutFeedback,
13 | View,
14 | ViewStyle,
15 | } from 'react-native';
16 | import Animated, {
17 | useSharedValue,
18 | useAnimatedStyle,
19 | useDerivedValue,
20 | withTiming,
21 | runOnUI,
22 | runOnJS,
23 | } from 'react-native-reanimated';
24 | import Chevron from '../chevron';
25 | import type { IAccordionProps } from './types';
26 | import { styles } from './styles';
27 | import { useLayout, useValidator } from '../hooks';
28 | import {
29 | DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION,
30 | DEFAULT_UNMOUNTED_CONTENT_ACCORDION,
31 | DEFAULT_INACTIVE_BACKGROUND_CHEVRON,
32 | DEFAULT_EXPANDED_CONTENT_ACCORDION,
33 | DEFAULT_ACTIVE_BACKGROUND_CHEVRON,
34 | DEFAULT_DISABLED_HEAD_ACCORDION,
35 | DEFAULT_PROGRESS_LOADING_API,
36 | DEFAULT_SIZE_TINT_CHEVRON,
37 | DEFAULT_VISIBLE_CHEVRON,
38 | DEFAULT_HEIGHT_CONTENT,
39 | DEFAULT_TINT_CHEVRON,
40 | DEFAULT_CONTENT_HEIGHT,
41 | } from './constant';
42 |
43 | export default forwardRef((props: IAccordionProps, ref: Ref) => {
44 | useValidator(props);
45 | //props configuration
46 | const {
47 | isArrow = DEFAULT_VISIBLE_CHEVRON,
48 | sizeIcon = DEFAULT_SIZE_TINT_CHEVRON,
49 | disabled = DEFAULT_DISABLED_HEAD_ACCORDION,
50 | colorIcon = DEFAULT_TINT_CHEVRON,
51 | initExpand = DEFAULT_EXPANDED_CONTENT_ACCORDION,
52 | handleIcon,
53 | styleChevron,
54 | contentHeight = DEFAULT_HEIGHT_CONTENT,
55 | renderContent,
56 | otherProperty,
57 | onChangeState,
58 | styleTouchable,
59 | configExpanded,
60 | styleContainer,
61 | configCollapsed,
62 | isStatusFetching = DEFAULT_PROGRESS_LOADING_API,
63 | isUnmountedContent = DEFAULT_UNMOUNTED_CONTENT_ACCORDION,
64 | activeBackgroundIcon = DEFAULT_ACTIVE_BACKGROUND_CHEVRON,
65 | initialMountedContent = DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION,
66 | handleCustomTouchable,
67 | onAnimatedEndExpanded,
68 | onAnimatedEndCollapsed,
69 | handleContentTouchable,
70 | inactiveBackgroundIcon = DEFAULT_INACTIVE_BACKGROUND_CHEVRON,
71 | handleIndicatorFetching,
72 | } = props;
73 |
74 | const [layout, onLayout] = useLayout(0);
75 | const open = useSharedValue(initExpand);
76 | const [isUnmounted, setUnmountedContent] =
77 | useState(isUnmountedContent);
78 | const [isMounted, setMounted] = useState(initialMountedContent);
79 |
80 | const handleHeightContent = useMemo(
81 | () =>
82 | renderContent === null
83 | ? 0
84 | : contentHeight || layout.height || DEFAULT_CONTENT_HEIGHT,
85 | [contentHeight, layout.height, renderContent]
86 | );
87 |
88 | const size = useSharedValue(handleHeightContent);
89 |
90 | useImperativeHandle(ref, () => ({
91 | openAccordion,
92 | }));
93 |
94 | useEffect(() => {
95 | runOnUI(() => {
96 | 'worklet';
97 | if (initExpand && isMounted && handleHeightContent) {
98 | size.value = handleHeightContent;
99 | }
100 | })();
101 | }, [handleHeightContent, initExpand, isMounted, size]);
102 |
103 | useEffect(() => {
104 | runOnUI(() => {
105 | 'worklet';
106 | if (!isStatusFetching && handleHeightContent) {
107 | size.value = handleHeightContent;
108 | }
109 | })();
110 | }, [handleHeightContent, isStatusFetching, size]);
111 |
112 | const progress = useDerivedValue(() =>
113 | open.value
114 | ? withTiming(1, configExpanded, created)
115 | : withTiming(0, configCollapsed, unmount)
116 | );
117 |
118 | const style = useAnimatedStyle>(() => ({
119 | height: size.value * progress.value + 1,
120 | opacity: progress.value === 0 ? 0 : 1,
121 | }));
122 |
123 | const created = useCallback(() => {
124 | if (onAnimatedEndExpanded !== undefined) {
125 | runOnJS(onAnimatedEndExpanded)();
126 | }
127 | }, [onAnimatedEndExpanded]);
128 |
129 | const unmount = useCallback(() => {
130 | if (onAnimatedEndCollapsed !== undefined) {
131 | runOnJS(onAnimatedEndCollapsed)();
132 | }
133 |
134 | if (isUnmountedContent) {
135 | runOnJS(setUnmountedContent)(true);
136 | return;
137 | }
138 | }, [isUnmountedContent, onAnimatedEndCollapsed]);
139 |
140 | const openAccordion = useCallback(() => {
141 | if (size.value === 0) {
142 | if (!isMounted) setMounted(true);
143 | runOnUI(setUnmountedContent)(false);
144 | runOnUI(() => {
145 | 'worklet';
146 | size.value = handleHeightContent;
147 | })();
148 | }
149 | open.value = !open.value;
150 | onChangeState && onChangeState(!open.value);
151 | }, [handleHeightContent, isMounted, onChangeState, open, size]);
152 |
153 | const hasLoader = useMemo(
154 | () =>
155 | isStatusFetching ? (
156 | handleIndicatorFetching ? (
157 | handleIndicatorFetching()
158 | ) : (
159 |
164 | )
165 | ) : (
166 |
175 | ),
176 | [
177 | progress,
178 | sizeIcon,
179 | colorIcon,
180 | handleIcon,
181 | styleChevron,
182 | isStatusFetching,
183 | activeBackgroundIcon,
184 | inactiveBackgroundIcon,
185 | handleIndicatorFetching,
186 | ]
187 | );
188 |
189 | const renderHeader = useCallback(() => {
190 | if (handleCustomTouchable === null) {
191 | return null;
192 | }
193 | return handleCustomTouchable !== undefined ? (
194 | handleCustomTouchable()
195 | ) : (
196 |
197 | {handleContentTouchable ? handleContentTouchable() : null}
198 | {isArrow ? hasLoader : null}
199 |
200 | );
201 | }, [
202 | isArrow,
203 | hasLoader,
204 | styleTouchable,
205 | handleCustomTouchable,
206 | handleContentTouchable,
207 | ]);
208 |
209 | const content = useCallback(() => {
210 | if (isUnmounted && !open.value) {
211 | return null;
212 | }
213 |
214 | return isMounted && renderContent ? renderContent() : null;
215 | }, [isMounted, isUnmounted, open.value, renderContent]);
216 |
217 | const contentStyle = useMemo(
218 | () => [styles.container, styleContainer],
219 | [styleContainer]
220 | );
221 | const containerAnimatedStyle = useMemo<
222 | Animated.AnimatedStyleProp[]
223 | >(() => [styles.content, style], [style]);
224 |
225 | return (
226 | <>
227 |
232 | {renderHeader()}
233 |
234 |
235 |
236 |
237 | {content()}
238 |
239 |
240 | >
241 | );
242 | });
243 |
--------------------------------------------------------------------------------
/src/accordion/constant.ts:
--------------------------------------------------------------------------------
1 | const DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION = true;
2 | const DEFAULT_UNMOUNTED_CONTENT_ACCORDION = false;
3 | const DEFAULT_INACTIVE_BACKGROUND_CHEVRON = '#fff0e4';
4 | const DEFAULT_EXPANDED_CONTENT_ACCORDION = false;
5 | const DEFAULT_ACTIVE_BACKGROUND_CHEVRON = '#e5f6ff';
6 | const DEFAULT_DISABLED_HEAD_ACCORDION = false;
7 | const DEFAULT_PROGRESS_LOADING_API = false;
8 | const DEFAULT_SIZE_TINT_CHEVRON = 16; // height x width
9 | const DEFAULT_VISIBLE_CHEVRON = true;
10 | const DEFAULT_CONTENT_HEIGHT = 100;
11 | const DEFAULT_HEIGHT_CONTENT = 0; //optimize method
12 | const DEFAULT_TINT_CHEVRON = '#16182b';
13 |
14 | export {
15 | DEFAULT_INITIAL_MOUNTED_CONTENT_ACCORDION,
16 | DEFAULT_UNMOUNTED_CONTENT_ACCORDION,
17 | DEFAULT_INACTIVE_BACKGROUND_CHEVRON,
18 | DEFAULT_EXPANDED_CONTENT_ACCORDION,
19 | DEFAULT_ACTIVE_BACKGROUND_CHEVRON,
20 | DEFAULT_DISABLED_HEAD_ACCORDION,
21 | DEFAULT_PROGRESS_LOADING_API,
22 | DEFAULT_SIZE_TINT_CHEVRON,
23 | DEFAULT_VISIBLE_CHEVRON,
24 | DEFAULT_CONTENT_HEIGHT,
25 | DEFAULT_HEIGHT_CONTENT,
26 | DEFAULT_TINT_CHEVRON,
27 | };
28 |
--------------------------------------------------------------------------------
/src/accordion/index.ts:
--------------------------------------------------------------------------------
1 | export { default } from './accordion';
2 | export type { IAccordionProps } from './types';
3 |
--------------------------------------------------------------------------------
/src/accordion/styles.ts:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from 'react-native';
2 |
3 | const styles = StyleSheet.create({
4 | content: {
5 | overflow: 'hidden',
6 | },
7 | container: {
8 | position: 'absolute',
9 | top: 0,
10 | left: 0,
11 | right: 0,
12 | },
13 | header: {
14 | backgroundColor: '#f5f5f7',
15 | flexDirection: 'row',
16 | alignItems: 'center',
17 | justifyContent: 'space-between',
18 | paddingVertical: 14,
19 | paddingHorizontal: 12,
20 | height: 80
21 | },
22 | title: {
23 | fontSize: 16,
24 | fontWeight: 'bold',
25 | },
26 | indicator:{
27 | marginLeft: 12
28 | }
29 | });
30 |
31 | export { styles };
32 |
--------------------------------------------------------------------------------
/src/accordion/types.d.ts:
--------------------------------------------------------------------------------
1 | import { FC } from 'react';
2 | import { ViewStyle, ViewProps } from 'react-native';
3 | import type Animated from 'react-native-reanimated';
4 |
5 | export interface IAccordionProps {
6 | /**
7 | * active/inactive TouchableWithoutFeedback
8 | */
9 | otherProperty?: ViewProps;
10 |
11 | /**
12 | * active/inactive TouchableWithoutFeedback
13 | */
14 | disabled?: boolean;
15 |
16 | /**
17 | * if active then the collapsible will be expanded on mounting.:
18 | */
19 | initExpand?: boolean;
20 |
21 | /**
22 | * Handle height helps to calculate the internal container and sheet layouts,
23 | * if `renderContent` is provided, the library internally will calculate its layout,
24 | * unless `contentHeight` is provided.
25 | */
26 | contentHeight: number;
27 |
28 | /**
29 | * unmounted content animated end
30 | */
31 | isUnmountedContent?: boolean;
32 |
33 | /**
34 | * initialMountedContent default start,
35 | */
36 | initialMountedContent: boolean;
37 |
38 | /**
39 | *
40 | */
41 | isStatusFetching: boolean;
42 |
43 | /**
44 | *
45 | */
46 | handleCustomTouchable?: () => FC | null;
47 |
48 | /**
49 | *
50 | */
51 | handleIndicatorFetching?: () => FC | null;
52 |
53 | /**
54 | *
55 | */
56 | renderContent?: () => JSX.Element | null;
57 |
58 | /**
59 | * callback change state hide/show content
60 | */
61 | onChangeState?: (value: boolean) => void;
62 |
63 | /**
64 | *
65 | */
66 | onAnimatedEndExpanded?: () => void;
67 |
68 | /**
69 | *
70 | */
71 | onAnimatedEndCollapsed?: () => void;
72 |
73 | /**
74 | *
75 | */
76 | handleContentTouchable?: () => JSX.Element | null;
77 | /**
78 | * component icon.
79 | */
80 | handleIcon?: () => FC | null;
81 |
82 | /**
83 | * active background arrow
84 | */
85 |
86 | activeBackgroundIcon?: string;
87 |
88 | /**
89 | * inactive background arrow
90 | */
91 | inactiveBackgroundIcon?: string;
92 |
93 | /**
94 | * color icon
95 | */
96 | colorIcon?: string;
97 | /**
98 | * size arrow icon
99 | */
100 | sizeIcon?: number;
101 |
102 | isArrow?: boolean;
103 |
104 | /**
105 | *
106 | */
107 | styleChevron?: ViewStyle;
108 |
109 | /**
110 | *
111 | */
112 | styleTouchable?: Animated.AnimateStyle;
113 |
114 | /**
115 | *
116 | */
117 | styleContainer?: ViewStyle;
118 | /**
119 | *
120 | */
121 |
122 | configExpanded?: Animated.WithTimingConfig;
123 |
124 | /**
125 | *
126 | */
127 | configCollapsed?: Animated.WithTimingConfig;
128 | }
129 |
--------------------------------------------------------------------------------
/src/chevron/chevron.tsx:
--------------------------------------------------------------------------------
1 | import React, { useCallback, useMemo } from 'react';
2 | import { StyleSheet, ViewStyle } from 'react-native';
3 | import Svg, { Path } from 'react-native-svg';
4 | import Animated, { useAnimatedStyle } from 'react-native-reanimated';
5 | import { mix, mixColor } from 'react-native-redash';
6 | import type { IChevronProps } from './types';
7 |
8 | const Chevron = ({
9 | sizeIcon,
10 | progress,
11 | colorIcon,
12 | handleIcon,
13 | styleChevron,
14 | activeBackgroundIcon,
15 | inactiveBackgroundIcon,
16 | }: IChevronProps) => {
17 | const style = useAnimatedStyle>(() => ({
18 | // @ts-ignore
19 | backgroundColor: mixColor(
20 | progress.value,
21 | inactiveBackgroundIcon,
22 | activeBackgroundIcon
23 | ),
24 | transform: [{ rotateZ: `${mix(progress.value, 0, Math.PI)}rad` }],
25 | }));
26 |
27 | const hasIcon = useMemo(
28 | () => (
29 |
38 |
39 |
40 | ),
41 | [colorIcon, sizeIcon]
42 | );
43 | const renderIcon = useCallback(() => {
44 | if (handleIcon === null) {
45 | return null;
46 | }
47 |
48 | return handleIcon !== undefined ? handleIcon(progress) : hasIcon;
49 | }, [handleIcon, hasIcon, progress]);
50 |
51 | const containerAnimatedStyle = useMemo<
52 | Animated.AnimatedStyleProp[]
53 | >(() => [styles.container, style, styleChevron], [style, styleChevron]);
54 |
55 | return (
56 | {renderIcon()}
57 | );
58 | };
59 |
60 | export default Chevron;
61 |
62 | const styles = StyleSheet.create({
63 | container: {
64 | height: 30,
65 | width: 30,
66 | borderRadius: 30 / 2,
67 | justifyContent: 'center',
68 | alignItems: 'center',
69 | backgroundColor: '#525251',
70 | },
71 | });
72 |
--------------------------------------------------------------------------------
/src/chevron/index.ts:
--------------------------------------------------------------------------------
1 | export { default } from './chevron';
2 | export type { IChevronProps } from './types';
3 |
--------------------------------------------------------------------------------
/src/chevron/types.d.ts:
--------------------------------------------------------------------------------
1 | import Animated from 'react-native-reanimated';
2 | import { FC } from 'react';
3 | import { ViewStyle } from 'react-native';
4 | export interface IChevronProps {
5 | progress: Animated.SharedValue;
6 | sizeIcon?: number;
7 | /**
8 | * Component icon.
9 | */
10 | handleIcon?: (progress: Animated.SharedValue) => FC | null;
11 |
12 | /**
13 | * color active background arrow
14 | */
15 | activeBackgroundIcon: string;
16 | /**
17 | * color inactive background arrow
18 | */
19 | inactiveBackgroundIcon: string;
20 |
21 | styleChevron?: Animated.AnimateStyle;
22 | colorIcon?: string;
23 | }
24 |
--------------------------------------------------------------------------------
/src/hooks/index.ts:
--------------------------------------------------------------------------------
1 | export { default as useLayout } from './use-layout';
2 | export { default as useValidator } from './use-validator';
3 |
--------------------------------------------------------------------------------
/src/hooks/use-layout/index.ts:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import type { LayoutChangeEvent } from 'react-native';
3 |
4 | const useLayout = (defaultHeight?: number) => {
5 | const [layout, setLayout] = useState<{
6 | height: number;
7 | width: number;
8 | measured: boolean;
9 | }>({ height: defaultHeight || 0, width: 0, measured: false });
10 |
11 | const onLayout = React.useCallback(
12 | (e: LayoutChangeEvent) => {
13 | const { height, width } = e.nativeEvent.layout;
14 |
15 | if (height === layout.height && width === layout.width) {
16 | return;
17 | }
18 |
19 | setLayout({
20 | height,
21 | width,
22 | measured: true,
23 | });
24 | },
25 | [layout.height, layout.width]
26 | );
27 |
28 | return [layout, onLayout] as const;
29 | };
30 |
31 | export default useLayout;
32 |
--------------------------------------------------------------------------------
/src/hooks/use-validator/index.ts:
--------------------------------------------------------------------------------
1 | import { useMemo } from 'react';
2 | import invariant from 'invariant';
3 | import type { IAccordionProps } from '../../accordion';
4 |
5 | const useValidator = ({ initialMountedContent }: IAccordionProps) => {
6 | useMemo(() => {
7 | invariant(
8 | typeof initialMountedContent === 'boolean',
9 | `'initialMountedContent' was provided but with wrong type ! expected type is a boolean.`
10 | );
11 | // eslint-disable-next-line react-hooks/exhaustive-deps
12 | }, []);
13 | };
14 |
15 | export default useValidator;
16 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | export { default } from './accordion';
2 | // default types
3 | export type { IAccordionProps } from './accordion';
4 |
--------------------------------------------------------------------------------
/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig",
3 | "include": ["src/**/*"],
4 | "exclude": [
5 | "example",
6 | "node_modules",
7 | "babel.config.js",
8 | "metro.config.js",
9 | "jest.config.js"]
10 | }
11 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": "./",
4 | "paths": {
5 | "@dev_event/react-native-accordion": [
6 | "./src/index"
7 | ]
8 | },
9 | "allowUnreachableCode": false,
10 | "allowUnusedLabels": false,
11 | "esModuleInterop": true,
12 | "importsNotUsedAsValues": "error",
13 | "forceConsistentCasingInFileNames": true,
14 | "jsx": "react",
15 | "lib": [
16 | "esnext"
17 | ],
18 | "allowJs": true,
19 | "declaration": true,
20 | "emitDeclarationOnly": true,
21 | "outDir": "dist",
22 | "module": "esnext",
23 | "moduleResolution": "node",
24 | "noImplicitReturns": true,
25 | "noImplicitUseStrict": false,
26 | "noStrictGenericChecks": false,
27 | "noUnusedLocals": true,
28 | "noUnusedParameters": true,
29 | "resolveJsonModule": true,
30 | "skipLibCheck": true,
31 | "sourceMap": true,
32 | "strict": false,
33 | "noImplicitAny": false,
34 | "target": "esnext"
35 | },
36 | }
37 |
--------------------------------------------------------------------------------