@lodev09/react-native-true-sheet 0.1.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.
- package/LICENSE +20 -0
- package/README.md +53 -0
- package/TrueSheet.podspec +42 -0
- package/android/build.gradle +94 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetPackage.kt +17 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +20 -0
- package/ios/Extensions/UIView+pinTo.swift +25 -0
- package/ios/Extensions/UIViewController+detentForSize.swift +112 -0
- package/ios/TrueSheet-Bridging-Header.h +9 -0
- package/ios/TrueSheetView.swift +249 -0
- package/ios/TrueSheetViewController.swift +98 -0
- package/ios/TrueSheetViewManager.m +38 -0
- package/ios/TrueSheetViewManager.swift +46 -0
- package/ios/Utils/Logger.swift +43 -0
- package/ios/Utils/Promise.swift +25 -0
- package/lib/commonjs/TrueSheet.js +104 -0
- package/lib/commonjs/TrueSheet.js.map +1 -0
- package/lib/commonjs/TrueSheetModule.js +17 -0
- package/lib/commonjs/TrueSheetModule.js.map +1 -0
- package/lib/commonjs/index.js +28 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/TrueSheet.js +95 -0
- package/lib/module/TrueSheet.js.map +1 -0
- package/lib/module/TrueSheetModule.js +11 -0
- package/lib/module/TrueSheetModule.js.map +1 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/src/TrueSheet.d.ts +31 -0
- package/lib/typescript/src/TrueSheet.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetModule.d.ts +2 -0
- package/lib/typescript/src/TrueSheetModule.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +94 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +183 -0
- package/src/TrueSheet.tsx +162 -0
- package/src/TrueSheetModule.ts +18 -0
- package/src/index.ts +2 -0
- package/src/types.ts +107 -0
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
// MARK: - SizeInfo
|
|
10
|
+
|
|
11
|
+
struct SizeInfo {
|
|
12
|
+
var index: Int
|
|
13
|
+
var value: CGFloat
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// MARK: - TrueSheetViewControllerDelegate
|
|
17
|
+
|
|
18
|
+
protocol TrueSheetViewControllerDelegate: AnyObject {
|
|
19
|
+
/// Notify bound rect changes so we can adjust our sheet view
|
|
20
|
+
func viewDidChangeWidth(_ width: CGFloat)
|
|
21
|
+
|
|
22
|
+
/// Notify when view controller has been dismissed
|
|
23
|
+
func didDismiss()
|
|
24
|
+
|
|
25
|
+
/// Notify when size has changed from dragging the Sheet
|
|
26
|
+
func didChangeSize(_ value: CGFloat, at index: Int)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// MARK: - TrueSheetViewController
|
|
30
|
+
|
|
31
|
+
class TrueSheetViewController: UIViewController, UISheetPresentationControllerDelegate {
|
|
32
|
+
// MARK: - Properties
|
|
33
|
+
|
|
34
|
+
weak var delegate: TrueSheetViewControllerDelegate?
|
|
35
|
+
|
|
36
|
+
var lastViewWidth: CGFloat = 0
|
|
37
|
+
var detentValues: [String: SizeInfo] = [:]
|
|
38
|
+
|
|
39
|
+
@available(iOS 15.0, *)
|
|
40
|
+
var sheet: UISheetPresentationController? {
|
|
41
|
+
return sheetPresentationController
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// MARK: - Setup
|
|
45
|
+
|
|
46
|
+
@available(iOS 15.0, *)
|
|
47
|
+
func sheetPresentationControllerDidChangeSelectedDetentIdentifier(_ sheet: UISheetPresentationController) {
|
|
48
|
+
if let identifer = sheet.selectedDetentIdentifier,
|
|
49
|
+
let size = detentValues[identifer.rawValue] {
|
|
50
|
+
delegate?.didChangeSize(size.value, at: size.index)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
override func viewDidDisappear(_ animated: Bool) {
|
|
55
|
+
super.viewDidDisappear(animated)
|
|
56
|
+
delegate?.didDismiss()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// This is called multiple times while sheet is being dragged.
|
|
60
|
+
/// let's try to minimize size update by comparing last known width
|
|
61
|
+
override func viewDidLayoutSubviews() {
|
|
62
|
+
super.viewDidLayoutSubviews()
|
|
63
|
+
|
|
64
|
+
if lastViewWidth != view.frame.width {
|
|
65
|
+
delegate?.viewDidChangeWidth(view.bounds.width)
|
|
66
|
+
lastViewWidth = view.frame.width
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/// Prepares the view controller for sheet presentation
|
|
71
|
+
/// Do nothing on IOS 14 and below... sad
|
|
72
|
+
@available(iOS 15.0, *)
|
|
73
|
+
func configureSheet(for sizes: [Any], with height: CGFloat) {
|
|
74
|
+
guard let sheet else { return }
|
|
75
|
+
|
|
76
|
+
detentValues = [:]
|
|
77
|
+
|
|
78
|
+
var detents: [UISheetPresentationController.Detent] = []
|
|
79
|
+
|
|
80
|
+
// Default to medium and large
|
|
81
|
+
let sheetSizes = sizes.isEmpty ? ["medium", "large"] : sizes
|
|
82
|
+
|
|
83
|
+
for (index, size) in sheetSizes.enumerated() {
|
|
84
|
+
let detent = detentFor(size, with: height) { id, value in
|
|
85
|
+
self.detentValues[id] = SizeInfo(index: index, value: value)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
detents.append(detent)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
sheet.detents = detents
|
|
92
|
+
sheet.prefersGrabberVisible = true
|
|
93
|
+
sheet.prefersEdgeAttachedInCompactHeight = true
|
|
94
|
+
// sheet.prefersScrollingExpandsWhenScrolledToEdge = false
|
|
95
|
+
|
|
96
|
+
sheet.delegate = self
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 <React/RCTViewManager.h>
|
|
10
|
+
|
|
11
|
+
@interface RCT_EXTERN_MODULE(TrueSheetViewManager, RCTViewManager)
|
|
12
|
+
|
|
13
|
+
// Module Functions
|
|
14
|
+
|
|
15
|
+
/// Presents the sheet controller
|
|
16
|
+
RCT_EXTERN_METHOD(present:(nonnull NSNumber*)tag
|
|
17
|
+
index:(int)index
|
|
18
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
19
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
20
|
+
|
|
21
|
+
RCT_EXTERN_METHOD(dismiss:(nonnull NSNumber*)tag
|
|
22
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
23
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
24
|
+
|
|
25
|
+
// Events
|
|
26
|
+
RCT_EXPORT_VIEW_PROPERTY(onPresent, RCTDirectEventBlock)
|
|
27
|
+
RCT_EXPORT_VIEW_PROPERTY(onDismiss, RCTDirectEventBlock)
|
|
28
|
+
RCT_EXPORT_VIEW_PROPERTY(onSizeChange, RCTDirectEventBlock)
|
|
29
|
+
|
|
30
|
+
// Internal Properties
|
|
31
|
+
RCT_EXPORT_VIEW_PROPERTY(scrollableHandle, NSNumber*)
|
|
32
|
+
RCT_EXPORT_VIEW_PROPERTY(footerHandle, NSNumber*)
|
|
33
|
+
|
|
34
|
+
// Properties
|
|
35
|
+
RCT_EXPORT_VIEW_PROPERTY(sizes, NSArray)
|
|
36
|
+
RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor)
|
|
37
|
+
|
|
38
|
+
@end
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
@objc(TrueSheetViewManager)
|
|
10
|
+
class TrueSheetViewManager: RCTViewManager {
|
|
11
|
+
// MARK: - properties
|
|
12
|
+
|
|
13
|
+
override var methodQueue: DispatchQueue! {
|
|
14
|
+
return DispatchQueue.main
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
override static func requiresMainQueueSetup() -> Bool {
|
|
18
|
+
return true
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
override func view() -> UIView? {
|
|
22
|
+
return TrueSheetView(with: bridge)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// MARK: - Private
|
|
26
|
+
|
|
27
|
+
private func getTrueSheetView(_ tag: NSNumber) -> TrueSheetView {
|
|
28
|
+
// swiftlint:disable force_cast
|
|
29
|
+
return bridge.uiManager.view(forReactTag: tag) as! TrueSheetView
|
|
30
|
+
// swiftlint:enable force_cast
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// MARK: - React Functions
|
|
34
|
+
|
|
35
|
+
@objc
|
|
36
|
+
func present(_ tag: NSNumber, index: Int, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
37
|
+
let trueSheetView = getTrueSheetView(tag)
|
|
38
|
+
trueSheetView.present(at: index, promise: Promise(resolver: resolve, rejecter: reject))
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@objc
|
|
42
|
+
func dismiss(_ tag: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
43
|
+
let trueSheetView = getTrueSheetView(tag)
|
|
44
|
+
trueSheetView.dismiss(promise: Promise(resolver: resolve, rejecter: reject))
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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 Foundation
|
|
10
|
+
|
|
11
|
+
// MARK: - Logger
|
|
12
|
+
|
|
13
|
+
enum Logger {
|
|
14
|
+
/**
|
|
15
|
+
Log a message to the console in the format of `TrueSheet.[caller-function-name]: [message]`
|
|
16
|
+
|
|
17
|
+
@discussion
|
|
18
|
+
If the global ConsoleLogFunction is set, this function also logs to the JavaScript console (console.log, console.trace, console.warn or console.error)
|
|
19
|
+
This function also always logs to [RCTDefaultLogFunction].
|
|
20
|
+
In non-DEBUG builds, this function is no-op.
|
|
21
|
+
*/
|
|
22
|
+
static func log(level: RCTLogLevel,
|
|
23
|
+
message: String,
|
|
24
|
+
_ file: String = #file,
|
|
25
|
+
_ lineNumber: Int = #line,
|
|
26
|
+
_ function: String = #function) {
|
|
27
|
+
#if DEBUG
|
|
28
|
+
RCTDefaultLogFunction(level, RCTLogSource.native, file, lineNumber as NSNumber, "TrueSheet[\(function)]: \(message)")
|
|
29
|
+
#endif
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static func info(_ message: String) {
|
|
33
|
+
log(level: .info, message: message)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static func warning(_ message: String) {
|
|
37
|
+
log(level: .warning, message: message)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static func error(_ message: String) {
|
|
41
|
+
log(level: .error, message: message)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -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
|
+
class Promise {
|
|
10
|
+
private let resolver: RCTPromiseResolveBlock
|
|
11
|
+
private let rejecter: RCTPromiseRejectBlock
|
|
12
|
+
|
|
13
|
+
init(resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
|
|
14
|
+
self.resolver = resolver
|
|
15
|
+
self.rejecter = rejecter
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
func reject(message: String) {
|
|
19
|
+
rejecter("Error", message, nil)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
func resolve(_ value: Any?) {
|
|
23
|
+
resolver(value)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TrueSheet = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _TrueSheetModule = require("./TrueSheetModule");
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
const LINKING_ERROR = `The package '@lodev09/react-native-true-sheet' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
13
|
+
ios: "- You have run 'pod install'\n",
|
|
14
|
+
default: ''
|
|
15
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
16
|
+
const ComponentName = 'TrueSheetView';
|
|
17
|
+
const TrueSheetNativeView = (0, _reactNative.requireNativeComponent)(ComponentName);
|
|
18
|
+
if (!TrueSheetNativeView) {
|
|
19
|
+
throw new Error(LINKING_ERROR);
|
|
20
|
+
}
|
|
21
|
+
class TrueSheet extends _react.PureComponent {
|
|
22
|
+
displayName = 'TrueSheet';
|
|
23
|
+
constructor(props) {
|
|
24
|
+
super(props);
|
|
25
|
+
this.ref = /*#__PURE__*/(0, _react.createRef)();
|
|
26
|
+
this.footerRef = /*#__PURE__*/(0, _react.createRef)();
|
|
27
|
+
this.onDismiss = this.onDismiss.bind(this);
|
|
28
|
+
this.onPresent = this.onPresent.bind(this);
|
|
29
|
+
this.onSizeChange = this.onSizeChange.bind(this);
|
|
30
|
+
this.state = {
|
|
31
|
+
scrollableHandle: null,
|
|
32
|
+
footerHandle: null
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
get handle() {
|
|
36
|
+
const nodeHandle = (0, _reactNative.findNodeHandle)(this.ref.current);
|
|
37
|
+
if (nodeHandle == null || nodeHandle === -1) {
|
|
38
|
+
throw new Error(`Could not get native view tag`);
|
|
39
|
+
}
|
|
40
|
+
return nodeHandle;
|
|
41
|
+
}
|
|
42
|
+
updateHandles() {
|
|
43
|
+
const scrollableHandle = this.props.scrollRef?.current ? (0, _reactNative.findNodeHandle)(this.props.scrollRef.current) : null;
|
|
44
|
+
const footerHandle = (0, _reactNative.findNodeHandle)(this.footerRef.current);
|
|
45
|
+
this.setState({
|
|
46
|
+
footerHandle,
|
|
47
|
+
scrollableHandle
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
onSizeChange(event) {
|
|
51
|
+
this.props.onSizeChange?.(event.nativeEvent);
|
|
52
|
+
}
|
|
53
|
+
onPresent() {
|
|
54
|
+
this.props.onPresent?.();
|
|
55
|
+
}
|
|
56
|
+
onDismiss() {
|
|
57
|
+
this.props.onDismiss?.();
|
|
58
|
+
}
|
|
59
|
+
componentDidMount() {
|
|
60
|
+
this.updateHandles();
|
|
61
|
+
}
|
|
62
|
+
componentDidUpdate() {
|
|
63
|
+
this.updateHandles();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Present the modal sheet at size index.
|
|
68
|
+
* See `sizes` prop
|
|
69
|
+
*/
|
|
70
|
+
async present(index = 0) {
|
|
71
|
+
await _TrueSheetModule.TrueSheetModule.present(this.handle, index);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Dismiss the Sheet
|
|
76
|
+
*/
|
|
77
|
+
async dismiss() {
|
|
78
|
+
await _TrueSheetModule.TrueSheetModule.dismiss(this.handle);
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
const FooterComponent = this.props.FooterComponent;
|
|
82
|
+
return /*#__PURE__*/_react.default.createElement(TrueSheetNativeView, {
|
|
83
|
+
ref: this.ref,
|
|
84
|
+
style: $nativeSheet,
|
|
85
|
+
scrollableHandle: this.state.scrollableHandle,
|
|
86
|
+
footerHandle: this.state.footerHandle,
|
|
87
|
+
sizes: this.props.sizes ?? ['medium', 'large'],
|
|
88
|
+
backgroundColor: this.props.backgroundColor,
|
|
89
|
+
onPresent: this.onPresent,
|
|
90
|
+
onDismiss: this.onDismiss,
|
|
91
|
+
onSizeChange: this.onSizeChange
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
93
|
+
style: this.props.style
|
|
94
|
+
}, this.props.children), !!FooterComponent && /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
95
|
+
ref: this.footerRef
|
|
96
|
+
}, /*#__PURE__*/_react.default.createElement(FooterComponent, null))));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.TrueSheet = TrueSheet;
|
|
100
|
+
const $nativeSheet = {
|
|
101
|
+
position: 'absolute',
|
|
102
|
+
zIndex: -99
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=TrueSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_TrueSheetModule","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","LINKING_ERROR","Platform","select","ios","ComponentName","TrueSheetNativeView","requireNativeComponent","Error","TrueSheet","PureComponent","displayName","constructor","props","ref","createRef","footerRef","onDismiss","bind","onPresent","onSizeChange","state","scrollableHandle","footerHandle","handle","nodeHandle","findNodeHandle","current","updateHandles","scrollRef","setState","event","nativeEvent","componentDidMount","componentDidUpdate","present","index","TrueSheetModule","dismiss","render","FooterComponent","createElement","style","$nativeSheet","sizes","backgroundColor","View","children","exports","position","zIndex"],"sourceRoot":"../../src","sources":["TrueSheet.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAcA,IAAAE,gBAAA,GAAAF,OAAA;AAAmD,SAAAG,yBAAAC,CAA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AE,OAAO,CAAE;MAC/CC,eAAe,EAAE,IAAI,CAAChC,KAAK,CAACgC,eAAgB;MAC5C1B,SAAS,EAAE,IAAI,CAACA,SAAU;MAC1BF,SAAS,EAAE,IAAI,CAACA,SAAU;MAC1BG,YAAY,EAAE,IAAI,CAACA;IAAa,gBAEhC7C,MAAA,CAAAW,OAAA,CAAAuD,aAAA,CAAC/D,YAAA,CAAAoE,IAAI,qBACHvE,MAAA,CAAAW,OAAA,CAAAuD,aAAA,CAAC/D,YAAA,CAAAoE,IAAI;MAACJ,KAAK,EAAE,IAAI,CAAC7B,KAAK,CAAC6B;IAAM,GAAE,IAAI,CAAC7B,KAAK,CAACkC,QAAe,CAAC,EAC1D,CAAC,CAACP,eAAe,iBAChBjE,MAAA,CAAAW,OAAA,CAAAuD,aAAA,CAAC/D,YAAA,CAAAoE,IAAI;MAAChC,GAAG,EAAE,IAAI,CAACE;IAAU,gBACxBzC,MAAA,CAAAW,OAAA,CAAAuD,aAAA,CAACD,eAAe,MAAE,CACd,CAEJ,CACa,CAAC;EAE1B;AACF;AAACQ,OAAA,CAAAvC,SAAA,GAAAA,SAAA;AAED,MAAMkC,YAAuB,GAAG;EAC9BM,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TrueSheetModule = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
const LINKING_ERROR = `The package '@lodev09/react-native-true-sheet' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
9
|
+
ios: "- You have run 'pod install'\n",
|
|
10
|
+
default: ''
|
|
11
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
12
|
+
const TrueSheetModule = exports.TrueSheetModule = _reactNative.NativeModules.TrueSheetViewManager ? _reactNative.NativeModules.TrueSheetViewManager : new Proxy({}, {
|
|
13
|
+
get() {
|
|
14
|
+
throw new Error(LINKING_ERROR);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=TrueSheetModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","TrueSheetModule","exports","NativeModules","TrueSheetViewManager","Proxy","get","Error"],"sourceRoot":"../../src","sources":["TrueSheetModule.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GAChB,2FAA0F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAE1B,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAGE,0BAAa,CAACC,oBAAoB,GAC7DD,0BAAa,CAACC,oBAAoB,GAClC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACX,aAAa,CAAC;EAChC;AACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _types = require("./types");
|
|
7
|
+
Object.keys(_types).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _types[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _TrueSheet = require("./TrueSheet");
|
|
18
|
+
Object.keys(_TrueSheet).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _TrueSheet[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _TrueSheet[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_types","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_TrueSheet"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,UAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,UAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,UAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React, { PureComponent, createRef } from 'react';
|
|
2
|
+
import { requireNativeComponent, Platform, findNodeHandle, View } from 'react-native';
|
|
3
|
+
import { TrueSheetModule } from './TrueSheetModule';
|
|
4
|
+
const LINKING_ERROR = `The package '@lodev09/react-native-true-sheet' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
5
|
+
ios: "- You have run 'pod install'\n",
|
|
6
|
+
default: ''
|
|
7
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
8
|
+
const ComponentName = 'TrueSheetView';
|
|
9
|
+
const TrueSheetNativeView = requireNativeComponent(ComponentName);
|
|
10
|
+
if (!TrueSheetNativeView) {
|
|
11
|
+
throw new Error(LINKING_ERROR);
|
|
12
|
+
}
|
|
13
|
+
export class TrueSheet extends PureComponent {
|
|
14
|
+
displayName = 'TrueSheet';
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
this.ref = /*#__PURE__*/createRef();
|
|
18
|
+
this.footerRef = /*#__PURE__*/createRef();
|
|
19
|
+
this.onDismiss = this.onDismiss.bind(this);
|
|
20
|
+
this.onPresent = this.onPresent.bind(this);
|
|
21
|
+
this.onSizeChange = this.onSizeChange.bind(this);
|
|
22
|
+
this.state = {
|
|
23
|
+
scrollableHandle: null,
|
|
24
|
+
footerHandle: null
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
get handle() {
|
|
28
|
+
const nodeHandle = findNodeHandle(this.ref.current);
|
|
29
|
+
if (nodeHandle == null || nodeHandle === -1) {
|
|
30
|
+
throw new Error(`Could not get native view tag`);
|
|
31
|
+
}
|
|
32
|
+
return nodeHandle;
|
|
33
|
+
}
|
|
34
|
+
updateHandles() {
|
|
35
|
+
const scrollableHandle = this.props.scrollRef?.current ? findNodeHandle(this.props.scrollRef.current) : null;
|
|
36
|
+
const footerHandle = findNodeHandle(this.footerRef.current);
|
|
37
|
+
this.setState({
|
|
38
|
+
footerHandle,
|
|
39
|
+
scrollableHandle
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
onSizeChange(event) {
|
|
43
|
+
this.props.onSizeChange?.(event.nativeEvent);
|
|
44
|
+
}
|
|
45
|
+
onPresent() {
|
|
46
|
+
this.props.onPresent?.();
|
|
47
|
+
}
|
|
48
|
+
onDismiss() {
|
|
49
|
+
this.props.onDismiss?.();
|
|
50
|
+
}
|
|
51
|
+
componentDidMount() {
|
|
52
|
+
this.updateHandles();
|
|
53
|
+
}
|
|
54
|
+
componentDidUpdate() {
|
|
55
|
+
this.updateHandles();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Present the modal sheet at size index.
|
|
60
|
+
* See `sizes` prop
|
|
61
|
+
*/
|
|
62
|
+
async present(index = 0) {
|
|
63
|
+
await TrueSheetModule.present(this.handle, index);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Dismiss the Sheet
|
|
68
|
+
*/
|
|
69
|
+
async dismiss() {
|
|
70
|
+
await TrueSheetModule.dismiss(this.handle);
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
const FooterComponent = this.props.FooterComponent;
|
|
74
|
+
return /*#__PURE__*/React.createElement(TrueSheetNativeView, {
|
|
75
|
+
ref: this.ref,
|
|
76
|
+
style: $nativeSheet,
|
|
77
|
+
scrollableHandle: this.state.scrollableHandle,
|
|
78
|
+
footerHandle: this.state.footerHandle,
|
|
79
|
+
sizes: this.props.sizes ?? ['medium', 'large'],
|
|
80
|
+
backgroundColor: this.props.backgroundColor,
|
|
81
|
+
onPresent: this.onPresent,
|
|
82
|
+
onDismiss: this.onDismiss,
|
|
83
|
+
onSizeChange: this.onSizeChange
|
|
84
|
+
}, /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
85
|
+
style: this.props.style
|
|
86
|
+
}, this.props.children), !!FooterComponent && /*#__PURE__*/React.createElement(View, {
|
|
87
|
+
ref: this.footerRef
|
|
88
|
+
}, /*#__PURE__*/React.createElement(FooterComponent, null))));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const $nativeSheet = {
|
|
92
|
+
position: 'absolute',
|
|
93
|
+
zIndex: -99
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=TrueSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","PureComponent","createRef","requireNativeComponent","Platform","findNodeHandle","View","TrueSheetModule","LINKING_ERROR","select","ios","default","ComponentName","TrueSheetNativeView","Error","TrueSheet","displayName","constructor","props","ref","footerRef","onDismiss","bind","onPresent","onSizeChange","state","scrollableHandle","footerHandle","handle","nodeHandle","current","updateHandles","scrollRef","setState","event","nativeEvent","componentDidMount","componentDidUpdate","present","index","dismiss","render","FooterComponent","createElement","style","$nativeSheet","sizes","backgroundColor","children","position","zIndex"],"sourceRoot":"../../src","sources":["TrueSheet.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAA6BC,SAAS,QAAwB,OAAO;AAClG,SACEC,sBAAsB,EACtBC,QAAQ,EACRC,cAAc,EAGdC,IAAI,QAKC,cAAc;AAGrB,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,MAAMC,aAAa,GAChB,2FAA0F,GAC3FJ,QAAQ,CAACK,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,aAAa,GAAG,eAAe;AAcrC,MAAMC,mBAAmB,GAAGV,sBAAsB,CAA2BS,aAAa,CAAC;AAE3F,IAAI,CAACC,mBAAmB,EAAE;EACxB,MAAM,IAAIC,KAAK,CAACN,aAAa,CAAC;AAChC;AAUA,OAAO,MAAMO,SAAS,SAASd,aAAa,CAAiC;EAC3Ee,WAAW,GAAG,WAAW;EAK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AK,CAAC0B;IAAM,GAAE,IAAI,CAAC1B,KAAK,CAAC8B,QAAe,CAAC,EAC1D,CAAC,CAACN,eAAe,iBAChB1C,KAAA,CAAA2C,aAAA,CAACrC,IAAI;MAACa,GAAG,EAAE,IAAI,CAACC;IAAU,gBACxBpB,KAAA,CAAA2C,aAAA,CAACD,eAAe,MAAE,CACd,CAEJ,CACa,CAAC;EAE1B;AACF;AAEA,MAAMG,YAAuB,GAAG;EAC9BI,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
const LINKING_ERROR = `The package '@lodev09/react-native-true-sheet' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
3
|
+
ios: "- You have run 'pod install'\n",
|
|
4
|
+
default: ''
|
|
5
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
6
|
+
export const TrueSheetModule = NativeModules.TrueSheetViewManager ? NativeModules.TrueSheetViewManager : new Proxy({}, {
|
|
7
|
+
get() {
|
|
8
|
+
throw new Error(LINKING_ERROR);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=TrueSheetModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","TrueSheetModule","TrueSheetViewManager","Proxy","get","Error"],"sourceRoot":"../../src","sources":["TrueSheetModule.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GAChB,2FAA0F,GAC3FD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,OAAO,MAAMC,eAAe,GAAGN,aAAa,CAACO,oBAAoB,GAC7DP,aAAa,CAACO,oBAAoB,GAClC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,cAAc,SAAS;AACvB,cAAc,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PureComponent, type ReactNode } from 'react';
|
|
2
|
+
import type { TrueSheetProps } from './types';
|
|
3
|
+
interface TrueSheetState {
|
|
4
|
+
scrollableHandle: number | null;
|
|
5
|
+
footerHandle: number | null;
|
|
6
|
+
}
|
|
7
|
+
export declare class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
|
|
8
|
+
displayName: string;
|
|
9
|
+
private readonly ref;
|
|
10
|
+
private readonly footerRef;
|
|
11
|
+
constructor(props: TrueSheetProps);
|
|
12
|
+
private get handle();
|
|
13
|
+
private updateHandles;
|
|
14
|
+
private onSizeChange;
|
|
15
|
+
private onPresent;
|
|
16
|
+
private onDismiss;
|
|
17
|
+
componentDidMount(): void;
|
|
18
|
+
componentDidUpdate(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Present the modal sheet at size index.
|
|
21
|
+
* See `sizes` prop
|
|
22
|
+
*/
|
|
23
|
+
present(index?: number): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Dismiss the Sheet
|
|
26
|
+
*/
|
|
27
|
+
dismiss(): Promise<void>;
|
|
28
|
+
render(): ReactNode;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=TrueSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrueSheet.d.ts","sourceRoot":"","sources":["../../../src/TrueSheet.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAclG,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAA;AAgC9D,UAAU,cAAc;IACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED,qBAAa,SAAU,SAAQ,aAAa,CAAC,cAAc,EAAE,cAAc,CAAC;IAC1E,WAAW,SAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAsB;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsB;gBAEpC,KAAK,EAAE,cAAc;IAgBjC,OAAO,KAAK,MAAM,GAOjB;IAED,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,SAAS;IAIjB,iBAAiB,IAAI,IAAI;IAIzB,kBAAkB,IAAI,IAAI;IAI1B;;;OAGG;IACU,OAAO,CAAC,KAAK,GAAE,MAAU;IAItC;;OAEG;IACU,OAAO;IAIpB,MAAM,IAAI,SAAS;CA0BpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrueSheetModule.d.ts","sourceRoot":"","sources":["../../../src/TrueSheetModule.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,KASvB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA"}
|