@lodev09/react-native-true-sheet 2.0.5 → 4.0.0-beta.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 (194) hide show
  1. package/README.md +36 -8
  2. package/RNTrueSheet.podspec +20 -0
  3. package/android/build.gradle +26 -14
  4. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerView.kt +108 -0
  5. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerViewManager.kt +21 -0
  6. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentView.kt +46 -0
  7. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentViewManager.kt +21 -0
  8. package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterView.kt +47 -0
  9. package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterViewManager.kt +21 -0
  10. package/android/src/main/java/com/lodev09/truesheet/TrueSheetModule.kt +165 -0
  11. package/android/src/main/java/com/lodev09/truesheet/TrueSheetPackage.kt +36 -4
  12. package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +257 -299
  13. package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +855 -0
  14. package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +104 -82
  15. package/android/src/main/java/com/lodev09/truesheet/events/DetentChangeEvent.kt +26 -0
  16. package/android/src/main/java/com/lodev09/truesheet/events/DidDismissEvent.kt +20 -0
  17. package/android/src/main/java/com/lodev09/truesheet/events/DidPresentEvent.kt +26 -0
  18. package/android/src/main/java/com/lodev09/truesheet/events/DragBeginEvent.kt +26 -0
  19. package/android/src/main/java/com/lodev09/truesheet/events/DragChangeEvent.kt +26 -0
  20. package/android/src/main/java/com/lodev09/truesheet/events/DragEndEvent.kt +26 -0
  21. package/android/src/main/java/com/lodev09/truesheet/events/MountEvent.kt +20 -0
  22. package/android/src/main/java/com/lodev09/truesheet/events/PositionChangeEvent.kt +32 -0
  23. package/android/src/main/java/com/lodev09/truesheet/events/SizeChangeEvent.kt +27 -0
  24. package/android/src/main/java/com/lodev09/truesheet/events/WillDismissEvent.kt +20 -0
  25. package/android/src/main/java/com/lodev09/truesheet/events/WillPresentEvent.kt +26 -0
  26. package/android/src/main/java/com/lodev09/truesheet/{core/Utils.kt → utils/ScreenUtils.kt} +47 -17
  27. package/android/src/main/res/values/styles.xml +8 -0
  28. package/ios/TrueSheetComponentDescriptor.h +24 -0
  29. package/ios/TrueSheetContainerView.h +47 -0
  30. package/ios/TrueSheetContainerView.mm +117 -0
  31. package/ios/TrueSheetContentView.h +37 -0
  32. package/ios/TrueSheetContentView.mm +114 -0
  33. package/ios/TrueSheetFooterView.h +27 -0
  34. package/ios/TrueSheetFooterView.mm +101 -0
  35. package/ios/TrueSheetModule.h +44 -0
  36. package/ios/TrueSheetModule.mm +133 -0
  37. package/ios/TrueSheetView.h +53 -0
  38. package/ios/TrueSheetView.mm +433 -0
  39. package/ios/TrueSheetViewController.h +53 -0
  40. package/ios/TrueSheetViewController.mm +649 -0
  41. package/ios/events/OnDetentChangeEvent.h +28 -0
  42. package/ios/events/OnDetentChangeEvent.mm +30 -0
  43. package/ios/events/OnDidDismissEvent.h +26 -0
  44. package/ios/events/OnDidDismissEvent.mm +25 -0
  45. package/ios/events/OnDidPresentEvent.h +28 -0
  46. package/ios/events/OnDidPresentEvent.mm +30 -0
  47. package/ios/events/OnDragBeginEvent.h +28 -0
  48. package/ios/events/OnDragBeginEvent.mm +30 -0
  49. package/ios/events/OnDragChangeEvent.h +28 -0
  50. package/ios/events/OnDragChangeEvent.mm +30 -0
  51. package/ios/events/OnDragEndEvent.h +28 -0
  52. package/ios/events/OnDragEndEvent.mm +30 -0
  53. package/ios/events/OnMountEvent.h +26 -0
  54. package/ios/events/OnMountEvent.mm +25 -0
  55. package/ios/events/OnPositionChangeEvent.h +29 -0
  56. package/ios/events/OnPositionChangeEvent.mm +32 -0
  57. package/ios/events/OnSizeChangeEvent.h +28 -0
  58. package/ios/events/OnSizeChangeEvent.mm +30 -0
  59. package/ios/events/OnWillDismissEvent.h +26 -0
  60. package/ios/events/OnWillDismissEvent.mm +25 -0
  61. package/ios/events/OnWillPresentEvent.h +28 -0
  62. package/ios/events/OnWillPresentEvent.mm +30 -0
  63. package/ios/utils/GestureUtil.h +25 -0
  64. package/ios/utils/GestureUtil.mm +26 -0
  65. package/ios/utils/LayoutUtil.h +44 -0
  66. package/ios/utils/LayoutUtil.mm +50 -0
  67. package/ios/utils/WindowUtil.h +27 -0
  68. package/ios/utils/WindowUtil.mm +42 -0
  69. package/lib/module/TrueSheet.js +231 -135
  70. package/lib/module/TrueSheet.js.map +1 -1
  71. package/lib/module/TrueSheetGrabber.js +16 -14
  72. package/lib/module/TrueSheetGrabber.js.map +1 -1
  73. package/lib/module/fabric/TrueSheetContainerViewNativeComponent.ts +8 -0
  74. package/lib/module/fabric/TrueSheetContentViewNativeComponent.ts +8 -0
  75. package/lib/module/fabric/TrueSheetFooterViewNativeComponent.ts +8 -0
  76. package/lib/module/fabric/TrueSheetViewNativeComponent.ts +63 -0
  77. package/lib/module/index.js +1 -0
  78. package/lib/module/index.js.map +1 -1
  79. package/lib/module/reanimated/ReanimatedTrueSheet.js +87 -0
  80. package/lib/module/reanimated/ReanimatedTrueSheet.js.map +1 -0
  81. package/lib/module/reanimated/ReanimatedTrueSheetProvider.js +72 -0
  82. package/lib/module/reanimated/ReanimatedTrueSheetProvider.js.map +1 -0
  83. package/lib/module/reanimated/index.js +6 -0
  84. package/lib/module/reanimated/index.js.map +1 -0
  85. package/lib/module/reanimated/useReanimatedPositionChangeHandler.js +19 -0
  86. package/lib/module/reanimated/useReanimatedPositionChangeHandler.js.map +1 -0
  87. package/lib/module/specs/NativeTrueSheetModule.js +12 -0
  88. package/lib/module/specs/NativeTrueSheetModule.js.map +1 -0
  89. package/lib/typescript/package.json +1 -0
  90. package/lib/typescript/src/TrueSheet.d.ts +79 -0
  91. package/lib/typescript/src/TrueSheet.d.ts.map +1 -0
  92. package/lib/typescript/src/TrueSheet.types.d.ts +260 -0
  93. package/lib/typescript/src/TrueSheet.types.d.ts.map +1 -0
  94. package/lib/typescript/{commonjs/src → src}/TrueSheetGrabber.d.ts +1 -1
  95. package/lib/typescript/src/TrueSheetGrabber.d.ts.map +1 -0
  96. package/lib/typescript/src/fabric/TrueSheetContainerViewNativeComponent.d.ts +6 -0
  97. package/lib/typescript/src/fabric/TrueSheetContainerViewNativeComponent.d.ts.map +1 -0
  98. package/lib/typescript/src/fabric/TrueSheetContentViewNativeComponent.d.ts +6 -0
  99. package/lib/typescript/src/fabric/TrueSheetContentViewNativeComponent.d.ts.map +1 -0
  100. package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts +6 -0
  101. package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts.map +1 -0
  102. package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts +44 -0
  103. package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts.map +1 -0
  104. package/lib/typescript/{commonjs/src → src}/index.d.ts +1 -0
  105. package/lib/typescript/src/index.d.ts.map +1 -0
  106. package/lib/typescript/src/reanimated/ReanimatedTrueSheet.d.ts +43 -0
  107. package/lib/typescript/src/reanimated/ReanimatedTrueSheet.d.ts.map +1 -0
  108. package/lib/typescript/src/reanimated/ReanimatedTrueSheetProvider.d.ts +57 -0
  109. package/lib/typescript/src/reanimated/ReanimatedTrueSheetProvider.d.ts.map +1 -0
  110. package/lib/typescript/src/reanimated/index.d.ts +4 -0
  111. package/lib/typescript/src/reanimated/index.d.ts.map +1 -0
  112. package/lib/typescript/src/reanimated/useReanimatedPositionChangeHandler.d.ts +6 -0
  113. package/lib/typescript/src/reanimated/useReanimatedPositionChangeHandler.d.ts.map +1 -0
  114. package/lib/typescript/src/specs/NativeTrueSheetModule.d.ts +34 -0
  115. package/lib/typescript/src/specs/NativeTrueSheetModule.d.ts.map +1 -0
  116. package/package.json +104 -75
  117. package/react-native.config.js +17 -0
  118. package/src/TrueSheet.tsx +285 -188
  119. package/src/TrueSheet.types.ts +119 -106
  120. package/src/TrueSheetGrabber.tsx +29 -28
  121. package/src/__mocks__/index.js +60 -12
  122. package/src/fabric/TrueSheetContainerViewNativeComponent.ts +8 -0
  123. package/src/fabric/TrueSheetContentViewNativeComponent.ts +8 -0
  124. package/src/fabric/TrueSheetFooterViewNativeComponent.ts +8 -0
  125. package/src/fabric/TrueSheetViewNativeComponent.ts +63 -0
  126. package/src/index.ts +4 -3
  127. package/src/reanimated/ReanimatedTrueSheet.tsx +95 -0
  128. package/src/reanimated/ReanimatedTrueSheetProvider.tsx +92 -0
  129. package/src/reanimated/index.ts +3 -0
  130. package/src/reanimated/useReanimatedPositionChangeHandler.ts +26 -0
  131. package/src/specs/NativeTrueSheetModule.ts +38 -0
  132. package/TrueSheet.podspec +0 -49
  133. package/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt +0 -400
  134. package/android/src/main/java/com/lodev09/truesheet/TrueSheetEvent.kt +0 -22
  135. package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewModule.kt +0 -63
  136. package/android/src/main/java/com/lodev09/truesheet/core/KeyboardManager.kt +0 -58
  137. package/android/src/main/java/com/lodev09/truesheet/core/RootSheetView.kt +0 -102
  138. package/ios/Extensions/UIBlurEffect+withTint.swift +0 -62
  139. package/ios/Extensions/UIView+pinTo.swift +0 -74
  140. package/ios/Extensions/UIViewController+detentForSize.swift +0 -134
  141. package/ios/TrueSheet-Bridging-Header.h +0 -14
  142. package/ios/TrueSheetEvent.swift +0 -48
  143. package/ios/TrueSheetView.swift +0 -461
  144. package/ios/TrueSheetViewController.swift +0 -275
  145. package/ios/TrueSheetViewManager.m +0 -53
  146. package/ios/TrueSheetViewManager.swift +0 -48
  147. package/ios/Utils/Logger.swift +0 -39
  148. package/ios/Utils/Promise.swift +0 -25
  149. package/lib/commonjs/TrueSheet.js +0 -258
  150. package/lib/commonjs/TrueSheet.js.map +0 -1
  151. package/lib/commonjs/TrueSheet.types.js +0 -6
  152. package/lib/commonjs/TrueSheet.types.js.map +0 -1
  153. package/lib/commonjs/TrueSheetFooter.js +0 -19
  154. package/lib/commonjs/TrueSheetFooter.js.map +0 -1
  155. package/lib/commonjs/TrueSheetGrabber.js +0 -54
  156. package/lib/commonjs/TrueSheetGrabber.js.map +0 -1
  157. package/lib/commonjs/TrueSheetModule.js +0 -19
  158. package/lib/commonjs/TrueSheetModule.js.map +0 -1
  159. package/lib/commonjs/__mocks__/index.js +0 -52
  160. package/lib/commonjs/__mocks__/index.js.map +0 -1
  161. package/lib/commonjs/index.js +0 -39
  162. package/lib/commonjs/index.js.map +0 -1
  163. package/lib/module/TrueSheetFooter.js +0 -14
  164. package/lib/module/TrueSheetFooter.js.map +0 -1
  165. package/lib/module/TrueSheetModule.js +0 -15
  166. package/lib/module/TrueSheetModule.js.map +0 -1
  167. package/lib/module/__mocks__/index.js +0 -21
  168. package/lib/module/__mocks__/index.js.map +0 -1
  169. package/lib/typescript/commonjs/package.json +0 -1
  170. package/lib/typescript/commonjs/src/TrueSheet.d.ts +0 -70
  171. package/lib/typescript/commonjs/src/TrueSheet.d.ts.map +0 -1
  172. package/lib/typescript/commonjs/src/TrueSheet.types.d.ts +0 -241
  173. package/lib/typescript/commonjs/src/TrueSheet.types.d.ts.map +0 -1
  174. package/lib/typescript/commonjs/src/TrueSheetFooter.d.ts +0 -7
  175. package/lib/typescript/commonjs/src/TrueSheetFooter.d.ts.map +0 -1
  176. package/lib/typescript/commonjs/src/TrueSheetGrabber.d.ts.map +0 -1
  177. package/lib/typescript/commonjs/src/TrueSheetModule.d.ts +0 -2
  178. package/lib/typescript/commonjs/src/TrueSheetModule.d.ts.map +0 -1
  179. package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
  180. package/lib/typescript/module/src/TrueSheet.d.ts +0 -70
  181. package/lib/typescript/module/src/TrueSheet.d.ts.map +0 -1
  182. package/lib/typescript/module/src/TrueSheet.types.d.ts +0 -241
  183. package/lib/typescript/module/src/TrueSheet.types.d.ts.map +0 -1
  184. package/lib/typescript/module/src/TrueSheetFooter.d.ts +0 -7
  185. package/lib/typescript/module/src/TrueSheetFooter.d.ts.map +0 -1
  186. package/lib/typescript/module/src/TrueSheetGrabber.d.ts +0 -39
  187. package/lib/typescript/module/src/TrueSheetGrabber.d.ts.map +0 -1
  188. package/lib/typescript/module/src/TrueSheetModule.d.ts +0 -2
  189. package/lib/typescript/module/src/TrueSheetModule.d.ts.map +0 -1
  190. package/lib/typescript/module/src/index.d.ts +0 -4
  191. package/lib/typescript/module/src/index.d.ts.map +0 -1
  192. package/src/TrueSheetFooter.tsx +0 -17
  193. package/src/TrueSheetModule.ts +0 -19
  194. /package/lib/{typescript/module → module}/package.json +0 -0
@@ -0,0 +1,26 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import <Foundation/Foundation.h>
12
+ #import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
13
+
14
+ using namespace facebook::react;
15
+
16
+ NS_ASSUME_NONNULL_BEGIN
17
+
18
+ @interface OnDidDismissEvent : NSObject
19
+
20
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter;
21
+
22
+ @end
23
+
24
+ NS_ASSUME_NONNULL_END
25
+
26
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,25 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import "OnDidDismissEvent.h"
12
+
13
+ @implementation OnDidDismissEvent
14
+
15
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter {
16
+ if (!eventEmitter)
17
+ return;
18
+
19
+ auto emitter = std::static_pointer_cast<TrueSheetViewEventEmitter const>(eventEmitter);
20
+ emitter->onDidDismiss({});
21
+ }
22
+
23
+ @end
24
+
25
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,28 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import <Foundation/Foundation.h>
12
+ #import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
13
+
14
+ using namespace facebook::react;
15
+
16
+ NS_ASSUME_NONNULL_BEGIN
17
+
18
+ @interface OnDidPresentEvent : NSObject
19
+
20
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
21
+ index:(NSInteger)index
22
+ position:(CGFloat)position;
23
+
24
+ @end
25
+
26
+ NS_ASSUME_NONNULL_END
27
+
28
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,30 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import "OnDidPresentEvent.h"
12
+
13
+ @implementation OnDidPresentEvent
14
+
15
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
16
+ index:(NSInteger)index
17
+ position:(CGFloat)position {
18
+ if (!eventEmitter)
19
+ return;
20
+
21
+ auto emitter = std::static_pointer_cast<TrueSheetViewEventEmitter const>(eventEmitter);
22
+ TrueSheetViewEventEmitter::OnDidPresent event;
23
+ event.index = static_cast<int>(index);
24
+ event.position = static_cast<double>(position);
25
+ emitter->onDidPresent(event);
26
+ }
27
+
28
+ @end
29
+
30
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,28 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import <Foundation/Foundation.h>
12
+ #import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
13
+
14
+ using namespace facebook::react;
15
+
16
+ NS_ASSUME_NONNULL_BEGIN
17
+
18
+ @interface OnDragBeginEvent : NSObject
19
+
20
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
21
+ index:(NSInteger)index
22
+ position:(CGFloat)position;
23
+
24
+ @end
25
+
26
+ NS_ASSUME_NONNULL_END
27
+
28
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,30 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import "OnDragBeginEvent.h"
12
+
13
+ @implementation OnDragBeginEvent
14
+
15
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
16
+ index:(NSInteger)index
17
+ position:(CGFloat)position {
18
+ if (!eventEmitter)
19
+ return;
20
+
21
+ auto emitter = std::static_pointer_cast<TrueSheetViewEventEmitter const>(eventEmitter);
22
+ TrueSheetViewEventEmitter::OnDragBegin event;
23
+ event.index = static_cast<int>(index);
24
+ event.position = static_cast<double>(position);
25
+ emitter->onDragBegin(event);
26
+ }
27
+
28
+ @end
29
+
30
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,28 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import <Foundation/Foundation.h>
12
+ #import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
13
+
14
+ using namespace facebook::react;
15
+
16
+ NS_ASSUME_NONNULL_BEGIN
17
+
18
+ @interface OnDragChangeEvent : NSObject
19
+
20
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
21
+ index:(NSInteger)index
22
+ position:(CGFloat)position;
23
+
24
+ @end
25
+
26
+ NS_ASSUME_NONNULL_END
27
+
28
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,30 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import "OnDragChangeEvent.h"
12
+
13
+ @implementation OnDragChangeEvent
14
+
15
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
16
+ index:(NSInteger)index
17
+ position:(CGFloat)position {
18
+ if (!eventEmitter)
19
+ return;
20
+
21
+ auto emitter = std::static_pointer_cast<TrueSheetViewEventEmitter const>(eventEmitter);
22
+ TrueSheetViewEventEmitter::OnDragChange event;
23
+ event.index = static_cast<int>(index);
24
+ event.position = static_cast<double>(position);
25
+ emitter->onDragChange(event);
26
+ }
27
+
28
+ @end
29
+
30
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,28 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import <Foundation/Foundation.h>
12
+ #import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
13
+
14
+ using namespace facebook::react;
15
+
16
+ NS_ASSUME_NONNULL_BEGIN
17
+
18
+ @interface OnDragEndEvent : NSObject
19
+
20
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
21
+ index:(NSInteger)index
22
+ position:(CGFloat)position;
23
+
24
+ @end
25
+
26
+ NS_ASSUME_NONNULL_END
27
+
28
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,30 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import "OnDragEndEvent.h"
12
+
13
+ @implementation OnDragEndEvent
14
+
15
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
16
+ index:(NSInteger)index
17
+ position:(CGFloat)position {
18
+ if (!eventEmitter)
19
+ return;
20
+
21
+ auto emitter = std::static_pointer_cast<TrueSheetViewEventEmitter const>(eventEmitter);
22
+ TrueSheetViewEventEmitter::OnDragEnd event;
23
+ event.index = static_cast<int>(index);
24
+ event.position = static_cast<double>(position);
25
+ emitter->onDragEnd(event);
26
+ }
27
+
28
+ @end
29
+
30
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,26 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import <Foundation/Foundation.h>
12
+ #import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
13
+
14
+ using namespace facebook::react;
15
+
16
+ NS_ASSUME_NONNULL_BEGIN
17
+
18
+ @interface OnMountEvent : NSObject
19
+
20
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter;
21
+
22
+ @end
23
+
24
+ NS_ASSUME_NONNULL_END
25
+
26
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,25 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import "OnMountEvent.h"
12
+
13
+ @implementation OnMountEvent
14
+
15
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter {
16
+ if (!eventEmitter)
17
+ return;
18
+
19
+ auto emitter = std::static_pointer_cast<TrueSheetViewEventEmitter const>(eventEmitter);
20
+ emitter->onMount({});
21
+ }
22
+
23
+ @end
24
+
25
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,29 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import <Foundation/Foundation.h>
12
+ #import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
13
+
14
+ using namespace facebook::react;
15
+
16
+ NS_ASSUME_NONNULL_BEGIN
17
+
18
+ @interface OnPositionChangeEvent : NSObject
19
+
20
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
21
+ index:(NSInteger)index
22
+ position:(CGFloat)position
23
+ transitioning:(BOOL)transitioning;
24
+
25
+ @end
26
+
27
+ NS_ASSUME_NONNULL_END
28
+
29
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,32 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import "OnPositionChangeEvent.h"
12
+
13
+ @implementation OnPositionChangeEvent
14
+
15
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
16
+ index:(NSInteger)index
17
+ position:(CGFloat)position
18
+ transitioning:(BOOL)transitioning {
19
+ if (!eventEmitter)
20
+ return;
21
+
22
+ auto emitter = std::static_pointer_cast<TrueSheetViewEventEmitter const>(eventEmitter);
23
+ TrueSheetViewEventEmitter::OnPositionChange event;
24
+ event.index = static_cast<int>(index);
25
+ event.position = static_cast<double>(position);
26
+ event.transitioning = static_cast<bool>(transitioning);
27
+ emitter->onPositionChange(event);
28
+ }
29
+
30
+ @end
31
+
32
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,28 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import <Foundation/Foundation.h>
12
+ #import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
13
+
14
+ using namespace facebook::react;
15
+
16
+ NS_ASSUME_NONNULL_BEGIN
17
+
18
+ @interface OnSizeChangeEvent : NSObject
19
+
20
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
21
+ width:(CGFloat)width
22
+ height:(CGFloat)height;
23
+
24
+ @end
25
+
26
+ NS_ASSUME_NONNULL_END
27
+
28
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,30 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import "OnSizeChangeEvent.h"
12
+
13
+ @implementation OnSizeChangeEvent
14
+
15
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
16
+ width:(CGFloat)width
17
+ height:(CGFloat)height {
18
+ if (!eventEmitter)
19
+ return;
20
+
21
+ auto emitter = std::static_pointer_cast<TrueSheetViewEventEmitter const>(eventEmitter);
22
+ TrueSheetViewEventEmitter::OnSizeChange event;
23
+ event.width = static_cast<double>(width);
24
+ event.height = static_cast<double>(height);
25
+ emitter->onSizeChange(event);
26
+ }
27
+
28
+ @end
29
+
30
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,26 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import <Foundation/Foundation.h>
12
+ #import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
13
+
14
+ using namespace facebook::react;
15
+
16
+ NS_ASSUME_NONNULL_BEGIN
17
+
18
+ @interface OnWillDismissEvent : NSObject
19
+
20
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter;
21
+
22
+ @end
23
+
24
+ NS_ASSUME_NONNULL_END
25
+
26
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,25 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import "OnWillDismissEvent.h"
12
+
13
+ @implementation OnWillDismissEvent
14
+
15
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter {
16
+ if (!eventEmitter)
17
+ return;
18
+
19
+ auto emitter = std::static_pointer_cast<TrueSheetViewEventEmitter const>(eventEmitter);
20
+ emitter->onWillDismiss({});
21
+ }
22
+
23
+ @end
24
+
25
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,28 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import <Foundation/Foundation.h>
12
+ #import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
13
+
14
+ using namespace facebook::react;
15
+
16
+ NS_ASSUME_NONNULL_BEGIN
17
+
18
+ @interface OnWillPresentEvent : NSObject
19
+
20
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
21
+ index:(NSInteger)index
22
+ position:(CGFloat)position;
23
+
24
+ @end
25
+
26
+ NS_ASSUME_NONNULL_END
27
+
28
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,30 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import "OnWillPresentEvent.h"
12
+
13
+ @implementation OnWillPresentEvent
14
+
15
+ + (void)emit:(std::shared_ptr<const facebook::react::EventEmitter>)eventEmitter
16
+ index:(NSInteger)index
17
+ position:(CGFloat)position {
18
+ if (!eventEmitter)
19
+ return;
20
+
21
+ auto emitter = std::static_pointer_cast<TrueSheetViewEventEmitter const>(eventEmitter);
22
+ TrueSheetViewEventEmitter::OnWillPresent event;
23
+ event.index = static_cast<int>(index);
24
+ event.position = static_cast<double>(position);
25
+ emitter->onWillPresent(event);
26
+ }
27
+
28
+ @end
29
+
30
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,25 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #import <UIKit/UIKit.h>
10
+
11
+ NS_ASSUME_NONNULL_BEGIN
12
+
13
+ @interface GestureUtil : NSObject
14
+
15
+ /**
16
+ * Attaches a pan gesture handler to all pan gesture recognizers on a view
17
+ * @param view The view whose pan gesture recognizers to attach to
18
+ * @param target The target object that will handle the gesture
19
+ * @param selector The selector to call when the gesture is triggered
20
+ */
21
+ + (void)attachPanGestureHandler:(UIView *)view target:(id)target selector:(SEL)selector;
22
+
23
+ @end
24
+
25
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,26 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #import "GestureUtil.h"
10
+
11
+ @implementation GestureUtil
12
+
13
+ + (void)attachPanGestureHandler:(UIView *)view target:(id)target selector:(SEL)selector {
14
+ if (!view || !target || !selector) {
15
+ return;
16
+ }
17
+
18
+ for (UIGestureRecognizer *recognizer in view.gestureRecognizers ?: @[]) {
19
+ if ([recognizer isKindOfClass:[UIPanGestureRecognizer class]]) {
20
+ UIPanGestureRecognizer *panGesture = (UIPanGestureRecognizer *)recognizer;
21
+ [panGesture addTarget:target action:selector];
22
+ }
23
+ }
24
+ }
25
+
26
+ @end
@@ -0,0 +1,44 @@
1
+ //
2
+ // Created by Jovanni Lo (@lodev09)
3
+ // Copyright (c) 2024-present. All rights reserved.
4
+ //
5
+ // This source code is licensed under the MIT license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ #ifdef RCT_NEW_ARCH_ENABLED
10
+
11
+ #import <UIKit/UIKit.h>
12
+
13
+ NS_ASSUME_NONNULL_BEGIN
14
+
15
+ @interface LayoutUtil : NSObject
16
+
17
+ /**
18
+ * Pins a view to its parent view using Auto Layout constraints
19
+ * @param view The view to pin
20
+ * @param parentView The parent view to pin to
21
+ * @param edges The edges to pin (UIRectEdge flags)
22
+ */
23
+ + (void)pinView:(UIView *)view toParentView:(UIView *)parentView edges:(UIRectEdge)edges;
24
+
25
+ /**
26
+ * Pins a view to its parent view with a specific height constraint
27
+ * @param view The view to pin
28
+ * @param parentView The parent view to pin to
29
+ * @param edges The edges to pin (UIRectEdge flags)
30
+ * @param height The height constraint to apply (0 means no height constraint)
31
+ */
32
+ + (void)pinView:(UIView *)view toParentView:(UIView *)parentView edges:(UIRectEdge)edges height:(CGFloat)height;
33
+
34
+ /**
35
+ * Unpins a view by removing its constraints and re-enabling autoresizing mask translation
36
+ * @param view The view to unpin
37
+ */
38
+ + (void)unpinView:(UIView *)view;
39
+
40
+ @end
41
+
42
+ NS_ASSUME_NONNULL_END
43
+
44
+ #endif