react-native-sheet2 1.1.19 → 1.1.21

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.
@@ -15,7 +15,13 @@ class ModalHostShadowView: RCTShadowView {
15
15
  override func insertReactSubview(_ subview: RCTShadowView!, at atIndex: Int) {
16
16
  super.insertReactSubview(subview, at: atIndex)
17
17
  if subview != nil {
18
- (subview as RCTShadowView).width = YGValue.init(value: Float(RCTScreenSize().width), unit: .point)
18
+ let s = RCTScreenSize()
19
+ let orientation = UIDevice.current.orientation
20
+ var width = s.width
21
+ if orientation == .landscapeLeft || orientation == .landscapeRight {
22
+ width = s.height
23
+ }
24
+ (subview as RCTShadowView).width = YGValue.init(value: Float(width), unit: .point)
19
25
  subview.position = .absolute
20
26
  }
21
27
  }
@@ -158,6 +164,7 @@ class HostFittedSheet: UIView {
158
164
  @objc
159
165
  var fittedSheetParams: NSDictionary? {
160
166
  didSet {
167
+ debugPrint("😀 ", fittedSheetParams ?? "nil")
161
168
  sheetMaxWidthSize = (fittedSheetParams?["maxWidth"] as? NSNumber)
162
169
  sheetMaxHeightSize = (fittedSheetParams?["maxHeight"] as? NSNumber)
163
170
  sheetMinHeightSize = (fittedSheetParams?["minHeight"] as? NSNumber)
@@ -227,8 +234,10 @@ class HostFittedSheet: UIView {
227
234
  self._reactSubview?.layoutIfNeeded()
228
235
  self._reactSubview?.sizeToFit()
229
236
  size = self._reactSubview?.frame.size ?? .zero
237
+ debugPrint("😀 self._sheetSize?.floatValue == nil", size)
230
238
  } else {
231
239
  size = .init(width: self.sheetWidth, height: CGFloat(self._sheetSize!.floatValue))
240
+ debugPrint("😀 else", size)
232
241
  }
233
242
  if size.width > self.sheetWidth {
234
243
  size.width = self.sheetWidth
@@ -335,7 +344,7 @@ class HostFittedSheet: UIView {
335
344
  extension UIView {
336
345
  func find(_ nId: String, deepIndex: Int) -> UIView? {
337
346
  if deepIndex >= 10 { return nil }
338
- if self.nativeID == nId || self.accessibilityIdentifier == nId {
347
+ if self.nativeID.contains(nId) || self.accessibilityIdentifier?.contains(nId) == true {
339
348
  return self
340
349
  }
341
350
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-sheet2",
3
- "version": "1.1.19",
3
+ "version": "1.1.21",
4
4
  "description": "Native implementation of Bottom sheet",
5
5
  "main": "src/index",
6
6
  "module": "src/index",
package/src/index.tsx CHANGED
@@ -5,12 +5,8 @@ import {
5
5
  FittedSheetParams,
6
6
  } from './FittedSheet';
7
7
 
8
- export {
9
- FittedSheet,
10
- FITTED_SHEET_SCROLL_VIEW,
11
- useFittedSheetContext,
12
- FittedSheetParams,
13
- };
8
+ export { FittedSheet, FITTED_SHEET_SCROLL_VIEW, useFittedSheetContext };
9
+
10
+ export type { FittedSheetParams };
14
11
 
15
12
  export { TopModal } from './TopModal';
16
- export { TransparentActivityView } from './TransparentActivity';
@@ -1,98 +0,0 @@
1
- import {
2
- findNodeHandle,
3
- NativeModules,
4
- Platform,
5
- requireNativeComponent,
6
- StyleSheet,
7
- View,
8
- } from 'react-native';
9
- import React from 'react';
10
-
11
- const TransparentActivity = requireNativeComponent<any>('TransparentActivity');
12
- const TopModalView = requireNativeComponent<any>('TopModalView');
13
-
14
- interface Props {
15
- onActivityDismiss?: () => void;
16
- children: React.ReactNode;
17
- animated?: boolean;
18
- }
19
-
20
- interface State {
21
- show: boolean;
22
- }
23
-
24
- export class TransparentActivityView extends React.PureComponent<Props, State> {
25
- private sheetRef = React.createRef<any>();
26
-
27
- constructor(props: Props) {
28
- super(props);
29
- this.state = { show: false };
30
- }
31
-
32
- show = () => {
33
- if (this.state.show) return;
34
- this.setState({ show: true });
35
- };
36
-
37
- hide = () => {
38
- if (!this.state.show) return;
39
- const tag = findNodeHandle(this.sheetRef.current);
40
- if (!tag) return;
41
- console.log('[TopModal.hide]', tag);
42
- if (Platform.OS === 'android')
43
- NativeModules.TransparentActivity.dismiss(tag);
44
- else NativeModules.TopModalView.dismiss(tag);
45
- };
46
-
47
- private onDismiss = () => {
48
- console.log('[FittedSheet.onDismiss]');
49
- this.setState({ show: false });
50
- this.props.onActivityDismiss?.();
51
- };
52
-
53
- componentWillUnmount() {
54
- this.hide();
55
- console.log('[TopModal.componentWillUnmount]');
56
- }
57
-
58
- render() {
59
- if (!this.state.show) {
60
- this.hide();
61
- console.log('[TopModal.render.remove]');
62
- return null;
63
- }
64
-
65
- if (Platform.OS === 'android') {
66
- return (
67
- <TransparentActivity
68
- onActivityDismiss={this.onDismiss}
69
- ref={this.sheetRef}
70
- animated={this.props.animated ?? true}
71
- >
72
- <View
73
- accessibilityLabel={'transparent-activity-root-view'}
74
- nativeID={'transparent-activity-root-view'}
75
- style={StyleSheet.absoluteFill}
76
- children={this.props.children}
77
- />
78
- </TransparentActivity>
79
- );
80
- }
81
-
82
- return (
83
- <TopModalView
84
- animationType={'none'}
85
- animated={false}
86
- onModalDismiss={this.onDismiss}
87
- ref={this.sheetRef}
88
- >
89
- <View
90
- accessibilityLabel={'transparent-activity-root-view'}
91
- nativeID={'transparent-activity-root-view'}
92
- style={StyleSheet.absoluteFill}
93
- children={this.props.children}
94
- />
95
- </TopModalView>
96
- );
97
- }
98
- }