@sdcx/bottom-sheet 1.0.6 → 1.0.7

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.
@@ -0,0 +1,18 @@
1
+ #pragma once
2
+
3
+ #include <react/renderer/components/bottomsheet/BottomSheetContentViewShadowNode.h>
4
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
5
+
6
+ namespace facebook {
7
+ namespace react {
8
+
9
+ /*
10
+ * Descriptor for <BottomSheetContentView> component.
11
+ */
12
+ class BottomSheetContentViewComponentDescriptor final
13
+ : public ConcreteComponentDescriptor<BottomSheetContentViewShadowNode> {
14
+ using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
15
+ };
16
+
17
+ } // namespace react
18
+ } // namespace facebook
@@ -0,0 +1,19 @@
1
+ #include "BottomSheetContentViewShadowNode.h"
2
+
3
+ namespace facebook {
4
+ namespace react {
5
+
6
+ extern const char BottomSheetContentViewComponentName[] = "BottomSheetContentView";
7
+
8
+ Point BottomSheetContentViewShadowNode::getContentOriginOffset(bool includeTransform) const {
9
+ auto stateData = getStateData();
10
+ auto contentOffset = stateData.contentOffset;
11
+
12
+ return {
13
+ .x = 0,
14
+ .y = static_cast<Float>(contentOffset),
15
+ };
16
+ }
17
+
18
+ } // namespace react
19
+ } // namespace facebook
@@ -0,0 +1,32 @@
1
+ #pragma once
2
+
3
+ #include <jsi/jsi.h>
4
+ #include <react/renderer/components/bottomsheet/BottomSheetContentViewState.h>
5
+ #include <react/renderer/components/bottomsheet/EventEmitters.h>
6
+ #include <react/renderer/components/bottomsheet/Props.h>
7
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
8
+
9
+ namespace facebook {
10
+ namespace react {
11
+
12
+ JSI_EXPORT extern const char BottomSheetContentViewComponentName[];
13
+
14
+ /*
15
+ * ShadowNode for <BottomSheetContentView>. getContentOriginOffset returns
16
+ * the view's top offset so that RN hit-testing uses the correct coordinates
17
+ * when the parent BottomSheet has moved this content view.
18
+ */
19
+ class JSI_EXPORT BottomSheetContentViewShadowNode final
20
+ : public ConcreteViewShadowNode<
21
+ BottomSheetContentViewComponentName,
22
+ BottomSheetContentViewProps,
23
+ ViewEventEmitter,
24
+ BottomSheetContentViewState> {
25
+ using ConcreteViewShadowNode::ConcreteViewShadowNode;
26
+
27
+ public:
28
+ Point getContentOriginOffset(bool includeTransform) const override;
29
+ };
30
+
31
+ } // namespace react
32
+ } // namespace facebook
@@ -0,0 +1,15 @@
1
+ #include "BottomSheetContentViewState.h"
2
+
3
+ namespace facebook {
4
+ namespace react {
5
+
6
+ #ifdef ANDROID
7
+ folly::dynamic BottomSheetContentViewState::getDynamic() const {
8
+ folly::dynamic data = folly::dynamic::object();
9
+ data["contentOffset"] = contentOffset;
10
+ return data;
11
+ }
12
+ #endif
13
+
14
+ } // namespace react
15
+ } // namespace facebook
@@ -0,0 +1,42 @@
1
+ #pragma once
2
+
3
+ #include <react/renderer/components/bottomsheet/Props.h>
4
+
5
+ #ifdef ANDROID
6
+ #include <folly/dynamic.h>
7
+ #include <react/renderer/mapbuffer/MapBuffer.h>
8
+ #include <react/renderer/mapbuffer/MapBufferBuilder.h>
9
+ #endif
10
+
11
+ namespace facebook {
12
+ namespace react {
13
+
14
+ /*
15
+ * State for <BottomSheetContentView> component. contentOffset is the offset
16
+ * (actual top - layout top) of this view. Used by getContentOriginOffset
17
+ * so that hit-testing uses the correct content origin when the sheet moves the view.
18
+ */
19
+ class JSI_EXPORT BottomSheetContentViewState final {
20
+ public:
21
+ using Shared = std::shared_ptr<const BottomSheetContentViewState>;
22
+
23
+ BottomSheetContentViewState() = default;
24
+
25
+ #ifdef ANDROID
26
+ BottomSheetContentViewState(
27
+ BottomSheetContentViewState const &previousState,
28
+ folly::dynamic data) {
29
+ contentOffset = data.getDefault("contentOffset", previousState.contentOffset).asDouble();
30
+ }
31
+ #endif
32
+
33
+ double contentOffset{};
34
+
35
+ #ifdef ANDROID
36
+ folly::dynamic getDynamic() const;
37
+ MapBuffer getMapBuffer() const { return MapBufferBuilder::EMPTY(); }
38
+ #endif
39
+ };
40
+
41
+ } // namespace react
42
+ } // namespace facebook
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sdcx/bottom-sheet",
3
3
  "description": "A react-native BottomSheet component.",
4
- "version": "1.0.6",
4
+ "version": "1.0.7",
5
5
  "main": "./dist/index",
6
6
  "module": "./dist/index",
7
7
  "types": "./dist/index.d.ts",
@@ -13,6 +13,7 @@
13
13
  "dist",
14
14
  "android",
15
15
  "ios",
16
+ "common",
16
17
  "react-native.config.js",
17
18
  "RNBottomSheet.podspec",
18
19
  "!android/build",