@lodev09/react-native-true-sheet 0.13.0 → 1.0.1

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 (74) hide show
  1. package/android/build.gradle +6 -1
  2. package/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt +27 -4
  3. package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +10 -0
  4. package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +7 -0
  5. package/android/src/main/java/com/lodev09/truesheet/core/RootSheetView.kt +2 -26
  6. package/android/src/main/java/com/lodev09/truesheet/core/Utils.kt +11 -2
  7. package/android/src/main/java/com/lodev09/truesheet/events/ContainerSizeChangeEvent.kt +23 -0
  8. package/ios/TrueSheet-Bridging-Header.h +1 -0
  9. package/ios/TrueSheetView.swift +39 -40
  10. package/ios/TrueSheetViewManager.m +1 -0
  11. package/ios/TrueSheetViewManager.swift +6 -4
  12. package/lib/commonjs/TrueSheet.js +56 -36
  13. package/lib/commonjs/TrueSheet.js.map +1 -1
  14. package/lib/commonjs/TrueSheetFooter.js +2 -3
  15. package/lib/commonjs/TrueSheetFooter.js.map +1 -1
  16. package/lib/commonjs/TrueSheetGrabber.js +11 -11
  17. package/lib/commonjs/TrueSheetGrabber.js.map +1 -1
  18. package/lib/commonjs/TrueSheetModule.js.map +1 -1
  19. package/lib/commonjs/index.js +6 -6
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/module/TrueSheet.js +58 -34
  22. package/lib/module/TrueSheet.js.map +1 -1
  23. package/lib/module/TrueSheet.types.js +2 -0
  24. package/lib/module/TrueSheetFooter.js +4 -2
  25. package/lib/module/TrueSheetFooter.js.map +1 -1
  26. package/lib/module/TrueSheetGrabber.js +13 -10
  27. package/lib/module/TrueSheetGrabber.js.map +1 -1
  28. package/lib/module/TrueSheetModule.js +2 -0
  29. package/lib/module/TrueSheetModule.js.map +1 -1
  30. package/lib/module/index.js +5 -3
  31. package/lib/module/index.js.map +1 -1
  32. package/lib/typescript/commonjs/package.json +1 -0
  33. package/lib/typescript/{src → commonjs/src}/TrueSheet.d.ts +3 -0
  34. package/lib/typescript/commonjs/src/TrueSheet.d.ts.map +1 -0
  35. package/lib/typescript/{src → commonjs/src}/TrueSheet.types.d.ts +7 -0
  36. package/lib/typescript/commonjs/src/TrueSheet.types.d.ts.map +1 -0
  37. package/lib/typescript/{src → commonjs/src}/TrueSheetFooter.d.ts +1 -2
  38. package/lib/typescript/commonjs/src/TrueSheetFooter.d.ts.map +1 -0
  39. package/lib/typescript/{src → commonjs/src}/TrueSheetGrabber.d.ts +1 -2
  40. package/lib/typescript/commonjs/src/TrueSheetGrabber.d.ts.map +1 -0
  41. package/lib/typescript/commonjs/src/TrueSheetModule.d.ts.map +1 -0
  42. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  43. package/lib/typescript/module/package.json +1 -0
  44. package/lib/typescript/module/src/TrueSheet.d.ts +62 -0
  45. package/lib/typescript/module/src/TrueSheet.d.ts.map +1 -0
  46. package/lib/typescript/module/src/TrueSheet.types.d.ts +212 -0
  47. package/lib/typescript/module/src/TrueSheet.types.d.ts.map +1 -0
  48. package/lib/typescript/module/src/TrueSheetFooter.d.ts +7 -0
  49. package/lib/typescript/module/src/TrueSheetFooter.d.ts.map +1 -0
  50. package/lib/typescript/module/src/TrueSheetGrabber.d.ts +39 -0
  51. package/lib/typescript/module/src/TrueSheetGrabber.d.ts.map +1 -0
  52. package/lib/typescript/module/src/TrueSheetModule.d.ts +2 -0
  53. package/lib/typescript/module/src/TrueSheetModule.d.ts.map +1 -0
  54. package/lib/typescript/module/src/index.d.ts +4 -0
  55. package/lib/typescript/module/src/index.d.ts.map +1 -0
  56. package/package.json +77 -62
  57. package/{TrueSheet.podspec → react-native-true-sheet.podspec} +19 -18
  58. package/src/TrueSheet.tsx +29 -5
  59. package/src/TrueSheet.types.ts +8 -0
  60. package/src/TrueSheetFooter.tsx +0 -1
  61. package/src/TrueSheetGrabber.tsx +0 -1
  62. package/lib/commonjs/__mocks__/index.js +0 -37
  63. package/lib/commonjs/__mocks__/index.js.map +0 -1
  64. package/lib/module/__mocks__/index.js +0 -15
  65. package/lib/module/__mocks__/index.js.map +0 -1
  66. package/lib/typescript/src/TrueSheet.d.ts.map +0 -1
  67. package/lib/typescript/src/TrueSheet.types.d.ts.map +0 -1
  68. package/lib/typescript/src/TrueSheetFooter.d.ts.map +0 -1
  69. package/lib/typescript/src/TrueSheetGrabber.d.ts.map +0 -1
  70. package/lib/typescript/src/TrueSheetModule.d.ts.map +0 -1
  71. package/lib/typescript/src/index.d.ts.map +0 -1
  72. package/src/__mocks__/index.js +0 -18
  73. /package/lib/typescript/{src → commonjs/src}/TrueSheetModule.d.ts +0 -0
  74. /package/lib/typescript/{src → commonjs/src}/index.d.ts +0 -0
@@ -0,0 +1,212 @@
1
+ import type { Component, ComponentType, ReactElement, RefObject } from 'react';
2
+ import type { ColorValue, StyleProp, ViewProps, ViewStyle } from 'react-native';
3
+ import type { TrueSheetGrabberProps } from './TrueSheetGrabber';
4
+ export interface SizeInfo {
5
+ index: number;
6
+ value: number;
7
+ }
8
+ /**
9
+ * Blur style mapped to native values in IOS.
10
+ *
11
+ * @platform ios
12
+ */
13
+ export type BlurTint = 'light' | 'dark' | 'default' | 'extraLight' | 'regular' | 'prominent' | 'systemUltraThinMaterial' | 'systemThinMaterial' | 'systemMaterial' | 'systemThickMaterial' | 'systemChromeMaterial' | 'systemUltraThinMaterialLight' | 'systemThinMaterialLight' | 'systemMaterialLight' | 'systemThickMaterialLight' | 'systemChromeMaterialLight' | 'systemUltraThinMaterialDark' | 'systemThinMaterialDark' | 'systemMaterialDark' | 'systemThickMaterialDark' | 'systemChromeMaterialDark';
14
+ /**
15
+ * Supported Sheet size.
16
+ *
17
+ * @platform android
18
+ * @platform ios 15+
19
+ */
20
+ export type SheetSize =
21
+ /**
22
+ * Auto resize based on content height
23
+ *
24
+ * @platform android
25
+ * @platform ios 16+
26
+ */
27
+ 'auto'
28
+ /**
29
+ * Fixed height
30
+ *
31
+ * @platform android
32
+ * @platform ios 16+
33
+ */
34
+ | number
35
+ /**
36
+ * Fixed height in %
37
+ *
38
+ * @platform android
39
+ * @platform ios 16+
40
+ */
41
+ | `${number}%`
42
+ /**
43
+ * Translates to 25%
44
+ *
45
+ * @platform android
46
+ * @platform ios 16+
47
+ */
48
+ | 'small'
49
+ /**
50
+ * Translates to 50%
51
+ *
52
+ * @platform android
53
+ * @platform ios 15+
54
+ */
55
+ | 'medium'
56
+ /**
57
+ * Translates to 100%
58
+ *
59
+ * @platform android
60
+ * @platform ios 15+
61
+ */
62
+ | 'large';
63
+ export interface TrueSheetProps extends ViewProps {
64
+ /**
65
+ * The name to reference this sheet. It has to be unique.
66
+ * You can then present this sheet globally using its `name`.
67
+ *
68
+ * Example:
69
+ * ```ts
70
+ * <TrueSheet name="my-awesome-sheet">
71
+ * <MyComponent />
72
+ * </TrueSheet>
73
+ * ```
74
+ * ```ts
75
+ * TrueSheet.present('my-awesome-sheet')
76
+ * ```
77
+ */
78
+ name?: string;
79
+ /**
80
+ * The sizes you want the Sheet to support.
81
+ * Maximum of 3 sizes only; collapsed, half-expanded, expanded.
82
+ *
83
+ * Example:
84
+ * ```ts
85
+ * size={['auto', '60%', 'large']}
86
+ * ```
87
+ *
88
+ * @default ['medium', 'large']
89
+ */
90
+ sizes?: SheetSize[];
91
+ /**
92
+ * Specify whether the sheet background is dimmed.
93
+ * Set to `false` to allow interaction with the background components.
94
+ *
95
+ * @platform android
96
+ * @platform ios 15+
97
+ * @default true
98
+ */
99
+ dimmed?: boolean;
100
+ /**
101
+ * Initially present the sheet, after mounting, at a given size index.
102
+ *
103
+ * @note This property is only used during the initial mount.
104
+ * @default -1
105
+ */
106
+ initialIndex?: number;
107
+ /**
108
+ * Specify whether the sheet should animate after mounting.
109
+ * Used with `initialIndex`.
110
+ *
111
+ * @default true
112
+ */
113
+ initialIndexAnimated?: boolean;
114
+ /**
115
+ * The size index that the sheet should start to dim the background.
116
+ * This is ignored if `dimmed` is set to `false`.
117
+ *
118
+ * @default 0
119
+ */
120
+ dimmedIndex?: number;
121
+ /**
122
+ * Prevents interactive dismissal of the Sheet.
123
+ *
124
+ * @default true
125
+ */
126
+ dismissible?: boolean;
127
+ /**
128
+ * Main sheet background color
129
+ *
130
+ * @default white
131
+ */
132
+ backgroundColor?: ColorValue;
133
+ /**
134
+ * The sheet corner radius.
135
+ *
136
+ * @platform android
137
+ * @platform ios 15+
138
+ */
139
+ cornerRadius?: number;
140
+ /**
141
+ * Shows native grabber (or handle) on IOS.
142
+ *
143
+ * @platform ios
144
+ * @default true
145
+ */
146
+ grabber?: boolean;
147
+ /**
148
+ * Grabber props to be used for android grabber or handle.
149
+ *
150
+ * @platform android
151
+ */
152
+ grabberProps?: TrueSheetGrabberProps;
153
+ /**
154
+ * The blur effect style on iOS.
155
+ * Overrides `backgroundColor` if set.
156
+ *
157
+ * @platform ios
158
+ */
159
+ blurTint?: BlurTint;
160
+ /**
161
+ * Optional content container styles.
162
+ */
163
+ contentContainerStyle?: StyleProp<ViewStyle>;
164
+ /**
165
+ * The main scrollable ref that Sheet should handle on IOS.
166
+ *
167
+ * @platform ios
168
+ */
169
+ scrollRef?: RefObject<Component<unknown>>;
170
+ /**
171
+ * Overrides `large` or `100%` height.
172
+ */
173
+ maxHeight?: number;
174
+ /**
175
+ * A component that floats at the bottom of the Sheet.
176
+ */
177
+ FooterComponent?: ComponentType<unknown> | ReactElement;
178
+ /**
179
+ * Determines how the software keyboard will impact the layout of the sheet.
180
+ * Set to `pan` if you're working with `FlatList` with a `TextInput`.
181
+ *
182
+ * @platform android
183
+ * @default resize
184
+ */
185
+ keyboardMode?: 'resize' | 'pan';
186
+ /**
187
+ * Supports edge-to-edge on Android.
188
+ * Turn this on if your app has it enabled.
189
+ *
190
+ * @platform android
191
+ */
192
+ edgeToEdge?: boolean;
193
+ /**
194
+ * This is called when the sheet is ready to present.
195
+ */
196
+ onMount?: () => void;
197
+ /**
198
+ * Called when the Sheet has been presented.
199
+ * Comes with the size info.
200
+ */
201
+ onPresent?: (info: SizeInfo) => void;
202
+ /**
203
+ * Called when the Sheet has been dismissed
204
+ */
205
+ onDismiss?: () => void;
206
+ /**
207
+ * Called when the size of the sheet has changed.
208
+ * Either by dragging or programatically.
209
+ */
210
+ onSizeChange?: (info: SizeInfo) => void;
211
+ }
212
+ //# sourceMappingURL=TrueSheet.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrueSheet.types.d.ts","sourceRoot":"","sources":["../../../../src/TrueSheet.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAE/D,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAChB,OAAO,GACP,MAAM,GACN,SAAS,GACT,YAAY,GACZ,SAAS,GACT,WAAW,GACX,yBAAyB,GACzB,oBAAoB,GACpB,gBAAgB,GAChB,qBAAqB,GACrB,sBAAsB,GACtB,8BAA8B,GAC9B,yBAAyB,GACzB,qBAAqB,GACrB,0BAA0B,GAC1B,2BAA2B,GAC3B,6BAA6B,GAC7B,wBAAwB,GACxB,oBAAoB,GACpB,yBAAyB,GACzB,0BAA0B,CAAA;AAE9B;;;;;GAKG;AACH,MAAM,MAAM,SAAS;AACnB;;;;;GAKG;AACD,MAAM;AAER;;;;;GAKG;GACD,MAAM;AAER;;;;;GAKG;GACD,GAAG,MAAM,GAAG;AAEd;;;;;GAKG;GACD,OAAO;AAET;;;;;GAKG;GACD,QAAQ;AAEV;;;;;GAKG;GACD,OAAO,CAAA;AAEX,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,SAAS,EAAE,CAAA;IAEnB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAE9B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IAErB;;;;OAIG;IACH,eAAe,CAAC,EAAE,UAAU,CAAA;IAE5B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAA;IAEpC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;IAEnB;;OAEG;IACH,qBAAqB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAE5C;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAEzC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,eAAe,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,YAAY,CAAA;IAEvD;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAA;IAE/B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;IAEpC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IAEtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;CACxC"}
@@ -0,0 +1,7 @@
1
+ import type { TrueSheetProps } from './TrueSheet.types';
2
+ interface TrueSheetFooterProps {
3
+ Component?: TrueSheetProps['FooterComponent'];
4
+ }
5
+ export declare const TrueSheetFooter: (props: TrueSheetFooterProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
7
+ //# sourceMappingURL=TrueSheetFooter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrueSheetFooter.d.ts","sourceRoot":"","sources":["../../../../src/TrueSheetFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,UAAU,oBAAoB;IAC5B,SAAS,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;CAC9C;AAED,eAAO,MAAM,eAAe,UAAW,oBAAoB,mDAU1D,CAAA"}
@@ -0,0 +1,39 @@
1
+ import { type ColorValue, type ViewStyle, type StyleProp } from 'react-native';
2
+ export interface TrueSheetGrabberProps {
3
+ /**
4
+ * Is grabber visible.
5
+ * @default true
6
+ */
7
+ visible?: boolean;
8
+ /**
9
+ * Optional style that overrides the default style.
10
+ */
11
+ style?: StyleProp<ViewStyle>;
12
+ /**
13
+ * Grabber color according to M3 specs.
14
+ * @default rgba(73,69,79,0.4)
15
+ */
16
+ color?: ColorValue;
17
+ /**
18
+ * Grabber height according to M3 specs.
19
+ * @default 4
20
+ */
21
+ height?: number;
22
+ /**
23
+ * Grabber top position offset.
24
+ *
25
+ * @default 6
26
+ */
27
+ topOffset?: number;
28
+ /**
29
+ * Grabber width according to M3 specs.
30
+ * @default 32
31
+ */
32
+ width?: number;
33
+ }
34
+ /**
35
+ * Grabber component.
36
+ * Used by defualt for Android but feel free to re-use.
37
+ */
38
+ export declare const TrueSheetGrabber: (props: TrueSheetGrabberProps) => import("react/jsx-runtime").JSX.Element | null;
39
+ //# sourceMappingURL=TrueSheetGrabber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrueSheetGrabber.d.ts","sourceRoot":"","sources":["../../../../src/TrueSheetGrabber.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAQpF,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAE5B;;;OAGG;IACH,KAAK,CAAC,EAAE,UAAU,CAAA;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,UAAW,qBAAqB,mDAiB5D,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const TrueSheetModule: any;
2
+ //# sourceMappingURL=TrueSheetModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrueSheetModule.d.ts","sourceRoot":"","sources":["../../../../src/TrueSheetModule.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,eAAe,KASvB,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './TrueSheet';
2
+ export * from './TrueSheet.types';
3
+ export * from './TrueSheetGrabber';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA"}
package/package.json CHANGED
@@ -1,12 +1,23 @@
1
1
  {
2
2
  "name": "@lodev09/react-native-true-sheet",
3
- "version": "0.13.0",
3
+ "version": "1.0.1",
4
4
  "description": "The true native bottom sheet experience for your React Native Apps.",
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",
5
+ "source": "./src/index.ts",
6
+ "main": "./lib/commonjs/index.js",
7
+ "module": "./lib/module/index.js",
8
+ "types": "./lib/typescript/module/src/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./lib/typescript/module/src/index.d.ts",
13
+ "default": "./lib/module/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./lib/typescript/commonjs/src/index.d.ts",
17
+ "default": "./lib/commonjs/index.js"
18
+ }
19
+ }
20
+ },
10
21
  "files": [
11
22
  "src",
12
23
  "lib",
@@ -14,6 +25,7 @@
14
25
  "ios",
15
26
  "cpp",
16
27
  "*.podspec",
28
+ "react-native.config.js",
17
29
  "!ios/build",
18
30
  "!android/build",
19
31
  "!android/gradle",
@@ -22,17 +34,18 @@
22
34
  "!android/local.properties",
23
35
  "!**/__tests__",
24
36
  "!**/__fixtures__",
37
+ "!**/__mocks__",
25
38
  "!**/.*"
26
39
  ],
27
40
  "scripts": {
28
- "example": "yarn workspace true-sheet-example",
41
+ "example": "yarn workspace react-native-true-sheet-example",
29
42
  "docs": "yarn workspace docs",
30
43
  "test": "jest",
31
- "typecheck": "tsc --noEmit",
44
+ "typecheck": "tsc",
32
45
  "lint": "eslint --fix \"**/*.{js,ts,tsx}\"",
33
46
  "format": "prettier --write \"**/*.{js,ts,tsx}\"",
34
47
  "tidy": "yarn typecheck && yarn lint && yarn format && scripts/swiftlint.sh && scripts/ktlint.sh",
35
- "clean": "del-cli android/build lib && yarn workspace true-sheet-example clean",
48
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
36
49
  "prepare": "bob build",
37
50
  "release": "yarn tidy && release-it"
38
51
  },
@@ -58,30 +71,27 @@
58
71
  "registry": "https://registry.npmjs.org/"
59
72
  },
60
73
  "devDependencies": {
61
- "@commitlint/config-conventional": "^19.0.3",
62
- "@evilmartians/lefthook": "^1.6.5",
63
- "@react-native/eslint-config": "^0.74.83",
64
- "@release-it/conventional-changelog": "^8.0.1",
65
- "@types/jest": "^29.5.12",
66
- "@types/react": "^18.2.64",
67
- "@typescript-eslint/eslint-plugin": "^7.1.1",
68
- "@typescript-eslint/parser": "^7.1.1",
69
- "commitlint": "^19.0.3",
74
+ "@commitlint/config-conventional": "^17.0.2",
75
+ "@evilmartians/lefthook": "^1.5.0",
76
+ "@react-native-community/cli": "15.0.1",
77
+ "@react-native/eslint-config": "^0.73.1",
78
+ "@types/jest": "^29.5.5",
79
+ "@types/react": "^18.2.44",
80
+ "commitlint": "^17.0.2",
70
81
  "del-cli": "^5.1.0",
71
- "eslint": "^8.57.0",
72
- "eslint-config-prettier": "^9.1.0",
73
- "eslint-config-standard": "^17.1.0",
74
- "eslint-plugin-import": "^2.29.1",
75
- "eslint-plugin-n": "^16.6.2",
76
- "eslint-plugin-prettier": "^5.1.3",
77
- "eslint-plugin-promise": "^6.1.1",
82
+ "eslint": "^8.51.0",
83
+ "eslint-config-prettier": "^9.0.0",
84
+ "eslint-plugin-prettier": "^5.0.1",
78
85
  "jest": "^29.7.0",
79
- "prettier": "^3.2.5",
80
- "react": "^18.2.0",
81
- "react-native": "^0.74.1",
82
- "react-native-builder-bob": "^0.23.2",
83
- "release-it": "^17.1.1",
84
- "typescript": "~5.3.3"
86
+ "prettier": "^3.0.3",
87
+ "react": "18.3.1",
88
+ "react-native": "0.76.3",
89
+ "react-native-builder-bob": "^0.33.3",
90
+ "release-it": "^17.10.0",
91
+ "typescript": "^5.2.2"
92
+ },
93
+ "resolutions": {
94
+ "@types/react": "^18.2.44"
85
95
  },
86
96
  "peerDependencies": {
87
97
  "react": "*",
@@ -91,13 +101,13 @@
91
101
  "example",
92
102
  "docs"
93
103
  ],
94
- "packageManager": "yarn@4.2.2",
104
+ "packageManager": "yarn@3.6.1",
95
105
  "jest": {
96
106
  "preset": "react-native",
97
107
  "modulePathIgnorePatterns": [
98
108
  "<rootDir>/example/node_modules",
99
- "<rootDir>/docs/node_modules",
100
109
  "<rootDir>/lib/",
110
+ "<rootDir>/docs/node_modules",
101
111
  "<rootDir>/docs/build"
102
112
  ]
103
113
  },
@@ -121,44 +131,34 @@
121
131
  "issue": ":rocket: _This issue has been resolved in v${version}. See [${releaseName}](${releaseUrl}) for release notes._",
122
132
  "pr": ":rocket: _This pull request is included in v${version}. See [${releaseName}](${releaseUrl}) for release notes._"
123
133
  }
124
- },
125
- "plugins": {
126
- "@release-it/conventional-changelog": {
127
- "preset": "angular"
128
- }
129
134
  }
130
135
  },
131
136
  "eslintConfig": {
132
137
  "root": true,
133
138
  "extends": [
134
- "plugin:@typescript-eslint/recommended",
135
- "eslint:recommended",
136
- "plugin:react/recommended",
137
- "plugin:react-native/all",
138
- "standard",
139
+ "@react-native",
139
140
  "prettier"
140
141
  ],
141
- "globals": {
142
- "it": false
143
- },
144
142
  "rules": {
145
- "@typescript-eslint/no-var-requires": 0,
146
- "@typescript-eslint/no-unused-vars": [
143
+ "react/react-in-jsx-scope": "off",
144
+ "prettier/prettier": [
147
145
  "error",
148
146
  {
149
- "argsIgnorePattern": "^_",
150
- "varsIgnorePattern": "^_"
147
+ "quoteProps": "consistent",
148
+ "singleQuote": true,
149
+ "tabWidth": 2,
150
+ "trailingComma": "es5",
151
+ "useTabs": false,
152
+ "printWidth": 100,
153
+ "semi": false
151
154
  }
152
- ],
153
- "no-unused-vars": 0
154
- },
155
- "settings": {
156
- "react": {
157
- "pragma": "React",
158
- "version": "detect"
159
- }
155
+ ]
160
156
  }
161
157
  },
158
+ "eslintIgnore": [
159
+ "node_modules/",
160
+ "lib/"
161
+ ],
162
162
  "prettier": {
163
163
  "quoteProps": "consistent",
164
164
  "singleQuote": true,
@@ -169,18 +169,33 @@
169
169
  "semi": false
170
170
  },
171
171
  "react-native-builder-bob": {
172
- "exclude": "**/{__tests__,__fixtures__}/**",
173
172
  "source": "src",
174
173
  "output": "lib",
175
174
  "targets": [
176
- "commonjs",
177
- "module",
175
+ [
176
+ "commonjs",
177
+ {
178
+ "esm": true
179
+ }
180
+ ],
181
+ [
182
+ "module",
183
+ {
184
+ "esm": true
185
+ }
186
+ ],
178
187
  [
179
188
  "typescript",
180
189
  {
181
- "project": "tsconfig.build.json"
190
+ "project": "tsconfig.build.json",
191
+ "esm": true
182
192
  }
183
193
  ]
184
194
  ]
195
+ },
196
+ "create-react-native-library": {
197
+ "type": "view-legacy",
198
+ "languages": "kotlin-swift",
199
+ "version": "0.44.3"
185
200
  }
186
201
  }
@@ -4,14 +4,14 @@ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
4
  folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
5
 
6
6
  Pod::Spec.new do |s|
7
- s.name = "TrueSheet"
7
+ s.name = "react-native-true-sheet"
8
8
  s.version = package["version"]
9
9
  s.summary = package["description"]
10
10
  s.homepage = package["homepage"]
11
11
  s.license = package["license"]
12
12
  s.authors = package["author"]
13
13
 
14
- s.platforms = { :ios => "13.4" }
14
+ s.platforms = { :ios => min_ios_version_supported }
15
15
  s.source = { :git => "https://github.com/lodev09/react-native-true-sheet.git", :tag => "#{s.version}" }
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
@@ -21,21 +21,22 @@ Pod::Spec.new do |s|
21
21
  if respond_to?(:install_modules_dependencies, true)
22
22
  install_modules_dependencies(s)
23
23
  else
24
- s.dependency "React-Core"
24
+ s.dependency "React-Core"
25
25
 
26
- # Don't install the dependencies when we run `pod install` in the old architecture.
27
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
28
- s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
29
- s.pod_target_xcconfig = {
30
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
31
- "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
32
- "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
33
- }
34
- s.dependency "React-RCTFabric"
35
- s.dependency "React-Codegen"
36
- s.dependency "RCT-Folly"
37
- s.dependency "RCTRequired"
38
- s.dependency "RCTTypeSafety"
39
- end
40
- end
26
+ # Don't install the dependencies when we run `pod install` in the old architecture.
27
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
28
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
29
+ s.pod_target_xcconfig = {
30
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
31
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
32
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
33
+ }
34
+ s.dependency "React-RCTFabric"
35
+ s.dependency "React-Codegen"
36
+ s.dependency "RCT-Folly"
37
+ s.dependency "RCTRequired"
38
+ s.dependency "RCTTypeSafety"
39
+ s.dependency "ReactCommon/turbomodule/core"
40
+ end
41
+ end
41
42
  end
package/src/TrueSheet.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React, { PureComponent, Component, type RefObject, createRef, type ReactNode } from 'react'
1
+ import { PureComponent, Component, type RefObject, createRef, type ReactNode } from 'react'
2
2
  import {
3
3
  requireNativeComponent,
4
4
  Platform,
@@ -22,17 +22,23 @@ const LINKING_ERROR =
22
22
  '- You rebuilt the app after installing the package\n' +
23
23
  '- You are not using Expo Go\n'
24
24
 
25
+ type ContainerSizeChangeEvent = NativeSyntheticEvent<{ width: number; height: number }>
26
+ type SizeChangeEvent = NativeSyntheticEvent<SizeInfo>
27
+
25
28
  interface TrueSheetNativeViewProps extends Omit<TrueSheetProps, 'onPresent' | 'onSizeChange'> {
26
29
  contentHeight?: number
27
30
  footerHeight?: number
28
31
  scrollableHandle: number | null
29
- onPresent: (event: NativeSyntheticEvent<SizeInfo>) => void
30
- onSizeChange: (event: NativeSyntheticEvent<SizeInfo>) => void
32
+ onPresent: (event: SizeChangeEvent) => void
33
+ onSizeChange: (event: SizeChangeEvent) => void
34
+ onContainerSizeChange: (event: ContainerSizeChangeEvent) => void
31
35
  }
32
36
 
33
37
  type NativeRef = Component<TrueSheetNativeViewProps> & Readonly<NativeMethods>
34
38
 
35
39
  interface TrueSheetState {
40
+ containerWidth?: number
41
+ containerHeight?: number
36
42
  contentHeight?: number
37
43
  footerHeight?: number
38
44
  scrollableHandle: number | null
@@ -65,8 +71,11 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
65
71
  this.onSizeChange = this.onSizeChange.bind(this)
66
72
  this.onContentLayout = this.onContentLayout.bind(this)
67
73
  this.onFooterLayout = this.onFooterLayout.bind(this)
74
+ this.onContainerSizeChange = this.onContainerSizeChange.bind(this)
68
75
 
69
76
  this.state = {
77
+ containerWidth: undefined,
78
+ containerHeight: undefined,
70
79
  contentHeight: undefined,
71
80
  footerHeight: undefined,
72
81
  scrollableHandle: null,
@@ -136,11 +145,18 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
136
145
  })
137
146
  }
138
147
 
139
- private onSizeChange(event: NativeSyntheticEvent<SizeInfo>): void {
148
+ private onSizeChange(event: SizeChangeEvent): void {
140
149
  this.props.onSizeChange?.(event.nativeEvent)
141
150
  }
142
151
 
143
- private onPresent(event: NativeSyntheticEvent<SizeInfo>): void {
152
+ private onContainerSizeChange(event: ContainerSizeChangeEvent): void {
153
+ this.setState({
154
+ containerWidth: event.nativeEvent.width,
155
+ containerHeight: event.nativeEvent.height,
156
+ })
157
+ }
158
+
159
+ private onPresent(event: SizeChangeEvent): void {
144
160
  this.props.onPresent?.(event.nativeEvent)
145
161
  }
146
162
 
@@ -209,6 +225,7 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
209
225
  grabber = true,
210
226
  dimmed = true,
211
227
  initialIndexAnimated = true,
228
+ edgeToEdge = false,
212
229
  keyboardMode = 'resize',
213
230
  initialIndex,
214
231
  dimmedIndex,
@@ -236,6 +253,7 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
236
253
  grabber={grabber}
237
254
  dimmed={dimmed}
238
255
  dimmedIndex={dimmedIndex}
256
+ edgeToEdge={edgeToEdge}
239
257
  initialIndex={initialIndex}
240
258
  initialIndexAnimated={initialIndexAnimated}
241
259
  keyboardMode={keyboardMode}
@@ -245,6 +263,7 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
245
263
  onPresent={this.onPresent}
246
264
  onDismiss={this.onDismiss}
247
265
  onSizeChange={this.onSizeChange}
266
+ onContainerSizeChange={this.onContainerSizeChange}
248
267
  >
249
268
  <View
250
269
  collapsable={false}
@@ -254,6 +273,11 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
254
273
  borderTopLeftRadius: cornerRadius,
255
274
  borderTopRightRadius: cornerRadius,
256
275
 
276
+ // Update the width on JS side.
277
+ // New Arch interop does not support updating it in native :/
278
+ width: this.state.containerWidth,
279
+ height: this.state.containerHeight,
280
+
257
281
  // Remove backgroundColor if `blurTint` is set on iOS
258
282
  backgroundColor: Platform.select({
259
283
  ios: blurTint ? undefined : backgroundColor,