Skip to content

Commit 314646f

Browse files
Marcuz LarsenMarcuz Larsen
authored andcommitted
Feat: version 1.0.4
1 parent 93426fb commit 314646f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2531
-1877
lines changed

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,34 @@ Or fork the react-native-reanimated and integrate my solution noticed in the lin
2323

2424
| Prop | Type | Description |
2525
| :--- | :---: | :---:|
26-
| scrollY | Animated.SharedValue<number> | An outside prop that can be connected to the BottomSheet. Then it reacts to other scroll events
26+
| isBottomSheetInactive | boolean | Set the bottom to an inactive state. Can be used for async handling og UX requirements
27+
| initializeBottomSheetAsClosed | boolean | In some cases it might be relevant to show the background content before showing the bottomSheet
28+
| contentResizeHeightTriggerOnFocusedInputField | number | At which content height should a resize in content height occour when the input field is focused?
29+
| contentResizeHeightOnFocusedInputField | number | If contentResizeHeightTriggerOnFocusedInputField is met what should be the new content height size when input field is focused?
2730
| snapEffectDirection | Animated.SharedValue<string> | Used together with SnapEffect component. It tells the BottomSheet how to react to the effect. Please look in examples for more information
28-
| snapPointBottom* | number | this prop is required for the BottomSheet to work
29-
| isScrollableOffset | number | In some cases there can be a header or an outside component that will fill some of the screen. If this is the case then the BottomSheet needs to know the height dimensions of these components in order to determine scrollability correct.
30-
| isStaticOffset | number | Same concept as for isScrollableOffset but instead of determine scrollability then it determins when the snappable effect will be enabled / disabled. Etc. if the background content do not overlap the BottomSheet, then there is no need for the SnapEffect. This prop helps to finetune when this effect triggers
31+
| snapPointBottom* | number | This prop is required for the BottomSheet to work
32+
| extraOffset | number | If you need some extra offset when it comes to the panning event hitting the footer
3133
| borderTopRightRadius and borderTopLeftRadius | number | Sets the border top radius'
3234
| backgroundColor | string | Sets the background color
3335
| contentComponent | node | Content component
3436
| footerComponent | node | Footer component
3537
| headerComponent | node | Header component
3638
| hideFooterOnCardCollapse | object | { isEnabled: boolean, offset: number }
3739
| hideContentOnCardCollapse | object | { isEnabled: boolean, offset: number }
38-
| scrollArrowTopComponent | node | Scroll arrow top component
39-
| scrollArrowBottomComponent | node | Scroll arrow bottom component
40+
| scrollArrowTopComponent (currently disabled) | node | Scroll arrow top component
41+
| scrollArrowBottomComponent (currently disabled) | node | Scroll arrow bottom component
4042
| scrollArrows = { isEnabled: boolean, fill: string, dimensions: number, topArrowOffset: number, bottomArrowOffset: number } | object | When there is no scrollArrowBottom- or top component then this object can be used for styling the scroll arrows.
4143
| extraSnapPointBottomOffset | number | Minor differences occours depending on the Platform. This prop helps to get the perfect snap point on all platforms
44+
| keyboardAvoidBottomMargin (currently disabled) | number | An extra margin wrapper is implemented instead. The prop was used to create extra spacings when an input field is focused
45+
| maxHeight | number | max height of the bottom sheet
4246
| header = { height: number } | object | If there is no header component then this object can be used to style the header
4347
| morphingArrow = { isEnabled: boolean, offset: number, fill: string } | object | As there currently is a bug on web when interpolating SVG's with reanimated, then the morphing arrow can be disabled for specific platforms using this prop
4448
| fadingScrollEdges = { isEnabled: boolean, androidFadingEdgeLength: number, iOSAndWebFadingEdgeHeight: number, nativeBackgroundColor: string, webBackgroundColorTop: { from: string to: string}, webBackgroundColorBottom: { from: string, to: string } | object | This prop ensures that there is a scrolling edge when the content is scrollable
49+
| outerScrollEvent = { isEnabled?: boolean, scrollY?: Animated.SharedValue<number>, autoScrollTriggerLength?: number } | object | Connect an outer scrolling event that the bottom sheet should react to
50+
| testID | string | add testID to the bottomSheet
51+
| openBottomSheetRequest & closeBottomSheetRequest | { isEnabled: boolean; callback: ((cb) => void) => void } | Custom trigger functions to make the bottom sheet go to bottom or top
4552
| getCurrentConfigRequest(config) | function with callback | This function will provide the current configuration
4653
| onLayoutRequest(cardHeight) | function with callback | In some use cases the card height of the BottomSheet might become useful
47-
| resetCardPosition(resetCallback) | function with callback | In some cases where there is no rerendering effect when changing screens etc. then this helper will ensure that the card will fold out nicely if its initially collapsed. An implementation example can be found in ./src/components/Example/NoHardRerenderingEffect.tsx
4854

4955
</details>
5056
<details>

__tests__/App-test.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

__tests__/reanimated.test.tsx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import React from 'react';
2+
import { View, Button, Text } from 'react-native';
3+
import { render, fireEvent } from '@testing-library/react-native';
4+
import { useSharedValue } from 'react-native-reanimated';
5+
6+
const ViewTestComponent: React.FC = () => {
7+
const sv = useSharedValue(1);
8+
return <Text testID="text">{sv.value}</Text>;
9+
};
10+
11+
const TestComponentWithSV: React.FC = () => {
12+
const sv = useSharedValue(1);
13+
14+
return (
15+
<View>
16+
<Text testID="text">{sv.value}</Text>
17+
<Button
18+
testID="button"
19+
title="run"
20+
onPress={(): void => {
21+
sv.value = sv.value + 1;
22+
}}
23+
/>
24+
</View>
25+
);
26+
};
27+
28+
describe('SharedValue basic render', () => {
29+
test('Contains default value', () => {
30+
const { getByTestId } = render(<ViewTestComponent />);
31+
const text = getByTestId('text');
32+
expect(text.children[0]).toBe('1');
33+
});
34+
35+
test('No changes value after click', () => {
36+
const { getByTestId } = render(<TestComponentWithSV />);
37+
const text = getByTestId('text');
38+
const button = getByTestId('button');
39+
40+
expect(text.children[0]).toBe('1');
41+
fireEvent.press(button);
42+
expect(text.children[0]).toBe('1');
43+
fireEvent.press(button);
44+
expect(text.children[0]).toBe('1');
45+
});
46+
});

jest-setup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('react-native-reanimated/lib/reanimated2/jestUtils').setUpTests();

jest.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
preset: 'react-native',
3+
setupFiles: ['./jest-setup.js'],
4+
testEnvironment: 'node',
5+
testResultsProcessor: 'jest-sonar-reporter',
6+
transformIgnorePatterns: [],
7+
};

package.json

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
{
22
"name": "@marcuzgabriel/reanimated-animation-library",
33
"author": "Marcuz Gabriel Larsen <marcuzgabriel@gmail.com>",
4-
"version": "1.0.2",
4+
"version": "1.0.4",
55
"license": "MIT",
6-
"repository": {
7-
"type": "git",
8-
"url": "git+https://github.com/marcuzgabriel/reanimated-animation-library.git"
9-
},
106
"scripts": {
117
"android": "react-native run-android",
128
"ios": "react-native run-ios",
139
"start": "react-native start --reset-cache",
14-
"test": "jest",
15-
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
10+
"test:unit": "jest",
11+
"test:jest:ci": "jest --coverage",
12+
"test:jest:watch": "jest --watch",
13+
"format": "prettier --write --list-different ./src/**",
14+
"lint-diff": "eslint --ext '.js,.ts,.tsx' src/** && yarn prettier --check src/**",
1615
"web": "cross-env NODE_ENV=development webpack serve --config web/webpack.config.js",
1716
"web:clean": "rimraf web/vendor/ web/build",
1817
"web:build": "rimraf web/build/; cross-env NODE_ENV=production webpack --config web/webpack.config.js",
@@ -36,6 +35,7 @@
3635
"lib/",
3736
"reanimated-animation-library.d.ts",
3837
"README.md",
38+
"!__tests__",
3939
"!__snapshots__",
4040
"!*.test.js"
4141
],
@@ -62,6 +62,9 @@
6262
"@babel/preset-typescript": "7.13.0",
6363
"@babel/runtime": "^7.13.17",
6464
"@react-native-community/eslint-config": "^2.0.0",
65+
"@testing-library/jest-native": "^4.0.1",
66+
"@testing-library/react-hooks": "^7.0.0",
67+
"@testing-library/react-native": "^7.2.0",
6568
"@types/jest": "^26.0.23",
6669
"@types/node": "^15.3.0",
6770
"@types/react": "^17.0.5",
@@ -70,18 +73,26 @@
7073
"@types/styled-components": "^5.1.9",
7174
"@types/styled-components-react-native": "^5.1.1",
7275
"@typescript-eslint/parser": "^4.22.1",
73-
"babel-jest": "^26.6.3",
76+
"babel-jest": "^27.0.6",
7477
"babel-loader": "8.2.1",
7578
"babel-plugin-module-resolver": "^3.1.3",
7679
"babel-plugin-styled-components": "^1.12.0",
7780
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
7881
"core-js": "^3.11.0",
7982
"cross-env": "^5.1.4",
80-
"eslint": "^7.14.0",
83+
"eslint": "^7.28.0",
84+
"eslint-config-prettier": "^8.3.0",
85+
"eslint-config-standard": "^16.0.3",
86+
"eslint-import-resolver-babel-module": "^5.3.1",
87+
"eslint-plugin-import": "^2.23.4",
88+
"eslint-plugin-node": "^11.1.0",
89+
"eslint-plugin-promise": "^5.1.0",
90+
"eslint-plugin-standard": "^5.0.0",
8191
"html-webpack-plugin": "^5.3.1",
82-
"jest": "^26.6.3",
92+
"jest": "^27.0.6",
93+
"jest-sonar-reporter": "^2.0.0",
8394
"metro-react-native-babel-preset": "^0.66.0",
84-
"prettier": "^2.1.1",
95+
"prettier": "^2.3.1",
8596
"process": "^0.11.10",
8697
"react": "17.0.2",
8798
"react-dom": "^17.0.2",
@@ -96,6 +107,7 @@
96107
"react-test-renderer": "17.0.1",
97108
"style-loader": "^0.23.1",
98109
"styled-components": "^5.0.1",
110+
"ts-jest": "^27.0.5",
99111
"typescript": "^4.2.3",
100112
"webpack": "^5.26.0",
101113
"webpack-cli": "^4.2.0",
@@ -104,15 +116,8 @@
104116
"resolutions": {
105117
"@types/react": "^17"
106118
},
107-
"jest": {
108-
"preset": "react-native",
109-
"moduleFileExtensions": [
110-
"ts",
111-
"tsx",
112-
"js",
113-
"jsx",
114-
"json",
115-
"node"
116-
]
119+
"repository": {
120+
"type": "git",
121+
"url": "git+https://github.com/marcuzgabriel/reanimated-animation-library.git"
117122
}
118123
}

0 commit comments

Comments
 (0)