@lodev09/react-native-true-sheet 0.1.1 → 0.2.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.
@@ -10,7 +10,7 @@
10
10
  class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
11
11
  // MARK: - React properties
12
12
 
13
- @objc var sizes: [Any] = []
13
+ var sizes: [Any] = ["medium", "large"]
14
14
 
15
15
  // Events
16
16
  @objc var onDismiss: RCTDirectEventBlock?
@@ -33,19 +33,22 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
33
33
  private var footerView: UIView?
34
34
  private var rctScrollView: RCTScrollView?
35
35
 
36
- private var isContentMounted: Bool {
37
- return contentView != nil
38
- }
39
-
40
36
  // Content height minus the footer height for `auto` layout
41
37
  private var contentHeight: CGFloat {
42
38
  guard let contentView else { return 0 }
43
39
 
40
+ var height = contentView.frame.height
41
+
42
+ // Add footer view's height
43
+ if let footerContent = footerView?.subviews.first {
44
+ height += footerContent.bounds.height
45
+ }
46
+
44
47
  // Exclude bottom safe area for consistency with a Scrollable content
45
48
  let window = UIApplication.shared.windows.first(where: { $0.isKeyWindow })
46
49
  let bottomInset = window?.safeAreaInsets.bottom ?? 0
47
50
 
48
- return contentView.frame.height - bottomInset
51
+ return height - bottomInset
49
52
  }
50
53
 
51
54
  // MARK: - Setup
@@ -67,31 +70,6 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
67
70
  fatalError("init(coder:) has not been implemented")
68
71
  }
69
72
 
70
- func viewDidChangeWidth(_ width: CGFloat) {
71
- guard let containerView else { return }
72
-
73
- let size = CGSize(width: width, height: containerView.bounds.height)
74
- bridge.uiManager.setSize(size, for: containerView)
75
-
76
- if let footerView {
77
- bridge.uiManager.setSize(size, for: footerView)
78
- }
79
- }
80
-
81
- func didDismiss() {
82
- isPresented = false
83
- activeIndex = nil
84
-
85
- onDismiss?(nil)
86
- }
87
-
88
- func didChangeSize(_ value: CGFloat, at index: Int) {
89
- if index != activeIndex {
90
- activeIndex = index
91
- onSizeChange?(["index": index, "value": value])
92
- }
93
- }
94
-
95
73
  override func insertReactSubview(_ subview: UIView!, at index: Int) {
96
74
  super.insertReactSubview(subview, at: index)
97
75
 
@@ -129,29 +107,59 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
129
107
  super.layoutSubviews()
130
108
 
131
109
  if let containerView, contentView == nil {
132
- contentView = containerView.subviews.first
133
- setupContentIfNeeded()
110
+ contentView = containerView.subviews[0]
111
+ footerView = containerView.subviews[1]
112
+
113
+ containerView.pinTo(view: viewController.view)
114
+
115
+ // Setup content constraints
116
+ setupContent()
117
+ }
118
+ }
119
+
120
+ // MARK: - ViewController delegate
121
+
122
+ func viewControllerDidChangeWidth(_ width: CGFloat) {
123
+ guard let containerView else { return }
124
+
125
+ let size = CGSize(width: width, height: containerView.bounds.height)
126
+ bridge.uiManager.setSize(size, for: containerView)
127
+
128
+ if let footerView {
129
+ bridge.uiManager.setSize(size, for: footerView)
130
+ }
131
+ }
132
+
133
+ func viewControllerWillAppear() {
134
+ setupContent()
135
+ }
136
+
137
+ func viewControllerDidDismiss() {
138
+ isPresented = false
139
+ activeIndex = nil
140
+
141
+ onDismiss?(nil)
142
+ }
143
+
144
+ func viewControllerSheetDidChangeSize(_ value: CGFloat, at index: Int) {
145
+ if index != activeIndex {
146
+ activeIndex = index
147
+ onSizeChange?(["index": index, "value": value])
134
148
  }
135
149
  }
136
150
 
137
151
  // MARK: - Prop setters
138
152
 
139
153
  @objc
140
- func setScrollableHandle(_ tag: NSNumber?) {
141
- let view = bridge.uiManager.view(forReactTag: tag) as? RCTScrollView
142
- rctScrollView = view
143
- setupContentIfNeeded()
154
+ func setSizes(_ sizes: [Any]) {
155
+ self.sizes = sizes
156
+ configureSheetIfPresented()
144
157
  }
145
158
 
146
159
  @objc
147
- func setFooterHandle(_ tag: NSNumber?) {
148
- let view = bridge.uiManager.view(forReactTag: tag)
149
- footerView = view
150
- setupContentIfNeeded()
151
-
152
- if #available(iOS 16.0, *) {
153
- viewController.sheet?.invalidateDetents()
154
- }
160
+ func setScrollableHandle(_ tag: NSNumber?) {
161
+ let view = bridge.uiManager.view(forReactTag: tag) as? RCTScrollView
162
+ rctScrollView = view
155
163
  }
156
164
 
157
165
  func invalidate() {
@@ -160,32 +168,41 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
160
168
 
161
169
  // MARK: - Methods
162
170
 
163
- func setupContentIfNeeded() {
164
- guard isContentMounted, let containerView else { return }
171
+ func configureSheetIfPresented() {
172
+ // Resize sheet
173
+ if #available(iOS 15.0, *), isPresented {
174
+ viewController.configureSheet(for: sizes, at: activeIndex ?? 0, with: contentHeight, nil)
175
+ }
176
+ }
165
177
 
166
- containerView.pinTo(view: viewController.view)
178
+ func dismiss(promise: Promise) {
179
+ if isPresented {
180
+ viewController.dismiss(animated: true) {
181
+ promise.resolve(true)
182
+ }
183
+ }
184
+ }
185
+
186
+ func setupContent() {
187
+ guard let contentView, let containerView else { return }
167
188
 
168
189
  // Add constraints to fix weirdness and support ScrollView
169
- if let contentView, let rctScrollView {
170
- contentView.pinTo(view: containerView)
171
- rctScrollView.pinTo(view: contentView)
190
+ if let rctScrollView {
191
+ contentView.pinTo(view: containerView)
192
+ rctScrollView.pinTo(view: contentView)
172
193
  }
173
194
 
174
195
  // Pin footer at the bottom
175
196
  if let footerView {
176
197
  containerView.bringSubviewToFront(footerView)
177
- footerView.pinTo(
178
- view: containerView,
179
- from: [.bottom, .left, .right],
180
- with: footerView.frame.height
181
- )
182
- }
183
- }
184
-
185
- func dismiss(promise: Promise) {
186
- if isPresented {
187
- viewController.dismiss(animated: true) {
188
- promise.resolve(true)
198
+ if let footerContent = footerView.subviews.first {
199
+ footerView.pinTo(
200
+ view: viewController.view,
201
+ from: [.bottom, .left, .right],
202
+ with: footerContent.bounds.height
203
+ )
204
+ } else {
205
+ footerView.removeConstraints(footerView.constraints)
189
206
  }
190
207
  }
191
208
  }
@@ -198,37 +215,20 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
198
215
  return
199
216
  }
200
217
 
201
- if #available(iOS 15.0, *), let sheet = viewController.sheet {
202
- viewController.configureSheet(for: sizes, with: contentHeight)
203
-
204
- guard sizes.indices.contains(index) else {
205
- promise.reject(message: "Size at \(index) is not configured.")
206
- return
207
- }
208
-
209
- var identifier: UISheetPresentationController.Detent.Identifier = .medium
210
-
211
- if sheet.detents.indices.contains(index) {
212
- let detent = sheet.detents[index]
213
- if #available(iOS 16.0, *) {
214
- identifier = detent.identifier
215
- } else if detent == .large() {
216
- identifier = .large
217
- }
218
- }
219
-
220
- if isPresented {
221
- sheet.animateChanges {
222
- sheet.selectedDetentIdentifier = identifier
218
+ guard sizes.indices.contains(index) else {
219
+ promise.reject(message: "Size at \(index) is not configured.")
220
+ return
221
+ }
223
222
 
223
+ if #available(iOS 15.0, *) {
224
+ viewController.configureSheet(for: sizes, at: index, with: contentHeight) {
225
+ if self.isPresented {
224
226
  // Notify when size is changed programatically
225
- let info = viewController.detentValues.first(where: { $0.value.index == index })
227
+ let info = self.viewController.detentValues.first(where: { $0.value.index == index })
226
228
  if let sizeValue = info?.value.value {
227
- self.didChangeSize(sizeValue, at: index)
229
+ self.viewControllerSheetDidChangeSize(sizeValue, at: index)
228
230
  }
229
231
  }
230
- } else {
231
- sheet.selectedDetentIdentifier = identifier
232
232
  }
233
233
  }
234
234
 
@@ -16,14 +16,10 @@ struct SizeInfo {
16
16
  // MARK: - TrueSheetViewControllerDelegate
17
17
 
18
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)
19
+ func viewControllerDidChangeWidth(_ width: CGFloat)
20
+ func viewControllerDidDismiss()
21
+ func viewControllerSheetDidChangeSize(_ value: CGFloat, at index: Int)
22
+ func viewControllerWillAppear()
27
23
  }
28
24
 
29
25
  // MARK: - TrueSheetViewController
@@ -47,13 +43,18 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
47
43
  func sheetPresentationControllerDidChangeSelectedDetentIdentifier(_ sheet: UISheetPresentationController) {
48
44
  if let identifer = sheet.selectedDetentIdentifier,
49
45
  let size = detentValues[identifer.rawValue] {
50
- delegate?.didChangeSize(size.value, at: size.index)
46
+ delegate?.viewControllerSheetDidChangeSize(size.value, at: size.index)
51
47
  }
52
48
  }
53
49
 
50
+ override func viewWillAppear(_ animated: Bool) {
51
+ super.viewWillAppear(animated)
52
+ delegate?.viewControllerWillAppear()
53
+ }
54
+
54
55
  override func viewDidDisappear(_ animated: Bool) {
55
56
  super.viewDidDisappear(animated)
56
- delegate?.didDismiss()
57
+ delegate?.viewControllerDidDismiss()
57
58
  }
58
59
 
59
60
  /// This is called multiple times while sheet is being dragged.
@@ -62,7 +63,7 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
62
63
  super.viewDidLayoutSubviews()
63
64
 
64
65
  if lastViewWidth != view.frame.width {
65
- delegate?.viewDidChangeWidth(view.bounds.width)
66
+ delegate?.viewControllerDidChangeWidth(view.bounds.width)
66
67
  lastViewWidth = view.frame.width
67
68
  }
68
69
  }
@@ -70,17 +71,14 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
70
71
  /// Prepares the view controller for sheet presentation
71
72
  /// Do nothing on IOS 14 and below... sad
72
73
  @available(iOS 15.0, *)
73
- func configureSheet(for sizes: [Any], with height: CGFloat) {
74
+ func configureSheet(for sizes: [Any], at index: Int = 0, with height: CGFloat, _ completion: (() -> Void)?) {
74
75
  guard let sheet else { return }
75
76
 
76
77
  detentValues = [:]
77
78
 
78
79
  var detents: [UISheetPresentationController.Detent] = []
79
80
 
80
- // Default to medium and large
81
- let sheetSizes = sizes.isEmpty ? ["medium", "large"] : sizes
82
-
83
- for (index, size) in sheetSizes.enumerated() {
81
+ for (index, size) in sizes.enumerated() {
84
82
  let detent = detentFor(size, with: height) { id, value in
85
83
  self.detentValues[id] = SizeInfo(index: index, value: value)
86
84
  }
@@ -94,5 +92,21 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
94
92
  // sheet.prefersScrollingExpandsWhenScrolledToEdge = false
95
93
 
96
94
  sheet.delegate = self
95
+
96
+ var identifier: UISheetPresentationController.Detent.Identifier = .medium
97
+
98
+ if sheet.detents.indices.contains(index) {
99
+ let detent = sheet.detents[index]
100
+ if #available(iOS 16.0, *) {
101
+ identifier = detent.identifier
102
+ } else if detent == .large() {
103
+ identifier = .large
104
+ }
105
+ }
106
+
107
+ sheet.animateChanges {
108
+ sheet.selectedDetentIdentifier = identifier
109
+ completion?()
110
+ }
97
111
  }
98
112
  }
@@ -23,13 +23,11 @@ class TrueSheet extends _react.PureComponent {
23
23
  constructor(props) {
24
24
  super(props);
25
25
  this.ref = /*#__PURE__*/(0, _react.createRef)();
26
- this.footerRef = /*#__PURE__*/(0, _react.createRef)();
27
26
  this.onDismiss = this.onDismiss.bind(this);
28
27
  this.onPresent = this.onPresent.bind(this);
29
28
  this.onSizeChange = this.onSizeChange.bind(this);
30
29
  this.state = {
31
- scrollableHandle: null,
32
- footerHandle: null
30
+ scrollableHandle: null
33
31
  };
34
32
  }
35
33
  get handle() {
@@ -41,9 +39,7 @@ class TrueSheet extends _react.PureComponent {
41
39
  }
42
40
  updateHandles() {
43
41
  const scrollableHandle = this.props.scrollRef?.current ? (0, _reactNative.findNodeHandle)(this.props.scrollRef.current) : null;
44
- const footerHandle = (0, _reactNative.findNodeHandle)(this.footerRef.current);
45
42
  this.setState({
46
- footerHandle,
47
43
  scrollableHandle
48
44
  });
49
45
  }
@@ -83,7 +79,6 @@ class TrueSheet extends _react.PureComponent {
83
79
  ref: this.ref,
84
80
  style: $nativeSheet,
85
81
  scrollableHandle: this.state.scrollableHandle,
86
- footerHandle: this.state.footerHandle,
87
82
  sizes: this.props.sizes ?? ['medium', 'large'],
88
83
  onPresent: this.onPresent,
89
84
  onDismiss: this.onDismiss,
@@ -94,9 +89,7 @@ class TrueSheet extends _react.PureComponent {
94
89
  }
95
90
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
96
91
  style: this.props.style
97
- }, this.props.children), !!FooterComponent && /*#__PURE__*/_react.default.createElement(_reactNative.View, {
98
- ref: this.footerRef
99
- }, /*#__PURE__*/_react.default.createElement(FooterComponent, null))));
92
+ }, this.props.children), /*#__PURE__*/_react.default.createElement(_reactNative.View, null, !!FooterComponent && /*#__PURE__*/_react.default.createElement(FooterComponent, null))));
100
93
  }
101
94
  }
102
95
  exports.TrueSheet = TrueSheet;
@@ -1 +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","View","backgroundColor","children","exports","position","zIndex"],"sourceRoot":"../../src","sources":["TrueSheet.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAaA,IAAAE,gBAAA,GAAAF,OAAA;AAAmD,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAA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EAAE,IAAI,CAACA,SAAU;MAC1BG,YAAY,EAAE,IAAI,CAACA;IAAa,gBAEhC7C,MAAA,CAAAW,OAAA,CAAAuD,aAAA,CAAC/D,YAAA,CAAAmE,IAAI;MAACH,KAAK,EAAE;QAAEI,eAAe,EAAE,IAAI,CAACjC,KAAK,CAACiC,eAAe,IAAI;MAAQ;IAAE,gBACtEvE,MAAA,CAAAW,OAAA,CAAAuD,aAAA,CAAC/D,YAAA,CAAAmE,IAAI;MAACH,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,CAAAmE,IAAI;MAAC/B,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":[]}
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","onDismiss","bind","onPresent","onSizeChange","state","scrollableHandle","handle","nodeHandle","findNodeHandle","current","updateHandles","scrollRef","setState","event","nativeEvent","componentDidMount","componentDidUpdate","present","index","TrueSheetModule","dismiss","render","FooterComponent","createElement","style","$nativeSheet","sizes","View","backgroundColor","children","exports","position","zIndex"],"sourceRoot":"../../src","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,EAAE,IAAI,CAACA,SAAU;MAC1BG,YAAY,EAAE,IAAI,CAACA;IAAa,gBAEhC5C,MAAA,CAAAW,OAAA,CAAAqD,aAAA,CAAC7D,YAAA,CAAAiE,IAAI;MAACH,KAAK,EAAE;QAAEI,eAAe,EAAE,IAAI,CAAC/B,KAAK,CAAC+B,eAAe,IAAI;MAAQ;IAAE,gBACtErE,MAAA,CAAAW,OAAA,CAAAqD,aAAA,CAAC7D,YAAA,CAAAiE,IAAI;MAACH,KAAK,EAAE,IAAI,CAAC3B,KAAK,CAAC2B;IAAM,GAAE,IAAI,CAAC3B,KAAK,CAACgC,QAAe,CAAC,eAC3DtE,MAAA,CAAAW,OAAA,CAAAqD,aAAA,CAAC7D,YAAA,CAAAiE,IAAI,QAAE,CAAC,CAACL,eAAe,iBAAI/D,MAAA,CAAAW,OAAA,CAAAqD,aAAA,CAACD,eAAe,MAAE,CAAQ,CAClD,CACa,CAAC;EAE1B;AACF;AAACQ,OAAA,CAAArC,SAAA,GAAAA,SAAA;AAED,MAAMgC,YAAuB,GAAG;EAC9BM,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]}
@@ -15,13 +15,11 @@ export class TrueSheet extends PureComponent {
15
15
  constructor(props) {
16
16
  super(props);
17
17
  this.ref = /*#__PURE__*/createRef();
18
- this.footerRef = /*#__PURE__*/createRef();
19
18
  this.onDismiss = this.onDismiss.bind(this);
20
19
  this.onPresent = this.onPresent.bind(this);
21
20
  this.onSizeChange = this.onSizeChange.bind(this);
22
21
  this.state = {
23
- scrollableHandle: null,
24
- footerHandle: null
22
+ scrollableHandle: null
25
23
  };
26
24
  }
27
25
  get handle() {
@@ -33,9 +31,7 @@ export class TrueSheet extends PureComponent {
33
31
  }
34
32
  updateHandles() {
35
33
  const scrollableHandle = this.props.scrollRef?.current ? findNodeHandle(this.props.scrollRef.current) : null;
36
- const footerHandle = findNodeHandle(this.footerRef.current);
37
34
  this.setState({
38
- footerHandle,
39
35
  scrollableHandle
40
36
  });
41
37
  }
@@ -75,7 +71,6 @@ export class TrueSheet extends PureComponent {
75
71
  ref: this.ref,
76
72
  style: $nativeSheet,
77
73
  scrollableHandle: this.state.scrollableHandle,
78
- footerHandle: this.state.footerHandle,
79
74
  sizes: this.props.sizes ?? ['medium', 'large'],
80
75
  onPresent: this.onPresent,
81
76
  onDismiss: this.onDismiss,
@@ -86,9 +81,7 @@ export class TrueSheet extends PureComponent {
86
81
  }
87
82
  }, /*#__PURE__*/React.createElement(View, {
88
83
  style: this.props.style
89
- }, this.props.children), !!FooterComponent && /*#__PURE__*/React.createElement(View, {
90
- ref: this.footerRef
91
- }, /*#__PURE__*/React.createElement(FooterComponent, null))));
84
+ }, this.props.children), /*#__PURE__*/React.createElement(View, null, !!FooterComponent && /*#__PURE__*/React.createElement(FooterComponent, null))));
92
85
  }
93
86
  }
94
87
  const $nativeSheet = {
@@ -1 +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,QAIC,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,C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AS,EAAE,IAAI,CAACA,SAAU;MAC1BF,SAAS,EAAE,IAAI,CAACA,SAAU;MAC1BG,YAAY,EAAE,IAAI,CAACA;IAAa,gBAEhCxB,KAAA,CAAA2C,aAAA,CAACrC,IAAI;MAACsC,KAAK,EAAE;QAAEG,eAAe,EAAE,IAAI,CAAC7B,KAAK,CAAC6B,eAAe,IAAI;MAAQ;IAAE,gBACtE/C,KAAA,CAAA2C,aAAA,CAACrC,IAAI;MAACsC,KAAK,EAAE,IAAI,CAAC1B,KAAK,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":[]}
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","onDismiss","bind","onPresent","onSizeChange","state","scrollableHandle","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,EACdC,IAAI,QAKC,cAAc;AAGrB,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,MAAMC,aAAa,GAChB,2FAA0F,GAC3FJ,Q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AAA,CAACnC,IAAI;MAACoC,KAAK,EAAE;QAAEG,eAAe,EAAE,IAAI,CAAC3B,KAAK,CAAC2B,eAAe,IAAI;MAAQ;IAAE,gBACtE7C,KAAA,CAAAyC,aAAA,CAACnC,IAAI;MAACoC,KAAK,EAAE,IAAI,CAACxB,KAAK,CAACwB;IAAM,GAAE,IAAI,CAACxB,KAAK,CAAC4B,QAAe,CAAC,eAC3D9C,KAAA,CAAAyC,aAAA,CAACnC,IAAI,QAAE,CAAC,CAACkC,eAAe,iBAAIxC,KAAA,CAAAyC,aAAA,CAACD,eAAe,MAAE,CAAQ,CAClD,CACa,CAAC;EAE1B;AACF;AAEA,MAAMG,YAAuB,GAAG;EAC9BI,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]}
@@ -2,12 +2,10 @@ import { PureComponent, type ReactNode } from 'react';
2
2
  import type { TrueSheetProps } from './types';
3
3
  interface TrueSheetState {
4
4
  scrollableHandle: number | null;
5
- footerHandle: number | null;
6
5
  }
7
6
  export declare class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
8
7
  displayName: string;
9
8
  private readonly ref;
10
- private readonly footerRef;
11
9
  constructor(props: TrueSheetProps);
12
10
  private get handle();
13
11
  private updateHandles;
@@ -1 +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;AAalG,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAA;AA+B9D,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;CAyBpB"}
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;AAYlG,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAA;AA6B9D,UAAU,cAAc;IACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC;AAED,qBAAa,SAAU,SAAQ,aAAa,CAAC,cAAc,EAAE,cAAc,CAAC;IAC1E,WAAW,SAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAsB;gBAE9B,KAAK,EAAE,cAAc;IAcjC,OAAO,KAAK,MAAM,GAOjB;IAED,OAAO,CAAC,aAAa;IAUrB,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;CAoBpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodev09/react-native-true-sheet",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "The true native bottom sheet. 💩",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/src/TrueSheet.tsx CHANGED
@@ -3,10 +3,9 @@ import {
3
3
  requireNativeComponent,
4
4
  Platform,
5
5
  findNodeHandle,
6
+ View,
6
7
  type NativeMethods,
7
8
  type ViewStyle,
8
- View,
9
- type ViewProps,
10
9
  type NativeSyntheticEvent,
11
10
  type StyleProp,
12
11
  } from 'react-native'
@@ -24,7 +23,6 @@ const ComponentName = 'TrueSheetView'
24
23
 
25
24
  interface TrueSheetNativeViewProps {
26
25
  scrollableHandle: number | null
27
- footerHandle: number | null
28
26
  onDismiss: () => void
29
27
  onPresent: (event: NativeSyntheticEvent<{ index: number }>) => void
30
28
  onSizeChange: (event: NativeSyntheticEvent<SizeChangeEvent>) => void
@@ -40,24 +38,20 @@ if (!TrueSheetNativeView) {
40
38
  }
41
39
 
42
40
  type NativeRef = Component<TrueSheetNativeViewProps> & Readonly<NativeMethods>
43
- type FooterRef = Component<ViewProps> & Readonly<NativeMethods>
44
41
 
45
42
  interface TrueSheetState {
46
43
  scrollableHandle: number | null
47
- footerHandle: number | null
48
44
  }
49
45
 
50
46
  export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
51
47
  displayName = 'TrueSheet'
52
48
 
53
49
  private readonly ref: RefObject<NativeRef>
54
- private readonly footerRef: RefObject<FooterRef>
55
50
 
56
51
  constructor(props: TrueSheetProps) {
57
52
  super(props)
58
53
 
59
54
  this.ref = createRef<NativeRef>()
60
- this.footerRef = createRef<FooterRef>()
61
55
 
62
56
  this.onDismiss = this.onDismiss.bind(this)
63
57
  this.onPresent = this.onPresent.bind(this)
@@ -65,7 +59,6 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
65
59
 
66
60
  this.state = {
67
61
  scrollableHandle: null,
68
- footerHandle: null,
69
62
  }
70
63
  }
71
64
 
@@ -83,10 +76,7 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
83
76
  ? findNodeHandle(this.props.scrollRef.current)
84
77
  : null
85
78
 
86
- const footerHandle = findNodeHandle(this.footerRef.current)
87
-
88
79
  this.setState({
89
- footerHandle,
90
80
  scrollableHandle,
91
81
  })
92
82
  }
@@ -134,7 +124,6 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
134
124
  ref={this.ref}
135
125
  style={$nativeSheet}
136
126
  scrollableHandle={this.state.scrollableHandle}
137
- footerHandle={this.state.footerHandle}
138
127
  sizes={this.props.sizes ?? ['medium', 'large']}
139
128
  onPresent={this.onPresent}
140
129
  onDismiss={this.onDismiss}
@@ -142,11 +131,7 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
142
131
  >
143
132
  <View style={{ backgroundColor: this.props.backgroundColor ?? 'white' }}>
144
133
  <View style={this.props.style}>{this.props.children}</View>
145
- {!!FooterComponent && (
146
- <View ref={this.footerRef}>
147
- <FooterComponent />
148
- </View>
149
- )}
134
+ <View>{!!FooterComponent && <FooterComponent />}</View>
150
135
  </View>
151
136
  </TrueSheetNativeView>
152
137
  )