@baby-journey/rn-segmented-progress-bar 0.1.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/lib/commonjs/helpers/index.js +4 -5
  2. package/lib/commonjs/helpers/index.js.map +1 -1
  3. package/lib/commonjs/index.js +198 -142
  4. package/lib/commonjs/index.js.map +1 -1
  5. package/lib/commonjs/package.json +1 -0
  6. package/lib/module/helpers/index.js +6 -5
  7. package/lib/module/helpers/index.js.map +1 -1
  8. package/lib/module/index.js +199 -139
  9. package/lib/module/index.js.map +1 -1
  10. package/lib/typescript/helpers/index.d.ts +2 -2
  11. package/lib/typescript/helpers/index.d.ts.map +1 -1
  12. package/lib/typescript/index.d.ts +1 -2
  13. package/lib/typescript/index.d.ts.map +1 -1
  14. package/package.json +23 -16
  15. package/src/helpers/index.ts +16 -9
  16. package/src/index.tsx +236 -190
  17. package/.editorconfig +0 -15
  18. package/.gitattributes +0 -3
  19. package/.gitignore +0 -70
  20. package/.nvmrc +0 -1
  21. package/.watchmanconfig +0 -1
  22. package/.yarnrc +0 -3
  23. package/CODE_OF_CONDUCT.md +0 -133
  24. package/CONTRIBUTING.md +0 -116
  25. package/babel.config.js +0 -3
  26. package/docs/CODE_OF_CONDUCT.md +0 -44
  27. package/docs/CONTRIBUTING.md +0 -95
  28. package/docs/pull_request_template.md +0 -28
  29. package/example/.expo/README.md +0 -8
  30. package/example/.expo/devices.json +0 -3
  31. package/example/App.js +0 -1
  32. package/example/app.json +0 -33
  33. package/example/assets/adaptive-icon.png +0 -0
  34. package/example/assets/favicon.png +0 -0
  35. package/example/assets/icon.png +0 -0
  36. package/example/assets/splash.png +0 -0
  37. package/example/babel.config.js +0 -22
  38. package/example/metro.config.js +0 -38
  39. package/example/package.json +0 -30
  40. package/example/src/App.tsx +0 -41
  41. package/example/tsconfig.json +0 -6
  42. package/example/webpack.config.js +0 -25
  43. package/example/yarn.lock +0 -10640
  44. package/lefthook.yml +0 -16
  45. package/scripts/bootstrap.js +0 -29
  46. package/src/__tests__/helper/index.test.js +0 -92
  47. package/src/__tests__/index.test.js +0 -28
  48. package/tsconfig.build.json +0 -5
  49. package/tsconfig.json +0 -28
  50. package/yarn.lock +0 -9933
package/lefthook.yml DELETED
@@ -1,16 +0,0 @@
1
- pre-commit:
2
- parallel: true
3
- commands:
4
- lint:
5
- files: git diff --name-only @{push}
6
- glob: "*.{js,ts,jsx,tsx}"
7
- run: npx eslint {files}
8
- types:
9
- files: git diff --name-only @{push}
10
- glob: "*.{js,ts, jsx, tsx}"
11
- run: npx tsc --noEmit
12
- commit-msg:
13
- parallel: true
14
- commands:
15
- commitlint:
16
- run: npx commitlint --edit
@@ -1,29 +0,0 @@
1
- const os = require('os');
2
- const path = require('path');
3
- const child_process = require('child_process');
4
-
5
- const root = path.resolve(__dirname, '..');
6
- const args = process.argv.slice(2);
7
- const options = {
8
- cwd: process.cwd(),
9
- env: process.env,
10
- stdio: 'inherit',
11
- encoding: 'utf-8',
12
- };
13
-
14
- if (os.type() === 'Windows_NT') {
15
- options.shell = true;
16
- }
17
-
18
- let result;
19
-
20
- if (process.cwd() !== root || args.length) {
21
- // We're not in the root of the project, or additional arguments were passed
22
- // In this case, forward the command to `yarn`
23
- result = child_process.spawnSync('yarn', args, options);
24
- } else {
25
- // If `yarn` is run without arguments, perform bootstrap
26
- result = child_process.spawnSync('yarn', ['bootstrap'], options);
27
- }
28
-
29
- process.exitCode = result.status;
@@ -1,92 +0,0 @@
1
- import { getArcEndCoordinates, getPathValues } from '../../helpers/index';
2
-
3
- describe('getPathValues', () => {
4
- const progress = 90;
5
- const max = 100;
6
- const baseParts = 3;
7
-
8
- it('should handle happy path', () => {
9
- expect(getPathValues(progress, max, baseParts)).toEqual([
10
- 33.3333, 33.3333, 23.3333,
11
- ]);
12
- });
13
-
14
- it('should handle null', () => {
15
- expect(getPathValues(null, max, baseParts)).toEqual([0, 0, 0]);
16
- });
17
-
18
- it('should handle undefined', () => {
19
- expect(getPathValues(undefined, max, baseParts)).toEqual([0, 0, 0]);
20
- });
21
-
22
- it('should handle wrong progress', () => {
23
- expect(getPathValues(110, max, baseParts)).toEqual([
24
- 33.3333, 33.3333, 33.3333,
25
- ]);
26
- });
27
- });
28
-
29
- describe('getArcEndCoordinates', () => {
30
- /**
31
- * The formula for arc length
32
- * s = r * θ
33
- * s = arc length, r = radius, θ = central angle corresponding to desired arc length
34
- * So
35
- * θ = s/r
36
- * To get x,y coordinates on circle circumference
37
- * x = 𝑟 * sin𝜃 + cx
38
- * y = 𝑟 * cos𝜃 + cy
39
- * cx and cy are circle center point coordinates
40
- */
41
- const cx = 10;
42
- const cy = -10;
43
- const circleCircumference = 600;
44
- const r = 100;
45
- const rotation = -180;
46
- const zeroPoint = { x: 0, y: 0 };
47
-
48
- it('should handle happy path', () => {
49
- const θ = circleCircumference / r + (rotation * Math.PI) / 180;
50
- const x = r * Math.cos(θ) + cx;
51
- const y = r * Math.sin(θ) + cy;
52
-
53
- expect(
54
- getArcEndCoordinates(r, circleCircumference, cx, cy, rotation)
55
- ).toEqual({ x, y });
56
- });
57
-
58
- it('should handle null values', () => {
59
- expect(
60
- getArcEndCoordinates(null, circleCircumference, cx, cy, rotation)
61
- ).toEqual(zeroPoint);
62
-
63
- expect(getArcEndCoordinates(r, null, cx, cy, rotation)).toEqual(zeroPoint);
64
-
65
- expect(
66
- getArcEndCoordinates(r, circleCircumference, null, cy, rotation)
67
- ).toEqual(zeroPoint);
68
-
69
- expect(
70
- getArcEndCoordinates(r, circleCircumference, cx, null, rotation)
71
- ).toEqual(zeroPoint);
72
- });
73
-
74
- it('should handle undefined values', () => {
75
- expect(
76
- getArcEndCoordinates(undefined, circleCircumference, cx, cy, rotation)
77
- ).toEqual(zeroPoint);
78
-
79
- expect(getArcEndCoordinates(r, undefined, cx, cy, rotation)).toEqual({
80
- x: 0,
81
- y: 0,
82
- });
83
-
84
- expect(
85
- getArcEndCoordinates(r, circleCircumference, undefined, cy, rotation)
86
- ).toEqual(zeroPoint);
87
-
88
- expect(
89
- getArcEndCoordinates(r, circleCircumference, cx, undefined, rotation)
90
- ).toEqual(zeroPoint);
91
- });
92
- });
@@ -1,28 +0,0 @@
1
- import * as React from 'react';
2
- import { render } from '@testing-library/react-native';
3
- import RNSegmentedProgressBar from '../index';
4
-
5
- const noOfParts = 4;
6
-
7
- test('Validate number of base parts', async () => {
8
- const ProgressComp = () => {
9
- return (
10
- <RNSegmentedProgressBar
11
- radius={100}
12
- strokeWidth={14}
13
- baseColor={'#F00'}
14
- progressColor={'#000'}
15
- segments={noOfParts}
16
- segmentsGap={30}
17
- />
18
- );
19
- };
20
- const renderedComp = render(<ProgressComp />);
21
- const svgCircles = renderedComp?.toJSON()?.children[0].children[0].children;
22
- console.log(
23
- `No of circles rendered -> ${
24
- svgCircles.length
25
- }\nNo of circles should render -> ${noOfParts * 2}`
26
- );
27
- expect(svgCircles.length).toBe(noOfParts * 2);
28
- });
@@ -1,5 +0,0 @@
1
-
2
- {
3
- "extends": "./tsconfig",
4
- "exclude": ["example"]
5
- }
package/tsconfig.json DELETED
@@ -1,28 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "baseUrl": "./",
4
- "paths": {
5
- "@baby-journey/rn-segmented-progress-bar": ["./src/index"]
6
- },
7
- "allowUnreachableCode": false,
8
- "allowUnusedLabels": false,
9
- "esModuleInterop": true,
10
- "importsNotUsedAsValues": "error",
11
- "forceConsistentCasingInFileNames": true,
12
- "jsx": "react",
13
- "lib": ["esnext"],
14
- "module": "esnext",
15
- "moduleResolution": "node",
16
- "noFallthroughCasesInSwitch": true,
17
- "noImplicitReturns": true,
18
- "noImplicitUseStrict": false,
19
- "noStrictGenericChecks": false,
20
- "noUncheckedIndexedAccess": true,
21
- "noUnusedLocals": true,
22
- "noUnusedParameters": true,
23
- "resolveJsonModule": true,
24
- "skipLibCheck": true,
25
- "strict": true,
26
- "target": "esnext"
27
- }
28
- }