react-native-sheet2 6.1.18 → 7.12.4

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 (110) hide show
  1. package/README.md +754 -80
  2. package/{Sheet.podspec → Sheet2.podspec} +2 -2
  3. package/android/build.gradle +2 -25
  4. package/android/check.jks +0 -0
  5. package/android/src/main/AndroidManifest.xml +1 -2
  6. package/android/src/main/cpp/react/renderer/components/SheetViewSpec/SheetViewComponentDescriptor.h +12 -0
  7. package/android/src/main/cpp/react/renderer/components/SheetViewSpec/SheetViewShadowNode.cpp +17 -0
  8. package/android/src/main/cpp/react/renderer/components/SheetViewSpec/SheetViewShadowNode.h +36 -0
  9. package/android/src/main/cpp/react/renderer/components/SheetViewSpec/SheetViewState.h +52 -0
  10. package/android/src/main/java/com/behavior/BottomSheetBehavior.java +84 -16
  11. package/android/src/main/java/com/sheet2/AppFittedSheet.kt +431 -0
  12. package/android/src/main/java/com/{sheet → sheet2}/BaseRNView.kt +38 -31
  13. package/android/src/main/java/com/sheet2/CenteredSheetDialog.kt +272 -0
  14. package/android/src/main/java/com/{sheet → sheet2}/CustomBottomSheetDialog.java +32 -4
  15. package/android/src/main/java/com/{sheet → sheet2}/DialogRootViewGroup.kt +54 -12
  16. package/android/src/main/java/com/sheet2/FragmentModalBottomSheet.kt +161 -0
  17. package/android/src/main/java/com/sheet2/InlineFooterPresenter.kt +74 -0
  18. package/android/src/main/java/com/sheet2/InlineSheetPresenter.kt +249 -0
  19. package/android/src/main/java/com/sheet2/PassThroughLayouts.kt +17 -0
  20. package/android/src/main/java/com/{sheet → sheet2}/SafeAreaUtils.kt +4 -5
  21. package/android/src/main/java/com/sheet2/Sheet2Package.kt +44 -0
  22. package/android/src/main/java/com/sheet2/Sheet2View.kt +5 -0
  23. package/android/src/main/java/com/sheet2/Sheet2ViewManager.kt +163 -0
  24. package/android/src/main/java/com/{sheet → sheet2}/SheetDismissEvent.kt +1 -1
  25. package/android/src/main/java/com/{sheet → sheet2}/SheetModule.kt +14 -3
  26. package/android/src/main/java/com/{sheet → sheet2}/SheetPackage.kt +2 -3
  27. package/android/src/main/java/com/sheet2/SheetTreeLog.kt +78 -0
  28. package/android/src/main/java/com/{sheet → sheet2}/utils.kt +1 -2
  29. package/android/src/main/jni/CMakeLists.txt +72 -0
  30. package/android/src/main/jni/SheetViewSpec.h +40 -0
  31. package/ios/FittedSheets/SheetOptions.swift +5 -0
  32. package/ios/FittedSheets/SheetTransition.swift +83 -4
  33. package/ios/FittedSheets/SheetViewController.swift +222 -24
  34. package/ios/HostFittedSheet.swift +440 -51
  35. package/ios/SheetModule.h +5 -4
  36. package/ios/SheetModule.mm +11 -1
  37. package/ios/SheetTreeLog.swift +52 -0
  38. package/ios/SheetView.mm +118 -31
  39. package/ios/SheetViewComponentDescriptor.h +24 -0
  40. package/ios/SheetViewShadowNode.cpp +17 -0
  41. package/ios/SheetViewShadowNode.h +37 -0
  42. package/ios/SheetViewState.h +54 -0
  43. package/package.json +44 -74
  44. package/react-native.config.js +6 -4
  45. package/src/FittedSheet.tsx +131 -71
  46. package/src/GlobalSheetView.tsx +209 -0
  47. package/src/NativeSheet.ts +4 -0
  48. package/src/PublicSheetView.tsx +2 -1
  49. package/src/SheetTreeLog.ts +39 -0
  50. package/src/SheetViewNativeComponent.ts +25 -4
  51. package/src/index.tsx +34 -4
  52. package/src/logger.ts +16 -0
  53. package/android/generated/java/com/facebook/react/viewmanagers/SheetViewManagerDelegate.java +0 -67
  54. package/android/generated/java/com/facebook/react/viewmanagers/SheetViewManagerInterface.java +0 -27
  55. package/android/generated/java/com/sheet/NativeSheetSpec.java +0 -78
  56. package/android/generated/jni/CMakeLists.txt +0 -36
  57. package/android/generated/jni/RNSheetViewSpec-generated.cpp +0 -50
  58. package/android/generated/jni/RNSheetViewSpec.h +0 -31
  59. package/android/generated/jni/react/renderer/components/RNSheetViewSpec/ComponentDescriptors.cpp +0 -22
  60. package/android/generated/jni/react/renderer/components/RNSheetViewSpec/ComponentDescriptors.h +0 -24
  61. package/android/generated/jni/react/renderer/components/RNSheetViewSpec/EventEmitters.cpp +0 -24
  62. package/android/generated/jni/react/renderer/components/RNSheetViewSpec/EventEmitters.h +0 -25
  63. package/android/generated/jni/react/renderer/components/RNSheetViewSpec/Props.cpp +0 -33
  64. package/android/generated/jni/react/renderer/components/RNSheetViewSpec/Props.h +0 -36
  65. package/android/generated/jni/react/renderer/components/RNSheetViewSpec/RNSheetViewSpecJSI-generated.cpp +0 -46
  66. package/android/generated/jni/react/renderer/components/RNSheetViewSpec/RNSheetViewSpecJSI.h +0 -98
  67. package/android/generated/jni/react/renderer/components/RNSheetViewSpec/ShadowNodes.cpp +0 -17
  68. package/android/generated/jni/react/renderer/components/RNSheetViewSpec/ShadowNodes.h +0 -32
  69. package/android/generated/jni/react/renderer/components/RNSheetViewSpec/States.cpp +0 -16
  70. package/android/generated/jni/react/renderer/components/RNSheetViewSpec/States.h +0 -29
  71. package/android/src/main/AndroidManifestNew.xml +0 -2
  72. package/android/src/main/java/com/sheet/AppFittedSheet.kt +0 -214
  73. package/android/src/main/java/com/sheet/FragmentModalBottomSheet.kt +0 -67
  74. package/android/src/main/java/com/sheet/SheetView.kt +0 -5
  75. package/android/src/main/java/com/sheet/SheetViewManager.kt +0 -106
  76. package/ios/generated/RNSheetViewSpec/ComponentDescriptors.cpp +0 -22
  77. package/ios/generated/RNSheetViewSpec/ComponentDescriptors.h +0 -24
  78. package/ios/generated/RNSheetViewSpec/EventEmitters.cpp +0 -24
  79. package/ios/generated/RNSheetViewSpec/EventEmitters.h +0 -25
  80. package/ios/generated/RNSheetViewSpec/Props.cpp +0 -33
  81. package/ios/generated/RNSheetViewSpec/Props.h +0 -36
  82. package/ios/generated/RNSheetViewSpec/RCTComponentViewHelpers.h +0 -44
  83. package/ios/generated/RNSheetViewSpec/RNSheetViewSpec-generated.mm +0 -60
  84. package/ios/generated/RNSheetViewSpec/RNSheetViewSpec.h +0 -100
  85. package/ios/generated/RNSheetViewSpec/ShadowNodes.cpp +0 -17
  86. package/ios/generated/RNSheetViewSpec/ShadowNodes.h +0 -32
  87. package/ios/generated/RNSheetViewSpec/States.cpp +0 -16
  88. package/ios/generated/RNSheetViewSpec/States.h +0 -29
  89. package/ios/generated/RNSheetViewSpecJSI-generated.cpp +0 -46
  90. package/ios/generated/RNSheetViewSpecJSI.h +0 -98
  91. package/lib/module/FittedSheet.js +0 -153
  92. package/lib/module/FittedSheet.js.map +0 -1
  93. package/lib/module/NativeSheet.ts +0 -17
  94. package/lib/module/PublicSheetView.js +0 -48
  95. package/lib/module/PublicSheetView.js.map +0 -1
  96. package/lib/module/SheetViewNativeComponent.ts +0 -31
  97. package/lib/module/index.js +0 -13
  98. package/lib/module/index.js.map +0 -1
  99. package/lib/module/package.json +0 -1
  100. package/lib/typescript/package.json +0 -1
  101. package/lib/typescript/src/FittedSheet.d.ts +0 -51
  102. package/lib/typescript/src/FittedSheet.d.ts.map +0 -1
  103. package/lib/typescript/src/NativeSheet.d.ts +0 -16
  104. package/lib/typescript/src/NativeSheet.d.ts.map +0 -1
  105. package/lib/typescript/src/PublicSheetView.d.ts +0 -12
  106. package/lib/typescript/src/PublicSheetView.d.ts.map +0 -1
  107. package/lib/typescript/src/SheetViewNativeComponent.d.ts +0 -22
  108. package/lib/typescript/src/SheetViewNativeComponent.d.ts.map +0 -1
  109. package/lib/typescript/src/index.d.ts +0 -8
  110. package/lib/typescript/src/index.d.ts.map +0 -1
@@ -1,33 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GeneratePropsCpp.js
9
- */
10
-
11
- #include "Props.h"
12
- #include <react/renderer/core/PropsParserContext.h>
13
- #include <react/renderer/core/propsConversions.h>
14
-
15
- namespace facebook::react {
16
-
17
- SheetViewProps::SheetViewProps(
18
- const PropsParserContext &context,
19
- const SheetViewProps &sourceProps,
20
- const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
21
-
22
- dismissable(convertRawProp(context, rawProps, "dismissable", sourceProps.dismissable, {false})),
23
- maxWidth(convertRawProp(context, rawProps, "maxWidth", sourceProps.maxWidth, {0.0})),
24
- maxHeight(convertRawProp(context, rawProps, "maxHeight", sourceProps.maxHeight, {0.0})),
25
- minHeight(convertRawProp(context, rawProps, "minHeight", sourceProps.minHeight, {0.0})),
26
- calculatedHeight(convertRawProp(context, rawProps, "calculatedHeight", sourceProps.calculatedHeight, {0.0})),
27
- topLeftRightCornerRadius(convertRawProp(context, rawProps, "topLeftRightCornerRadius", sourceProps.topLeftRightCornerRadius, {0.0})),
28
- isSystemUILight(convertRawProp(context, rawProps, "isSystemUILight", sourceProps.isSystemUILight, {false})),
29
- passScrollViewReactTag(convertRawProp(context, rawProps, "passScrollViewReactTag", sourceProps.passScrollViewReactTag, {})),
30
- sheetBackgroundColor(convertRawProp(context, rawProps, "sheetBackgroundColor", sourceProps.sheetBackgroundColor, {}))
31
- {}
32
-
33
- } // namespace facebook::react
@@ -1,36 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GeneratePropsH.js
9
- */
10
- #pragma once
11
-
12
- #include <react/renderer/components/view/ViewProps.h>
13
- #include <react/renderer/core/PropsParserContext.h>
14
- #include <react/renderer/graphics/Color.h>
15
-
16
- namespace facebook::react {
17
-
18
- class SheetViewProps final : public ViewProps {
19
- public:
20
- SheetViewProps() = default;
21
- SheetViewProps(const PropsParserContext& context, const SheetViewProps &sourceProps, const RawProps &rawProps);
22
-
23
- #pragma mark - Props
24
-
25
- bool dismissable{false};
26
- double maxWidth{0.0};
27
- double maxHeight{0.0};
28
- double minHeight{0.0};
29
- double calculatedHeight{0.0};
30
- double topLeftRightCornerRadius{0.0};
31
- bool isSystemUILight{false};
32
- std::string passScrollViewReactTag{};
33
- SharedColor sheetBackgroundColor{};
34
- };
35
-
36
- } // namespace facebook::react
@@ -1,44 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateComponentHObjCpp.js
8
- */
9
-
10
- #import <Foundation/Foundation.h>
11
- #import <React/RCTDefines.h>
12
- #import <React/RCTLog.h>
13
-
14
- NS_ASSUME_NONNULL_BEGIN
15
-
16
- @protocol RCTSheetViewViewProtocol <NSObject>
17
- - (void)dismissSheet;
18
- @end
19
-
20
- RCT_EXTERN inline void RCTSheetViewHandleCommand(
21
- id<RCTSheetViewViewProtocol> componentView,
22
- NSString const *commandName,
23
- NSArray const *args)
24
- {
25
- if ([commandName isEqualToString:@"dismissSheet"]) {
26
- #if RCT_DEBUG
27
- if ([args count] != 0) {
28
- RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"SheetView", commandName, (int)[args count], 0);
29
- return;
30
- }
31
- #endif
32
-
33
-
34
-
35
- [componentView dismissSheet];
36
- return;
37
- }
38
-
39
- #if RCT_DEBUG
40
- RCTLogError(@"%@ received command %@, which is not a supported command.", @"SheetView", commandName);
41
- #endif
42
- }
43
-
44
- NS_ASSUME_NONNULL_END
@@ -1,60 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleObjCpp
8
- *
9
- * We create an umbrella header (and corresponding implementation) here since
10
- * Cxx compilation in BUCK has a limitation: source-code producing genrule()s
11
- * must have a single output. More files => more genrule()s => slower builds.
12
- */
13
-
14
- #import "RNSheetViewSpec.h"
15
-
16
-
17
- @implementation NativeSheetSpecBase
18
-
19
-
20
- - (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
21
- {
22
- _eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback);
23
- }
24
- @end
25
-
26
-
27
- namespace facebook::react {
28
-
29
- static facebook::jsi::Value __hostFunction_NativeSheetSpecJSI_viewportSize(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
30
- return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, ObjectKind, "viewportSize", @selector(viewportSize), args, count);
31
- }
32
-
33
- static facebook::jsi::Value __hostFunction_NativeSheetSpecJSI_dismissAll(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
34
- return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "dismissAll", @selector(dismissAll), args, count);
35
- }
36
-
37
- static facebook::jsi::Value __hostFunction_NativeSheetSpecJSI_dismissPresented(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
38
- return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "dismissPresented", @selector(dismissPresented), args, count);
39
- }
40
-
41
- static facebook::jsi::Value __hostFunction_NativeSheetSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
42
- return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count);
43
- }
44
-
45
- NativeSheetSpecJSI::NativeSheetSpecJSI(const ObjCTurboModule::InitParams &params)
46
- : ObjCTurboModule(params) {
47
-
48
- methodMap_["viewportSize"] = MethodMetadata {0, __hostFunction_NativeSheetSpecJSI_viewportSize};
49
-
50
-
51
- methodMap_["dismissAll"] = MethodMetadata {0, __hostFunction_NativeSheetSpecJSI_dismissAll};
52
-
53
-
54
- methodMap_["dismissPresented"] = MethodMetadata {0, __hostFunction_NativeSheetSpecJSI_dismissPresented};
55
-
56
-
57
- methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeSheetSpecJSI_getConstants};
58
-
59
- }
60
- } // namespace facebook::react
@@ -1,100 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleObjCpp
8
- *
9
- * We create an umbrella header (and corresponding implementation) here since
10
- * Cxx compilation in BUCK has a limitation: source-code producing genrule()s
11
- * must have a single output. More files => more genrule()s => slower builds.
12
- */
13
-
14
- #ifndef __cplusplus
15
- #error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
16
- #endif
17
-
18
- // Avoid multiple includes of RNSheetViewSpec symbols
19
- #ifndef RNSheetViewSpec_H
20
- #define RNSheetViewSpec_H
21
-
22
- #import <Foundation/Foundation.h>
23
- #import <RCTRequired/RCTRequired.h>
24
- #import <RCTTypeSafety/RCTConvertHelpers.h>
25
- #import <RCTTypeSafety/RCTTypedModuleConstants.h>
26
- #import <React/RCTBridgeModule.h>
27
- #import <React/RCTCxxConvert.h>
28
- #import <React/RCTManagedPointer.h>
29
- #import <ReactCommon/RCTTurboModule.h>
30
- #import <optional>
31
- #import <vector>
32
-
33
-
34
- NS_ASSUME_NONNULL_BEGIN
35
- namespace JS {
36
- namespace NativeSheet {
37
- struct Constants {
38
-
39
- struct Builder {
40
- struct Input {
41
- RCTRequired<id<NSObject>> insets;
42
- };
43
-
44
- /** Initialize with a set of values */
45
- Builder(const Input i);
46
- /** Initialize with an existing Constants */
47
- Builder(Constants i);
48
- /** Builds the object. Generally used only by the infrastructure. */
49
- NSDictionary *buildUnsafeRawValue() const { return _factory(); };
50
- private:
51
- NSDictionary *(^_factory)(void);
52
- };
53
-
54
- static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; }
55
- NSDictionary *unsafeRawValue() const { return _v; }
56
- private:
57
- Constants(NSDictionary *const v) : _v(v) {}
58
- NSDictionary *_v;
59
- };
60
- }
61
- }
62
- @protocol NativeSheetSpec <RCTBridgeModule, RCTTurboModule>
63
-
64
- - (NSDictionary *)viewportSize;
65
- - (void)dismissAll;
66
- - (void)dismissPresented;
67
- - (facebook::react::ModuleConstants<JS::NativeSheet::Constants::Builder>)constantsToExport;
68
- - (facebook::react::ModuleConstants<JS::NativeSheet::Constants::Builder>)getConstants;
69
-
70
- @end
71
-
72
- @interface NativeSheetSpecBase : NSObject {
73
- @protected
74
- facebook::react::EventEmitterCallback _eventEmitterCallback;
75
- }
76
- - (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper;
77
-
78
-
79
- @end
80
-
81
- namespace facebook::react {
82
- /**
83
- * ObjC++ class for module 'NativeSheet'
84
- */
85
- class JSI_EXPORT NativeSheetSpecJSI : public ObjCTurboModule {
86
- public:
87
- NativeSheetSpecJSI(const ObjCTurboModule::InitParams &params);
88
- };
89
- } // namespace facebook::react
90
- inline JS::NativeSheet::Constants::Builder::Builder(const Input i) : _factory(^{
91
- NSMutableDictionary *d = [NSMutableDictionary new];
92
- auto insets = i.insets.get();
93
- d[@"insets"] = insets;
94
- return d;
95
- }) {}
96
- inline JS::NativeSheet::Constants::Builder::Builder(Constants i) : _factory(^{
97
- return i.unsafeRawValue();
98
- }) {}
99
- NS_ASSUME_NONNULL_END
100
- #endif // RNSheetViewSpec_H
@@ -1,17 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateShadowNodeCpp.js
9
- */
10
-
11
- #include "ShadowNodes.h"
12
-
13
- namespace facebook::react {
14
-
15
- extern const char SheetViewComponentName[] = "SheetView";
16
-
17
- } // namespace facebook::react
@@ -1,32 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateShadowNodeH.js
9
- */
10
-
11
- #pragma once
12
-
13
- #include "EventEmitters.h"
14
- #include "Props.h"
15
- #include "States.h"
16
- #include <react/renderer/components/view/ConcreteViewShadowNode.h>
17
- #include <jsi/jsi.h>
18
-
19
- namespace facebook::react {
20
-
21
- JSI_EXPORT extern const char SheetViewComponentName[];
22
-
23
- /*
24
- * `ShadowNode` for <SheetView> component.
25
- */
26
- using SheetViewShadowNode = ConcreteViewShadowNode<
27
- SheetViewComponentName,
28
- SheetViewProps,
29
- SheetViewEventEmitter,
30
- SheetViewState>;
31
-
32
- } // namespace facebook::react
@@ -1,16 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateStateCpp.js
9
- */
10
- #include "States.h"
11
-
12
- namespace facebook::react {
13
-
14
-
15
-
16
- } // namespace facebook::react
@@ -1,29 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateStateH.js
8
- */
9
- #pragma once
10
-
11
- #ifdef ANDROID
12
- #include <folly/dynamic.h>
13
- #endif
14
-
15
- namespace facebook::react {
16
-
17
- class SheetViewState {
18
- public:
19
- SheetViewState() = default;
20
-
21
- #ifdef ANDROID
22
- SheetViewState(SheetViewState const &previousState, folly::dynamic data){};
23
- folly::dynamic getDynamic() const {
24
- return {};
25
- };
26
- #endif
27
- };
28
-
29
- } // namespace facebook::react
@@ -1,46 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleCpp.js
8
- */
9
-
10
- #include "RNSheetViewSpecJSI.h"
11
-
12
- namespace facebook::react {
13
-
14
- static jsi::Value __hostFunction_NativeSheetCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
- return static_cast<NativeSheetCxxSpecJSI *>(&turboModule)->getConstants(
16
- rt
17
- );
18
- }
19
- static jsi::Value __hostFunction_NativeSheetCxxSpecJSI_viewportSize(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
20
- return static_cast<NativeSheetCxxSpecJSI *>(&turboModule)->viewportSize(
21
- rt
22
- );
23
- }
24
- static jsi::Value __hostFunction_NativeSheetCxxSpecJSI_dismissAll(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
25
- static_cast<NativeSheetCxxSpecJSI *>(&turboModule)->dismissAll(
26
- rt
27
- );
28
- return jsi::Value::undefined();
29
- }
30
- static jsi::Value __hostFunction_NativeSheetCxxSpecJSI_dismissPresented(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
31
- static_cast<NativeSheetCxxSpecJSI *>(&turboModule)->dismissPresented(
32
- rt
33
- );
34
- return jsi::Value::undefined();
35
- }
36
-
37
- NativeSheetCxxSpecJSI::NativeSheetCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
38
- : TurboModule("Sheet", jsInvoker) {
39
- methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeSheetCxxSpecJSI_getConstants};
40
- methodMap_["viewportSize"] = MethodMetadata {0, __hostFunction_NativeSheetCxxSpecJSI_viewportSize};
41
- methodMap_["dismissAll"] = MethodMetadata {0, __hostFunction_NativeSheetCxxSpecJSI_dismissAll};
42
- methodMap_["dismissPresented"] = MethodMetadata {0, __hostFunction_NativeSheetCxxSpecJSI_dismissPresented};
43
- }
44
-
45
-
46
- } // namespace facebook::react
@@ -1,98 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleH.js
8
- */
9
-
10
- #pragma once
11
-
12
- #include <ReactCommon/TurboModule.h>
13
- #include <react/bridging/Bridging.h>
14
-
15
- namespace facebook::react {
16
-
17
-
18
- class JSI_EXPORT NativeSheetCxxSpecJSI : public TurboModule {
19
- protected:
20
- NativeSheetCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
21
-
22
- public:
23
- virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
24
- virtual jsi::Object viewportSize(jsi::Runtime &rt) = 0;
25
- virtual void dismissAll(jsi::Runtime &rt) = 0;
26
- virtual void dismissPresented(jsi::Runtime &rt) = 0;
27
-
28
- };
29
-
30
- template <typename T>
31
- class JSI_EXPORT NativeSheetCxxSpec : public TurboModule {
32
- public:
33
- jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
34
- return delegate_.create(rt, propName);
35
- }
36
-
37
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
38
- return delegate_.getPropertyNames(runtime);
39
- }
40
-
41
- static constexpr std::string_view kModuleName = "Sheet";
42
-
43
- protected:
44
- NativeSheetCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
45
- : TurboModule(std::string{NativeSheetCxxSpec::kModuleName}, jsInvoker),
46
- delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
47
-
48
-
49
- private:
50
- class Delegate : public NativeSheetCxxSpecJSI {
51
- public:
52
- Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
53
- NativeSheetCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
54
-
55
- }
56
-
57
- jsi::Object getConstants(jsi::Runtime &rt) override {
58
- static_assert(
59
- bridging::getParameterCount(&T::getConstants) == 1,
60
- "Expected getConstants(...) to have 1 parameters");
61
-
62
- return bridging::callFromJs<jsi::Object>(
63
- rt, &T::getConstants, jsInvoker_, instance_);
64
- }
65
- jsi::Object viewportSize(jsi::Runtime &rt) override {
66
- static_assert(
67
- bridging::getParameterCount(&T::viewportSize) == 1,
68
- "Expected viewportSize(...) to have 1 parameters");
69
-
70
- return bridging::callFromJs<jsi::Object>(
71
- rt, &T::viewportSize, jsInvoker_, instance_);
72
- }
73
- void dismissAll(jsi::Runtime &rt) override {
74
- static_assert(
75
- bridging::getParameterCount(&T::dismissAll) == 1,
76
- "Expected dismissAll(...) to have 1 parameters");
77
-
78
- return bridging::callFromJs<void>(
79
- rt, &T::dismissAll, jsInvoker_, instance_);
80
- }
81
- void dismissPresented(jsi::Runtime &rt) override {
82
- static_assert(
83
- bridging::getParameterCount(&T::dismissPresented) == 1,
84
- "Expected dismissPresented(...) to have 1 parameters");
85
-
86
- return bridging::callFromJs<void>(
87
- rt, &T::dismissPresented, jsInvoker_, instance_);
88
- }
89
-
90
- private:
91
- friend class NativeSheetCxxSpec;
92
- T *instance_;
93
- };
94
-
95
- Delegate delegate_;
96
- };
97
-
98
- } // namespace facebook::react
@@ -1,153 +0,0 @@
1
- "use strict";
2
-
3
- import React from 'react';
4
- import { Dimensions, Platform, StatusBar, View } from 'react-native';
5
- import She, { Commands } from './SheetViewNativeComponent';
6
- import SheetModule from './NativeSheet';
7
- import { Portal } from '@gorhom/portal';
8
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
9
- const _FittedSheet = She;
10
- export class PrivateFittedSheet extends React.PureComponent {
11
- sheetRef = /*#__PURE__*/React.createRef();
12
- constructor(props) {
13
- super(props);
14
- this.dimensions = this.viewportSize();
15
- this.state = {
16
- show: false,
17
- data: null,
18
- isLandscape: this.dimensions.width > this.dimensions.height
19
- };
20
- }
21
- show = data => {
22
- this.setState({
23
- show: true,
24
- data
25
- });
26
- };
27
- onLayout = e => {
28
- if (__DEV__) console.log('[FittedSheet.onLayout]', e.nativeEvent.layout.height);
29
- this.setState({
30
- height: e.nativeEvent.layout.height
31
- });
32
- };
33
- attachScrollViewToSheet = () => {
34
- console.log('[FittedSheet.attachScrollViewToSheet]');
35
- this.setState({
36
- passScrollViewReactTag: Date.now().toString()
37
- });
38
- };
39
- hide = passThroughParam => {
40
- if (!this.state.show) return;
41
- this.onHidePassThroughParam = passThroughParam;
42
- console.log('[FittedSheet.hide]', Commands.dismissSheet);
43
- Commands.dismissSheet(this.sheetRef.current);
44
- };
45
- static dismissAll = () => {
46
- SheetModule.dismissAll();
47
- };
48
- static dismissPresented = () => {
49
- SheetModule.dismissPresented();
50
- };
51
-
52
- // @ts-ignore
53
- onDismiss = () => {
54
- if (__DEV__) console.log('[FittedSheet.onDismiss]');
55
- this.setState({
56
- show: false,
57
- height: undefined
58
- });
59
- const passValue = this.onHidePassThroughParam;
60
- this.onHidePassThroughParam = undefined;
61
- this.props.onSheetDismiss?.(passValue);
62
- };
63
- insets() {
64
- return SheetModule.getConstants().insets ?? {
65
- top: 0,
66
- bottom: 0
67
- };
68
- }
69
- componentDidMount() {
70
- if (__DEV__) console.log('[FittedSheet.componentDidMount]', this.insets());
71
- this.cleanup = Dimensions.addEventListener('change', () => {
72
- this.dimensions = this.viewportSize();
73
- const isLandscape = this.dimensions.width > this.dimensions.height;
74
- this.setState({
75
- isLandscape
76
- });
77
- }).remove;
78
- }
79
- componentWillUnmount() {
80
- if (__DEV__) console.log('[FittedSheet.componentWillUnmount]');
81
- this.hide();
82
- this.cleanup?.();
83
- this.cleanup = undefined;
84
- }
85
- viewportSize() {
86
- if (Platform.OS === 'ios') {
87
- return SheetModule.viewportSize();
88
- }
89
- return Dimensions.get('window');
90
- }
91
- _shouldSetResponder() {
92
- return true;
93
- }
94
- render() {
95
- if (!this.state.show) return null;
96
- let maxHeight = Math.min(this.props.params?.maxHeight ?? Number.MAX_VALUE, this.dimensions.height - this.insets().top - this.insets().bottom);
97
- const paramsMaxWidth = this.state.isLandscape ? this.props.params?.maxLandscapeWidth : this.props.params?.maxPortraitWidth;
98
- let maxWidth = Math.min(paramsMaxWidth ?? Number.MAX_VALUE, this.dimensions.width);
99
- let minHeight = this.props.params?.minHeight;
100
- if (this.props.params?.applyMaxHeightToMinHeight) {
101
- minHeight = maxHeight;
102
- }
103
- let nativeHeight = this.state.height;
104
- if (nativeHeight) {
105
- nativeHeight = Math.max(nativeHeight ?? 0, minHeight ?? 0);
106
- nativeHeight = Math.min(nativeHeight, maxHeight);
107
- }
108
- if (__DEV__) {
109
- console.log('[FittedSheet.render]', JSON.stringify({
110
- maxHeight,
111
- maxWidth,
112
- nativeHeight,
113
- isLandscape: this.state.isLandscape,
114
- h: Dimensions.get('window').height,
115
- sb: StatusBar.currentHeight,
116
- dimensions: this.dimensions
117
- }, undefined, 2));
118
- }
119
- const background = this.props?.params?.backgroundColor;
120
- return /*#__PURE__*/_jsx(Portal, {
121
- hostName: 'SheetHost',
122
- children: /*#__PURE__*/_jsx(_FittedSheet, {
123
- onSheetDismiss: this.onDismiss,
124
- ref: this.sheetRef,
125
- onStartShouldSetResponder: this._shouldSetResponder,
126
- style: {
127
- width: maxWidth,
128
- position: 'absolute'
129
- },
130
- dismissable: this.props.params?.dismissable ?? true,
131
- maxWidth: maxWidth,
132
- maxHeight: maxHeight,
133
- sheetBackgroundColor: background,
134
- minHeight: minHeight,
135
- topLeftRightCornerRadius: this.props.params?.topLeftRightCornerRadius ?? 20,
136
- isSystemUILight: this.props.params?.isSystemUILight ?? true,
137
- calculatedHeight: nativeHeight,
138
- passScrollViewReactTag: this.state.passScrollViewReactTag,
139
- children: /*#__PURE__*/_jsxs(View, {
140
- nativeID: 'fitted-sheet-root-view',
141
- style: {
142
- width: maxWidth,
143
- maxHeight,
144
- backgroundColor: background
145
- },
146
- onLayout: this.onLayout,
147
- children: [this.props.children && typeof this.props.children === 'function' && this.props.children(this.state.data), this.props.children && typeof this.props.children !== 'function' && this.props.children]
148
- })
149
- })
150
- });
151
- }
152
- }
153
- //# sourceMappingURL=FittedSheet.js.map