@lodev09/react-native-true-sheet 3.5.3 → 3.5.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.
@@ -51,6 +51,7 @@ using namespace facebook::react;
51
51
  BOOL _initialDetentAnimated;
52
52
  BOOL _isSheetUpdatePending;
53
53
  BOOL _pendingLayoutUpdate;
54
+ BOOL _pendingInitialPresentation;
54
55
  }
55
56
 
56
57
  #pragma mark - Initialization
@@ -73,6 +74,7 @@ using namespace facebook::react;
73
74
  _initialDetentAnimated = YES;
74
75
  _scrollable = NO;
75
76
  _isSheetUpdatePending = NO;
77
+ _pendingInitialPresentation = NO;
76
78
  }
77
79
  return self;
78
80
  }
@@ -87,6 +89,9 @@ using namespace facebook::react;
87
89
  if (self.tag > 0) {
88
90
  [TrueSheetModule registerView:self withTag:@(self.tag)];
89
91
  }
92
+
93
+ // Handle pending initial presentation after view is in window hierarchy
94
+ [self presentInitialDetentIfNeeded];
90
95
  }
91
96
 
92
97
  - (void)dealloc {
@@ -247,7 +252,8 @@ using namespace facebook::react;
247
252
  [_controller setupDraggable];
248
253
  } else if (_initialDetentIndex >= 0) {
249
254
  _pendingLayoutUpdate = NO;
250
- [self presentAtIndex:_initialDetentIndex animated:_initialDetentAnimated completion:nil];
255
+ _pendingInitialPresentation = YES;
256
+ [self presentInitialDetentIfNeeded];
251
257
  }
252
258
  }
253
259
 
@@ -495,6 +501,14 @@ using namespace facebook::react;
495
501
 
496
502
  #pragma mark - Private Helpers
497
503
 
504
+ - (void)presentInitialDetentIfNeeded {
505
+ if (!_pendingInitialPresentation || _initialDetentIndex < 0 || _controller.isPresented || !self.window)
506
+ return;
507
+
508
+ _pendingInitialPresentation = NO;
509
+ [self presentAtIndex:_initialDetentIndex animated:_initialDetentAnimated completion:nil];
510
+ }
511
+
498
512
  - (UIViewController *)findPresentingViewController {
499
513
  UIWindow *keyWindow = [WindowUtil keyWindow];
500
514
  if (!keyWindow)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodev09/react-native-true-sheet",
3
- "version": "3.5.3",
3
+ "version": "3.5.4",
4
4
  "description": "The true native bottom sheet experience for your React Native Apps.",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/module/index.js",