@one-am/react-native-simple-image-slider 0.15.0 → 0.16.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 (58) hide show
  1. package/README.md +12 -6
  2. package/lib/commonjs/@types/pinch-to-zoom.js +0 -4
  3. package/lib/commonjs/AbsoluteComponentContainer.js +34 -0
  4. package/lib/commonjs/AbsoluteComponentContainer.js.map +1 -0
  5. package/lib/commonjs/BaseSimpleImageSlider.js +98 -132
  6. package/lib/commonjs/BaseSimpleImageSlider.js.map +1 -1
  7. package/lib/commonjs/FullScreenImageSlider.js +20 -29
  8. package/lib/commonjs/FullScreenImageSlider.js.map +1 -1
  9. package/lib/commonjs/PageCounter.js +24 -20
  10. package/lib/commonjs/PageCounter.js.map +1 -1
  11. package/lib/commonjs/PinchToZoom.js +5 -5
  12. package/lib/commonjs/PinchToZoom.js.map +1 -1
  13. package/lib/commonjs/SimpleImageSliderThemeProvider.js +19 -11
  14. package/lib/commonjs/SimpleImageSliderThemeProvider.js.map +1 -1
  15. package/lib/commonjs/index.js +9 -1
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/module/@types/pinch-to-zoom.js +0 -2
  18. package/lib/module/AbsoluteComponentContainer.js +28 -0
  19. package/lib/module/AbsoluteComponentContainer.js.map +1 -0
  20. package/lib/module/BaseSimpleImageSlider.js +99 -133
  21. package/lib/module/BaseSimpleImageSlider.js.map +1 -1
  22. package/lib/module/FullScreenImageSlider.js +21 -30
  23. package/lib/module/FullScreenImageSlider.js.map +1 -1
  24. package/lib/module/PageCounter.js +23 -20
  25. package/lib/module/PageCounter.js.map +1 -1
  26. package/lib/module/PinchToZoom.js +5 -5
  27. package/lib/module/PinchToZoom.js.map +1 -1
  28. package/lib/module/SimpleImageSliderThemeProvider.js +19 -12
  29. package/lib/module/SimpleImageSliderThemeProvider.js.map +1 -1
  30. package/lib/module/index.js +2 -2
  31. package/lib/module/index.js.map +1 -1
  32. package/lib/typescript/src/@types/pinch-to-zoom.d.ts +3 -4
  33. package/lib/typescript/src/@types/pinch-to-zoom.d.ts.map +1 -1
  34. package/lib/typescript/src/AbsoluteComponentContainer.d.ts +7 -0
  35. package/lib/typescript/src/AbsoluteComponentContainer.d.ts.map +1 -0
  36. package/lib/typescript/src/BaseSimpleImageSlider.d.ts +1 -1
  37. package/lib/typescript/src/BaseSimpleImageSlider.d.ts.map +1 -1
  38. package/lib/typescript/src/FullScreenImageSlider.d.ts.map +1 -1
  39. package/lib/typescript/src/PageCounter.d.ts.map +1 -1
  40. package/lib/typescript/src/PinchToZoom.d.ts.map +1 -1
  41. package/lib/typescript/src/SimpleImageSliderThemeProvider.d.ts +10 -2
  42. package/lib/typescript/src/SimpleImageSliderThemeProvider.d.ts.map +1 -1
  43. package/lib/typescript/src/index.d.ts +2 -3
  44. package/lib/typescript/src/index.d.ts.map +1 -1
  45. package/package.json +161 -160
  46. package/src/@types/pinch-to-zoom.ts +3 -5
  47. package/src/AbsoluteComponentContainer.tsx +30 -0
  48. package/src/BaseSimpleImageSlider.tsx +118 -150
  49. package/src/FullScreenImageSlider.tsx +39 -34
  50. package/src/PageCounter.tsx +35 -17
  51. package/src/PinchToZoom.tsx +10 -9
  52. package/src/SimpleImageSliderThemeProvider.tsx +32 -13
  53. package/src/index.tsx +7 -2
  54. package/lib/commonjs/@types/styled.d.js +0 -4
  55. package/lib/commonjs/@types/styled.d.js.map +0 -1
  56. package/lib/module/@types/styled.d.js +0 -4
  57. package/lib/module/@types/styled.d.js.map +0 -1
  58. package/src/@types/styled.d.ts +0 -17
package/package.json CHANGED
@@ -1,166 +1,167 @@
1
1
  {
2
- "name": "@one-am/react-native-simple-image-slider",
3
- "version": "0.15.0",
4
- "description": "A simple and performant image slider made with FlashList. Includes a full screen gallery component with gesture support.",
5
- "main": "lib/commonjs/index",
6
- "module": "lib/module/index",
7
- "types": "lib/typescript/src/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
- "*.podspec",
17
- "!ios/build",
18
- "!android/build",
19
- "!android/gradle",
20
- "!android/gradlew",
21
- "!android/gradlew.bat",
22
- "!android/local.properties",
23
- "!**/__tests__",
24
- "!**/__fixtures__",
25
- "!**/__mocks__",
26
- "!**/.*"
27
- ],
28
- "scripts": {
29
- "example": "yarn workspace @one-am/react-native-simple-image-slider-example",
30
- "test": "jest",
31
- "typecheck": "tsc --noEmit",
32
- "lint": "eslint \"**/*.{js,ts,tsx}\"",
33
- "clean": "del-cli lib",
34
- "prepare": "bob build",
35
- "release": "release-it"
36
- },
37
- "keywords": [
38
- "react-native",
39
- "image-slider",
40
- "gallery"
41
- ],
42
- "repository": {
43
- "type": "git",
44
- "url": "git+https://github.com/one-am-it/react-native-simple-image-slider.git"
45
- },
46
- "author": "one-am <info@oneam.it> (https://github.com/one-am-it)",
47
- "license": "MIT",
48
- "bugs": {
49
- "url": "https://github.com/one-am-it/react-native-simple-image-slider/issues"
50
- },
51
- "homepage": "https://github.com/one-am-it/react-native-simple-image-slider#readme",
52
- "publishConfig": {
53
- "registry": "https://registry.npmjs.org/",
54
- "access": "public"
55
- },
56
- "dependencies": {
57
- "merge-refs": "^1.2.2"
58
- },
59
- "peerDependencies": {
60
- "@shopify/flash-list": "*",
61
- "expo-haptics": "*",
62
- "expo-image": "*",
63
- "expo-status-bar": "*",
64
- "react": "*",
65
- "react-native": "*",
66
- "react-native-gesture-handler": "*",
67
- "react-native-reanimated": "*",
68
- "react-native-safe-area-context": "*",
69
- "react-native-svg": "*",
70
- "styled-components": "*"
71
- },
72
- "devDependencies": {
73
- "@babel/runtime": "^7.24.1",
74
- "@commitlint/config-conventional": "^17.0.2",
75
- "@evilmartians/lefthook": "^1.5.0",
76
- "@react-native/babel-preset": "^0.75.0-main",
77
- "@react-native/eslint-config": "^0.73.1",
78
- "@release-it/conventional-changelog": "^5.0.0",
79
- "@shopify/flash-list": "^1.6.3",
80
- "@types/jest": "^29.5.5",
81
- "@types/react": "^18.2.44",
82
- "@typescript-eslint/eslint-plugin": "^5.62.0",
83
- "@typescript-eslint/parser": "^5.62.0",
84
- "babel-plugin-styled-components": "^2.1.4",
85
- "commitlint": "^17.0.2",
86
- "del-cli": "^5.1.0",
87
- "eslint": "^8.56.0",
88
- "eslint-config-prettier": "^9.1.0",
89
- "eslint-config-standard-with-typescript": "^37.0.0",
90
- "eslint-plugin-ft-flow": "^3.0.7",
91
- "eslint-plugin-import": "^2.29.1",
92
- "eslint-plugin-n": "^16.6.2",
93
- "eslint-plugin-prettier": "^5.0.1",
94
- "eslint-plugin-promise": "^6.1.1",
95
- "eslint-plugin-react": "^7.33.2",
96
- "eslint-plugin-react-hooks": "^4.6.0",
97
- "eslint-plugin-react-native": "^4.1.0",
98
- "expo-haptics": "^12.8.1",
99
- "expo-image": "^1.10.6",
100
- "expo-status-bar": "^1.11.1",
101
- "jest": "^29.7.0",
102
- "prettier": "^3.4.2",
103
- "react": "18.2.0",
104
- "react-native": "0.74.5",
105
- "react-native-builder-bob": "^0.35.2",
106
- "react-native-gesture-handler": "~2.16.1",
107
- "react-native-reanimated": "~3.10.1",
108
- "react-native-safe-area-context": "4.10.5",
109
- "react-native-svg": "15.2.0",
110
- "react-native-web": "~0.19.6",
111
- "release-it": "^15.0.0",
112
- "styled-components": "^6.1.13",
113
- "typescript": "^5.4.2",
114
- "typescript-plugin-styled-components": "^3.0.0"
115
- },
116
- "resolutions": {
117
- "styled-components": "^6.1.13"
118
- },
119
- "workspaces": [
120
- "example"
121
- ],
122
- "packageManager": "yarn@3.6.1",
123
- "jest": {
124
- "preset": "react-native",
125
- "modulePathIgnorePatterns": [
126
- "<rootDir>/example/node_modules",
127
- "<rootDir>/lib/"
128
- ]
129
- },
130
- "commitlint": {
131
- "extends": [
132
- "@commitlint/config-conventional"
133
- ]
134
- },
135
- "release-it": {
136
- "git": {
137
- "commitMessage": "chore: release ${version}",
138
- "tagName": "v${version}"
2
+ "name": "@one-am/react-native-simple-image-slider",
3
+ "version": "0.16.0",
4
+ "description": "A simple and performant image slider made with FlashList. Includes a full screen gallery component with gesture support.",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/src/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
+ "*.podspec",
17
+ "!ios/build",
18
+ "!android/build",
19
+ "!android/gradle",
20
+ "!android/gradlew",
21
+ "!android/gradlew.bat",
22
+ "!android/local.properties",
23
+ "!**/__tests__",
24
+ "!**/__fixtures__",
25
+ "!**/__mocks__",
26
+ "!**/.*"
27
+ ],
28
+ "scripts": {
29
+ "example": "yarn workspace @one-am/react-native-simple-image-slider-example",
30
+ "test": "jest",
31
+ "typecheck": "tsc --noEmit",
32
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
33
+ "clean": "del-cli lib",
34
+ "prepare": "bob build",
35
+ "release": "release-it",
36
+ "sync:deps": "node bin/sync-peer-to-dev.js"
139
37
  },
140
- "npm": {
141
- "publish": true
38
+ "keywords": [
39
+ "react-native",
40
+ "image-slider",
41
+ "gallery"
42
+ ],
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/one-am-it/react-native-simple-image-slider.git"
142
46
  },
143
- "gitlab": {
144
- "release": true
47
+ "author": "one-am <info@oneam.it> (https://github.com/one-am-it)",
48
+ "license": "MIT",
49
+ "bugs": {
50
+ "url": "https://github.com/one-am-it/react-native-simple-image-slider/issues"
145
51
  },
146
- "plugins": {
147
- "@release-it/conventional-changelog": {
148
- "preset": "angular"
149
- }
150
- }
151
- },
152
- "react-native-builder-bob": {
153
- "source": "src",
154
- "output": "lib",
155
- "targets": [
156
- "commonjs",
157
- "module",
158
- [
159
- "typescript",
160
- {
161
- "project": "tsconfig.build.json"
52
+ "homepage": "https://github.com/one-am-it/react-native-simple-image-slider#readme",
53
+ "publishConfig": {
54
+ "registry": "https://registry.npmjs.org/",
55
+ "access": "public"
56
+ },
57
+ "dependencies": {
58
+ "merge-refs": "^1.2.2"
59
+ },
60
+ "peerDependencies": {
61
+ "@shopify/flash-list": "<2.0.0",
62
+ "expo-haptics": "*",
63
+ "expo-image": "*",
64
+ "expo-status-bar": "*",
65
+ "react": "*",
66
+ "react-native": "*",
67
+ "react-native-gesture-handler": "*",
68
+ "react-native-reanimated": "*",
69
+ "react-native-safe-area-context": "*",
70
+ "react-native-svg": "*"
71
+ },
72
+ "devDependencies": {
73
+ "@babel/runtime": "^7.27.6",
74
+ "@commitlint/config-conventional": "^17.0.2",
75
+ "@evilmartians/lefthook": "^1.5.0",
76
+ "@react-native/babel-preset": "^0.75.0-main",
77
+ "@react-native/eslint-config": "^0.73.1",
78
+ "@release-it/conventional-changelog": "^5.0.0",
79
+ "@shopify/flash-list": "1.8.2",
80
+ "@types/jest": "^29.5.5",
81
+ "@types/react": "^18.2.44",
82
+ "@typescript-eslint/eslint-plugin": "^5.62.0",
83
+ "@typescript-eslint/parser": "^5.62.0",
84
+ "babel-plugin-styled-components": "^2.1.4",
85
+ "commitlint": "^17.0.2",
86
+ "del-cli": "^5.1.0",
87
+ "eslint": "^8.56.0",
88
+ "eslint-config-prettier": "^9.1.0",
89
+ "eslint-config-standard-with-typescript": "^37.0.0",
90
+ "eslint-plugin-ft-flow": "^3.0.7",
91
+ "eslint-plugin-import": "^2.29.1",
92
+ "eslint-plugin-n": "^16.6.2",
93
+ "eslint-plugin-prettier": "^5.0.1",
94
+ "eslint-plugin-promise": "^6.1.1",
95
+ "eslint-plugin-react": "^7.33.2",
96
+ "eslint-plugin-react-hooks": "^4.6.0",
97
+ "eslint-plugin-react-native": "^4.1.0",
98
+ "expo-haptics": "~14.1.4",
99
+ "expo-image": "~2.3.0",
100
+ "expo-status-bar": "~2.2.3",
101
+ "expo-system-ui": "~5.0.9",
102
+ "jest": "^29.7.0",
103
+ "prettier": "^3.4.2",
104
+ "react": "19.0.0",
105
+ "react-dom": "19.0.0",
106
+ "react-native": "0.79.4",
107
+ "react-native-builder-bob": "^0.35.2",
108
+ "react-native-gesture-handler": "~2.24.0",
109
+ "react-native-reanimated": "~3.17.4",
110
+ "react-native-safe-area-context": "5.4.0",
111
+ "react-native-svg": "15.11.2",
112
+ "react-native-web": "^0.20.0",
113
+ "release-it": "^15.0.0",
114
+ "typescript": "^5.4.2",
115
+ "typescript-plugin-styled-components": "^3.0.0"
116
+ },
117
+ "resolutions": {
118
+ "styled-components": "^6.1.13"
119
+ },
120
+ "workspaces": [
121
+ "example"
122
+ ],
123
+ "packageManager": "yarn@3.6.1",
124
+ "jest": {
125
+ "preset": "react-native",
126
+ "modulePathIgnorePatterns": [
127
+ "<rootDir>/example/node_modules",
128
+ "<rootDir>/lib/"
129
+ ]
130
+ },
131
+ "commitlint": {
132
+ "extends": [
133
+ "@commitlint/config-conventional"
134
+ ]
135
+ },
136
+ "release-it": {
137
+ "git": {
138
+ "commitMessage": "chore: release ${version}",
139
+ "tagName": "v${version}"
140
+ },
141
+ "npm": {
142
+ "publish": true
143
+ },
144
+ "gitlab": {
145
+ "release": true
146
+ },
147
+ "plugins": {
148
+ "@release-it/conventional-changelog": {
149
+ "preset": "angular"
150
+ }
162
151
  }
163
- ]
164
- ]
165
- }
152
+ },
153
+ "react-native-builder-bob": {
154
+ "source": "src",
155
+ "output": "lib",
156
+ "targets": [
157
+ "commonjs",
158
+ "module",
159
+ [
160
+ "typescript",
161
+ {
162
+ "project": "tsconfig.build.json"
163
+ }
164
+ ]
165
+ ]
166
+ }
166
167
  }
@@ -1,9 +1,7 @@
1
- import type { SharedValue } from 'react-native-reanimated';
2
-
3
1
  export type PinchToZoomStatus = {
4
- scale: SharedValue<number>;
2
+ scale: number;
5
3
  translation: {
6
- x: SharedValue<number>;
7
- y: SharedValue<number>;
4
+ x: number;
5
+ y: number;
8
6
  };
9
7
  };
@@ -0,0 +1,30 @@
1
+ import React, { useMemo } from 'react';
2
+
3
+ import type { PropsWithChildren } from 'react';
4
+ import { StyleSheet, View } from 'react-native';
5
+
6
+ export type AbsoluteComponentContainerProps = PropsWithChildren<{
7
+ position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
8
+ }>;
9
+
10
+ export function AbsoluteComponentContainer({
11
+ position,
12
+ children,
13
+ }: AbsoluteComponentContainerProps) {
14
+ const styles = useMemo(() => makeStyles(position), [position]);
15
+
16
+ return <View style={styles.container}>{children}</View>;
17
+ }
18
+
19
+ const makeStyles = (position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right') => {
20
+ return StyleSheet.create({
21
+ container: {
22
+ zIndex: 1000,
23
+ position: 'absolute',
24
+ bottom: position === 'bottom-left' || position === 'bottom-right' ? 16 : 'auto',
25
+ top: position === 'top-left' || position === 'top-right' ? 16 : 'auto',
26
+ left: position === 'top-left' || position === 'bottom-left' ? 16 : 'auto',
27
+ right: position === 'top-right' || position === 'bottom-right' ? 16 : 'auto',
28
+ },
29
+ });
30
+ };