@lodev09/react-native-true-sheet 4.0.0-beta.2 → 4.0.0-beta.3

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.
@@ -101,13 +101,30 @@ class TrueSheetView(private val reactContext: ThemedReactContext) :
101
101
 
102
102
  override fun onAttachedToWindow() {
103
103
  super.onAttachedToWindow()
104
+ presentInitialIfNeeded()
105
+ }
104
106
 
105
- if (initialDetentIndex >= 0 && !didInitiallyPresent) {
106
- didInitiallyPresent = true
107
- if (initialDetentAnimated) {
108
- present(initialDetentIndex, true) { }
109
- } else {
110
- post { present(initialDetentIndex, false) { } }
107
+ /**
108
+ * JS holds initialDetentIndex back one commit so effect-driven content (e.g. a
109
+ * navigation footer set via setOptions) commits together with it. The prop then
110
+ * arrives after attach, so the ViewManager triggers this on prop update too.
111
+ * Posted so sibling mounts from the current transaction land before measuring.
112
+ */
113
+ fun presentInitialIfNeeded() {
114
+ if (initialDetentIndex < 0 || didInitiallyPresent || !isAttachedToWindow) return
115
+
116
+ didInitiallyPresent = true
117
+ post {
118
+ // The view may have been dropped (flag reset) or detached before this
119
+ // ran — roll back so a later attach retries instead of presenting a
120
+ // sheet with no live host.
121
+ if (!didInitiallyPresent) return@post
122
+ if (!isAttachedToWindow) {
123
+ didInitiallyPresent = false
124
+ return@post
125
+ }
126
+ if (!viewController.isPresented) {
127
+ present(initialDetentIndex, initialDetentAnimated) { }
111
128
  }
112
129
  }
113
130
  }
@@ -179,6 +179,7 @@ class TrueSheetViewManager :
179
179
  @ReactProp(name = "initialDetentIndex", defaultInt = -1)
180
180
  override fun setInitialDetentIndex(view: TrueSheetView, index: Int) {
181
181
  view.initialDetentIndex = index
182
+ view.presentInitialIfNeeded()
182
183
  }
183
184
 
184
185
  @ReactProp(name = "initialDetentAnimated", defaultBoolean = true)
@@ -25,6 +25,13 @@ void TrueSheetFooterViewShadowNode::adjustLayoutWithState() {
25
25
  float bottomInset = stateData.bottomInset;
26
26
  if (!stateData.initialized && props.autoBottomInset) {
27
27
  bottomInset = TrueSheetInsets::bottomSafeArea();
28
+ if (bottomInset != stateData.bottomInset) {
29
+ // Record the seeded value so the mounted view reads exactly the inset
30
+ // baked into this layout — the global may change before mount.
31
+ auto seededData = stateData;
32
+ seededData.bottomInset = bottomInset;
33
+ setStateData(std::move(seededData));
34
+ }
28
35
  }
29
36
 
30
37
  // A footer pinned to the sheet's bottom edge owns the bottom safe-area
@@ -82,6 +82,11 @@ NS_ASSUME_NONNULL_BEGIN
82
82
  */
83
83
  - (CGFloat)footerHeight;
84
84
 
85
+ /**
86
+ * Returns the bottom inset currently baked into the footer's height
87
+ */
88
+ - (CGFloat)footerAppliedBottomInset;
89
+
85
90
  /**
86
91
  * Returns the current height of the peek view within the content
87
92
  */
@@ -118,6 +118,10 @@ using namespace facebook::react;
118
118
  return _footerView ? _footerView.frame.size.height : 0;
119
119
  }
120
120
 
121
+ - (CGFloat)footerAppliedBottomInset {
122
+ return _footerView ? _footerView.appliedBottomInset : 0;
123
+ }
124
+
121
125
  // Distance from the top of the content view to the bottom of the peek view.
122
126
  // Includes the peek view's offset within the content (padding, views above it)
123
127
  // so the peek detent reveals everything down to the peek content's bottom edge.
@@ -27,6 +27,12 @@ NS_ASSUME_NONNULL_BEGIN
27
27
  @property (nonatomic, weak, nullable) TrueSheetKeyboardObserver *keyboardObserver;
28
28
  @property (nonatomic, weak, nullable) id<TrueSheetFooterViewDelegate> delegate;
29
29
 
30
+ /**
31
+ * Bottom inset currently baked into the footer's layout height — pairs with
32
+ * the measured frame so detent math can subtract exactly what's baked in.
33
+ */
34
+ @property (nonatomic, readonly) CGFloat appliedBottomInset;
35
+
30
36
  /**
31
37
  * Re-applies the footer's keyboard slide using the current keyboard height.
32
38
  * No-op when the keyboard is hidden. Used to reflect live `keyboardOffset` changes.
@@ -25,6 +25,8 @@ using namespace facebook::react;
25
25
  CGFloat _currentKeyboardOffset;
26
26
  CGFloat _bottomInset;
27
27
  BOOL _keyboardVisible;
28
+ BOOL _didPushBottomInset;
29
+ CGFloat _appliedBottomInset;
28
30
  }
29
31
 
30
32
  + (ComponentDescriptorProvider)componentDescriptorProvider {
@@ -43,6 +45,8 @@ using namespace facebook::react;
43
45
  _currentKeyboardOffset = 0;
44
46
  _bottomInset = 0;
45
47
  _keyboardVisible = NO;
48
+ _didPushBottomInset = NO;
49
+ _appliedBottomInset = 0;
46
50
  }
47
51
  return self;
48
52
  }
@@ -55,7 +59,11 @@ using namespace facebook::react;
55
59
  // bottom safe-area inset — the footer owns the sheet's bottom edge, so it
56
60
  // absorbs the inset and its background fills it.
57
61
  - (void)setBottomInset:(CGFloat)bottomInset {
58
- if (_bottomInset == bottomInset) {
62
+ // The first push must go through even when the value matches the ivar
63
+ // default (0) — it marks the state initialized so the shadow node stops
64
+ // seeding from the app-wide precalculated inset, which may belong to
65
+ // another sheet (e.g. a floating sheet whose real inset is 0).
66
+ if (_didPushBottomInset && _bottomInset == bottomInset) {
59
67
  return;
60
68
  }
61
69
  _bottomInset = bottomInset;
@@ -85,6 +93,14 @@ using namespace facebook::react;
85
93
  // them an inset stale (same reason Android bridges through
86
94
  // TrueSheetStateUpdater).
87
95
  _state->updateState(std::move(newState), EventQueue::UpdateMode::unstable_Immediate);
96
+ _didPushBottomInset = YES;
97
+ }
98
+
99
+ // The inset baked into the current layout by the shadow node (pushed or
100
+ // seeded — see TrueSheetFooterViewShadowNode). Refreshed in
101
+ // updateLayoutMetrics so it always pairs with the measured height.
102
+ - (CGFloat)appliedBottomInset {
103
+ return _appliedBottomInset;
88
104
  }
89
105
 
90
106
  // Height the footer occupies above the keyboard — its layout height minus the
@@ -123,8 +139,19 @@ using namespace facebook::react;
123
139
  oldLayoutMetrics:(const facebook::react::LayoutMetrics &)oldLayoutMetrics {
124
140
  [super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
125
141
 
142
+ // State lands before layout metrics within the same mount transaction, so
143
+ // this reflects the inset the shadow node baked into this frame — seeded
144
+ // values are recorded back into the state at layout time (see
145
+ // TrueSheetFooterViewShadowNode).
146
+ CGFloat previousAppliedBottomInset = _appliedBottomInset;
147
+ if (_state) {
148
+ _appliedBottomInset = _state->getData().bottomInset;
149
+ }
150
+
126
151
  CGFloat height = layoutMetrics.frame.size.height;
127
- if (height != _lastHeight) {
152
+ // An inset change alone (fixed-height footer: padding moves, frame doesn't)
153
+ // still changes what's baked in — report so the controller re-pairs.
154
+ if (height != _lastHeight || _appliedBottomInset != previousAppliedBottomInset) {
128
155
  _lastHeight = height;
129
156
  [self.delegate footerViewDidChangeSize:CGSizeMake(layoutMetrics.frame.size.width, height)];
130
157
  }
@@ -143,6 +170,8 @@ using namespace facebook::react;
143
170
  _currentKeyboardOffset = 0;
144
171
  _bottomInset = 0;
145
172
  _keyboardVisible = NO;
173
+ _didPushBottomInset = NO;
174
+ _appliedBottomInset = 0;
146
175
  }
147
176
 
148
177
  #pragma mark - TrueSheetKeyboardObserverDelegate
@@ -110,18 +110,47 @@ using namespace facebook::react;
110
110
  return;
111
111
  }
112
112
 
113
- if (_initialDetentIndex >= 0 && !_didInitiallyPresent) {
114
- UIViewController *vc = [self findPresentingViewController];
113
+ [self presentInitialIfNeeded];
114
+ }
115
115
 
116
- // Only present if the view controller is in the same window and not being dismissed
117
- if (vc && vc.view.window == self.window && !_controller.isBeingDismissed) {
118
- _didInitiallyPresent = YES;
119
- [self presentAtIndex:_initialDetentIndex animated:_initialDetentAnimated completion:nil];
120
- } else {
121
- // Animate next time when sheet finally moves to the correct window
122
- _initialDetentAnimated = YES;
123
- }
116
+ // JS holds initialDetentIndex back one commit so effect-driven content (e.g. a
117
+ // navigation footer set via setOptions) commits together with it — by the time
118
+ // the prop lands the tree is final and the sheet presents at its final height.
119
+ // Called from didMoveToWindow (re-attach) and finalizeUpdates (the prop
120
+ // arriving after attach, which didMoveToWindow won't re-fire for).
121
+ - (void)presentInitialIfNeeded {
122
+ if (_initialDetentIndex < 0 || _didInitiallyPresent)
123
+ return;
124
+
125
+ UIViewController *vc = [self findPresentingViewController];
126
+
127
+ // Only present if the view controller is in the same window and not being dismissed
128
+ if (!vc || vc.view.window != self.window || _controller.isBeingDismissed) {
129
+ // Animate next time when sheet finally moves to the correct window
130
+ _initialDetentAnimated = YES;
131
+ return;
124
132
  }
133
+
134
+ _didInitiallyPresent = YES;
135
+
136
+ // Deferred a runloop turn so sibling mounts from the current transaction
137
+ // (e.g. a footer committed alongside the prop) land before measuring.
138
+ __weak __typeof(self) weakSelf = self;
139
+ dispatch_async(dispatch_get_main_queue(), ^{
140
+ __typeof(self) strongSelf = weakSelf;
141
+ if (!strongSelf || strongSelf->_controller.isPresented || strongSelf->_controller.isBeingPresented)
142
+ return;
143
+
144
+ [strongSelf presentAtIndex:strongSelf->_initialDetentIndex
145
+ animated:strongSelf->_initialDetentAnimated
146
+ completion:^(BOOL success, NSError *_Nullable error) {
147
+ // Present can fail if the view detached during this turn —
148
+ // reset so the next attach/prop update retries.
149
+ if (!success) {
150
+ strongSelf->_didInitiallyPresent = NO;
151
+ }
152
+ }];
153
+ });
125
154
  }
126
155
 
127
156
  - (void)dealloc {
@@ -342,6 +371,9 @@ using namespace facebook::react;
342
371
  _pendingPropsUpdate = YES;
343
372
  } else if (_initialDetentIndex >= 0) {
344
373
  _pendingLayoutUpdate = NO;
374
+ if (self.window) {
375
+ [self presentInitialIfNeeded];
376
+ }
345
377
  }
346
378
  }
347
379
 
@@ -403,9 +435,8 @@ using namespace facebook::react;
403
435
  _controller.headerHeight = @(headerHeight);
404
436
  }
405
437
 
406
- CGFloat footerHeight = [_containerView footerHeight];
407
- if (footerHeight > 0) {
408
- _controller.footerHeight = @(footerHeight);
438
+ if ([_containerView footerHeight] > 0) {
439
+ [self syncFooterMetrics];
409
440
  }
410
441
 
411
442
  CGFloat peekContentHeight = [_containerView peekContentHeight];
@@ -480,11 +511,12 @@ using namespace facebook::react;
480
511
  if (_containerView) {
481
512
  _controller.contentHeight = @([_containerView contentHeight]);
482
513
  _controller.headerHeight = @([_containerView headerHeight]);
483
- _controller.footerHeight = @([_containerView footerHeight]);
514
+ [self syncFooterMetrics];
484
515
  _controller.peekContentHeight = @([_containerView peekContentHeight]);
485
516
  }
486
517
  _pendingSizeChange = NO;
487
518
 
519
+ [self refreshFooterBottomInset];
488
520
  [_controller setupSheetDetents];
489
521
  [_controller setupActiveDetentWithIndex:index];
490
522
 
@@ -583,6 +615,10 @@ using namespace facebook::react;
583
615
  * Debounced sheet update to handle rapid content/header size changes.
584
616
  */
585
617
  - (void)setupSheetDetentsForSizeChange {
618
+ // Keep the footer's absorbed inset in sync with the latest measured heights
619
+ // even before presenting, so the sheet presents at its final size.
620
+ [self refreshFooterBottomInset];
621
+
586
622
  // Retargeting the in-flight presentation makes UIKit snap the whole stack
587
623
  // (including the sheet behind) instead of animating. Defer to didPresent —
588
624
  // presentAtIndex measured synchronously, so this is usually a no-op.
@@ -610,6 +646,7 @@ using namespace facebook::react;
610
646
  // Refresh here (not just on peek size events) since the peek's offset
611
647
  // within the content can change without its own size changing.
612
648
  self->_controller.peekContentHeight = @([self->_containerView peekContentHeight]);
649
+ [self refreshFooterBottomInset];
613
650
  [self->_controller setupSheetDetentsForSizeChange];
614
651
  });
615
652
  }
@@ -625,7 +662,7 @@ using namespace facebook::react;
625
662
  }
626
663
 
627
664
  - (void)containerViewFooterDidChangeSize:(CGSize)newSize {
628
- _controller.footerHeight = @(newSize.height);
665
+ [self syncFooterMetrics];
629
666
  [self setupSheetDetentsForSizeChange];
630
667
  [_controller setupAccessibilityContainer];
631
668
  }
@@ -716,6 +753,10 @@ using namespace facebook::react;
716
753
  [self updateStateWithSize:size];
717
754
  }
718
755
 
756
+ - (void)viewControllerSafeAreaInsetsDidChange {
757
+ [self refreshFooterBottomInset];
758
+ }
759
+
719
760
  - (void)viewControllerWillFocus {
720
761
  [TrueSheetFocusEvents emitWillFocus:_eventEmitter];
721
762
  }
@@ -784,13 +825,36 @@ using namespace facebook::react;
784
825
  _containerView.insetAdjustment = _insetAdjustment;
785
826
  _containerView.scrollableOptions = _scrollableOptions;
786
827
  _containerView.hasAutoDetent = _hasAutoDetent;
787
- _containerView.footerBottomInset = _controller.footerBottomInset;
828
+ [self refreshFooterBottomInset];
788
829
  [_containerView setupScrollable];
830
+ }
831
+
832
+ // footerHeight and appliedFooterBottomInset must stay paired — detent math
833
+ // subtracts exactly the inset baked into the measured footer height (see
834
+ // autoDetentBottomInset/peekDetentBottomInset).
835
+ - (void)syncFooterMetrics {
836
+ _controller.footerHeight = @([_containerView footerHeight]);
837
+ _controller.appliedFooterBottomInset = [_containerView footerAppliedBottomInset];
838
+ }
839
+
840
+ // Recomputes the inset the footer absorbs and pushes it down. The inset
841
+ // depends on measured heights and detents (see maxNaturalDetentHeight), so
842
+ // this runs on size and detent changes — not just prop updates.
843
+ - (void)refreshFooterBottomInset {
844
+ if (!_containerView)
845
+ return;
846
+
847
+ // appliedFooterBottomInset is NOT set here — it tracks what's actually
848
+ // baked into the footer's measured height (reported with its layout), not
849
+ // what was just pushed. Setting it at push time desyncs the pair and lets
850
+ // a seeded inset read as natural content height (see maxNaturalDetentHeight).
851
+ CGFloat inset = _controller.footerBottomInset;
852
+ _containerView.footerBottomInset = inset;
789
853
 
790
854
  // Publish the inset so a footer set later (e.g. navigation setOptions) is
791
855
  // padded on its very first layout instead of resizing the sheet twice.
792
856
  if (_insetAdjustment == TrueSheetViewInsetAdjustment::Automatic) {
793
- TrueSheetInsets::setBottomSafeArea(_controller.footerBottomInset);
857
+ TrueSheetInsets::setBottomSafeArea(inset);
794
858
  }
795
859
  }
796
860
 
@@ -801,6 +865,7 @@ using namespace facebook::react;
801
865
  if (_pendingDetents) {
802
866
  _controller.detents = _pendingDetents;
803
867
  _pendingDetents = nil;
868
+ [self refreshFooterBottomInset];
804
869
  }
805
870
 
806
871
  UIView *presenterView = _controller.presentingViewController.view;
@@ -36,6 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
36
36
  detent:(CGFloat)detent
37
37
  realtime:(BOOL)realtime;
38
38
  - (void)viewControllerDidChangeSize:(CGSize)size;
39
+ - (void)viewControllerSafeAreaInsetsDidChange;
39
40
  - (void)viewControllerWillFocus;
40
41
  - (void)viewControllerDidFocus;
41
42
  - (void)viewControllerWillBlur;
@@ -99,6 +100,14 @@ NS_ASSUME_NONNULL_BEGIN
99
100
  */
100
101
  @property (nonatomic, readonly) CGFloat footerBottomInset;
101
102
 
103
+ /**
104
+ * The inset currently baked into the footer's measured height, reported
105
+ * alongside its layout (see TrueSheetFooterView.appliedBottomInset). Detent
106
+ * resolution subtracts this exact value so the baked inset is never
107
+ * double-counted.
108
+ */
109
+ @property (nonatomic, assign) CGFloat appliedFooterBottomInset;
110
+
102
111
  - (void)setupAccessibilityContainer;
103
112
  - (void)applyActiveDetent;
104
113
  - (void)setupActiveDetentWithIndex:(NSInteger)index;
@@ -70,6 +70,11 @@ static char TrueSheetAccessibilityWindowPreviousElementsKey;
70
70
  BOOL _isDragging;
71
71
  BOOL _isWillDismissEmitted;
72
72
 
73
+ // Last bottom safe area observed while presented — reused as the estimate
74
+ // for the next present (beats the float-threshold guess for re-presents).
75
+ BOOL _hasObservedBottomInset;
76
+ CGFloat _observedBottomInset;
77
+
73
78
  BOOL _isInteractiveDismiss;
74
79
  CGFloat _interactiveStartPosition;
75
80
  UIView *_interactiveContainerView;
@@ -206,6 +211,12 @@ static char TrueSheetAccessibilityWindowPreviousElementsKey;
206
211
  return window ? window.bounds.size.height : UIScreen.mainScreen.bounds.size.height;
207
212
  }
208
213
 
214
+ // Only phone sheets absorb the bottom safe-area inset — non-phone idioms
215
+ // (iPad form sheets) are inset from the screen edge by UIKit.
216
+ static BOOL TrueSheetIsPhoneIdiom(void) {
217
+ return UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone;
218
+ }
219
+
209
220
  - (CGFloat)detentBottomAdjustmentForHeight:(CGFloat)height {
210
221
  if (_insetAdjustment == TrueSheetViewInsetAdjustment::Automatic) {
211
222
  return 0;
@@ -215,7 +226,7 @@ static char TrueSheetAccessibilityWindowPreviousElementsKey;
215
226
  }
216
227
 
217
228
  - (CGFloat)bottomSafeAreaForHeight:(CGFloat)height {
218
- if (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPhone) {
229
+ if (!TrueSheetIsPhoneIdiom()) {
219
230
  return 0;
220
231
  }
221
232
 
@@ -232,49 +243,101 @@ static char TrueSheetAccessibilityWindowPreviousElementsKey;
232
243
  }
233
244
 
234
245
  /**
235
- * Bottom inset excluded from the auto detent. A relative footer owns the
236
- * sheet's bottom edge, so it absorbs the inset UIKit lays custom detents out
237
- * above the safe area, which would otherwise gap the content from the footer.
246
+ * Largest height the sheet can reach across its configured detents, excluding
247
+ * the inset currently baked into the footer's height. Basis for the footer's
248
+ * inset absorption so it follows the same rule as bottomSafeAreaForHeight:
249
+ * a sheet that only ever floats (small detents on iOS 26) keeps its footer
250
+ * unpadded.
238
251
  */
239
- - (CGFloat)autoDetentBottomInsetForHeight:(CGFloat)height {
240
- if (_insetAdjustment != TrueSheetViewInsetAdjustment::Automatic) {
241
- // 'none' already excludes the inset for every detent
242
- return 0;
252
+ - (CGFloat)maxNaturalDetentHeight {
253
+ CGFloat applied = [self.footerHeight floatValue] > 0 ? _appliedFooterBottomInset : 0;
254
+ CGFloat maxHeight = 0;
255
+
256
+ for (id detent in self.detents) {
257
+ if (![detent isKindOfClass:[NSNumber class]]) {
258
+ continue;
259
+ }
260
+
261
+ CGFloat value = [detent doubleValue];
262
+ CGFloat height = 0;
263
+ if (value == -1) {
264
+ // Auto counts a relative footer's (padded) height
265
+ height = [_detentCalculator autoHeight] - (_absoluteFooter ? 0 : applied);
266
+ } else if (value == -2) {
267
+ // Peek counts an absolute footer's (padded) height
268
+ height = [_detentCalculator peekHeight] - (_absoluteFooter ? applied : 0);
269
+ } else if (value > 0 && value <= 1) {
270
+ height = value * self.screenHeight;
271
+ }
272
+ maxHeight = fmax(maxHeight, height);
243
273
  }
244
274
 
245
- if (_absoluteFooter || [self.footerHeight floatValue] <= 0) {
246
- return 0;
275
+ if (self.maxContentHeight) {
276
+ maxHeight = fmin(maxHeight, [self.maxContentHeight floatValue]);
247
277
  }
248
278
 
249
- return [self bottomSafeAreaForHeight:height];
279
+ return maxHeight > 0 ? maxHeight : self.screenHeight;
250
280
  }
251
281
 
252
- // The inset the footer absorbs as padding. Uses the auto detent height when
253
- // available so it matches the auto detent's inset exclusion above.
282
+ // The inset the footer absorbs as padding.
254
283
  - (CGFloat)footerBottomInset {
255
284
  if (_insetAdjustment != TrueSheetViewInsetAdjustment::Automatic) {
256
285
  return 0;
257
286
  }
258
287
 
259
- return [self bottomSafeAreaForHeight:_autoDetentHeight > 0 ? _autoDetentHeight : self.screenHeight];
288
+ // Early out so the maxNaturalDetentHeight fallback below doesn't run per
289
+ // layout pass on iPad only to be zeroed by bottomSafeAreaForHeight:.
290
+ if (!TrueSheetIsPhoneIdiom()) {
291
+ return 0;
292
+ }
293
+
294
+ // Once laid out, the sheet's own safe area is the authority — it reflects
295
+ // UIKit's actual float/anchored decision (a floating sheet gets 0), where
296
+ // bottomSafeAreaForHeight: can only guess the float threshold. Guessing
297
+ // wrong leaves the safe-area region unfilled (gap) or double-padded.
298
+ UIView *view = self.viewIfLoaded;
299
+ if (view.window) {
300
+ _hasObservedBottomInset = YES;
301
+ _observedBottomInset = view.safeAreaInsets.bottom;
302
+ return _observedBottomInset;
303
+ }
304
+
305
+ // Off-window while presented (e.g. hidden behind a native screen): the last
306
+ // observed value is this sheet's own truth — prefer it over the
307
+ // float-threshold guess. Cleared on dismiss so a re-present observes fresh
308
+ // geometry (rotation or detent changes while dismissed would stale it).
309
+ if (_hasObservedBottomInset) {
310
+ return _observedBottomInset;
311
+ }
312
+
313
+ return [self bottomSafeAreaForHeight:[self maxNaturalDetentHeight]];
260
314
  }
261
315
 
262
316
  /**
263
- * Bottom inset excluded from the peek detent. An absolute footer counts
264
- * toward the peek height and absorbs the inset as padding, but UIKit already
265
- * lays custom detents out above the safe area — subtract it so the inset
266
- * isn't doubled.
317
+ * Bottom inset excluded from the auto detent. A relative footer owns the
318
+ * sheet's bottom edge and carries the inset in its height (see
319
+ * footerBottomInset) subtract exactly what was baked in so UIKit's own
320
+ * safe-area layout doesn't double it.
267
321
  */
268
- - (CGFloat)peekDetentBottomInsetForHeight:(CGFloat)height {
269
- if (_insetAdjustment != TrueSheetViewInsetAdjustment::Automatic) {
322
+ - (CGFloat)autoDetentBottomInset {
323
+ if (_absoluteFooter || [self.footerHeight floatValue] <= 0) {
270
324
  return 0;
271
325
  }
272
326
 
327
+ return _appliedFooterBottomInset;
328
+ }
329
+
330
+ /**
331
+ * Bottom inset excluded from the peek detent. An absolute footer counts
332
+ * toward the peek height and carries the inset in its height — subtract
333
+ * exactly what was baked in so it isn't doubled.
334
+ */
335
+ - (CGFloat)peekDetentBottomInset {
273
336
  if (!_absoluteFooter || [self.footerHeight floatValue] <= 0) {
274
337
  return 0;
275
338
  }
276
339
 
277
- return [self bottomSafeAreaForHeight:height];
340
+ return _appliedFooterBottomInset;
278
341
  }
279
342
 
280
343
  - (BOOL)isDesignCompatibilityMode {
@@ -520,6 +583,7 @@ static char TrueSheetAccessibilityWindowPreviousElementsKey;
520
583
  [self restoreWindowAccessibilityElements];
521
584
  _isPresented = NO;
522
585
  _isWillDismissEmitted = NO;
586
+ _hasObservedBottomInset = NO;
523
587
 
524
588
  [_anchorView removeFromSuperview];
525
589
  _anchorView = nil;
@@ -605,9 +669,30 @@ static char TrueSheetAccessibilityWindowPreviousElementsKey;
605
669
  }
606
670
  }
607
671
 
672
+ // Fires when UIKit resolves the sheet's float/anchored placement (present,
673
+ // detent resize crossing the float threshold, rotation). The footer's
674
+ // absorbed inset follows the observed safe area — repush it right away so
675
+ // the footer pads/unpads in the same layout pass.
676
+ - (void)viewSafeAreaInsetsDidChange {
677
+ [super viewSafeAreaInsetsDidChange];
678
+
679
+ // Mid-dismiss the frame moves off-screen and reports transient insets —
680
+ // don't let them pollute the observed value (matches viewDidLayoutSubviews).
681
+ if (!self.isBeingDismissed) {
682
+ [self.delegate viewControllerSafeAreaInsetsDidChange];
683
+ }
684
+ }
685
+
608
686
  - (void)viewDidLayoutSubviews {
609
687
  [super viewDidLayoutSubviews];
610
688
 
689
+ // viewSafeAreaInsetsDidChange doesn't fire on re-present when the observed
690
+ // inset matches the previous presentation's — refresh every layout pass
691
+ // instead (deduped downstream, so unchanged values are free).
692
+ if (!self.isBeingDismissed) {
693
+ [self.delegate viewControllerSafeAreaInsetsDidChange];
694
+ }
695
+
611
696
  // Skip size reports while backgrounded behind a stacked child — the push-back
612
697
  // scaling changes the frame and would needlessly resize content.
613
698
  // _lastReportedSize stays stale so the restore pass re-reports any real change.
@@ -1079,8 +1164,7 @@ static char TrueSheetAccessibilityWindowPreviousElementsKey;
1079
1164
  return [self customDetentWithIdentifier:@"custom-auto"
1080
1165
  atIndex:index
1081
1166
  heightBlock:^CGFloat {
1082
- CGFloat height = self->_autoDetentHeight;
1083
- return height - [self autoDetentBottomInsetForHeight:height];
1167
+ return self->_autoDetentHeight - [self autoDetentBottomInset];
1084
1168
  }];
1085
1169
  } else {
1086
1170
  return [UISheetPresentationControllerDetent mediumDetent];
@@ -1092,8 +1176,7 @@ static char TrueSheetAccessibilityWindowPreviousElementsKey;
1092
1176
  return [self customDetentWithIdentifier:@"custom-peek"
1093
1177
  atIndex:index
1094
1178
  heightBlock:^CGFloat {
1095
- CGFloat height = self->_peekDetentHeight;
1096
- return height - [self peekDetentBottomInsetForHeight:height];
1179
+ return self->_peekDetentHeight - [self peekDetentBottomInset];
1097
1180
  }];
1098
1181
  } else {
1099
1182
  return [UISheetPresentationControllerDetent mediumDetent];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { PureComponent, createRef, isValidElement, createElement } from 'react';
3
+ import { PureComponent, createRef, isValidElement, createElement, useEffect } from 'react';
4
4
  import TrueSheetViewNativeComponent from './fabric/TrueSheetViewNativeComponent';
5
5
  import TrueSheetContainerViewNativeComponent from './fabric/TrueSheetContainerViewNativeComponent';
6
6
  import TrueSheetContentViewNativeComponent from './fabric/TrueSheetContentViewNativeComponent';
@@ -22,6 +22,19 @@ const absorbUnclaimedTouches = () => true;
22
22
 
23
23
  // Stop raw touch events from bubbling past the sheet to outside ancestors
24
24
  const stopTouchPropagation = event => event.stopPropagation();
25
+ // Gates auto-present (initialDetentIndex) by one commit. Rendered last in the
26
+ // sheet subtree so its mount effect runs after the content's mount effects —
27
+ // updates they schedule (e.g. a navigation footer via setOptions) batch with
28
+ // onReady's, so native receives initialDetentIndex together with the settled
29
+ // tree and presents at the final height instead of resizing mid-flight.
30
+ const InitialPresentGate = ({
31
+ onReady
32
+ }) => {
33
+ useEffect(() => {
34
+ onReady();
35
+ }, [onReady]);
36
+ return null;
37
+ };
25
38
  export class TrueSheet extends PureComponent {
26
39
  displayName = 'TrueSheet';
27
40
  backHandlerSubscription = null;
@@ -50,7 +63,8 @@ export class TrueSheet extends PureComponent {
50
63
  // Lazy load by default, except when initialDetentIndex is set (for auto-presentation)
51
64
  const shouldRenderImmediately = props.initialDetentIndex !== undefined && props.initialDetentIndex >= 0;
52
65
  this.state = {
53
- shouldRenderNativeView: shouldRenderImmediately
66
+ shouldRenderNativeView: shouldRenderImmediately,
67
+ initialPresentReady: false
54
68
  };
55
69
  this.onMount = this.onMount.bind(this);
56
70
  this.onWillDismiss = this.onWillDismiss.bind(this);
@@ -68,6 +82,12 @@ export class TrueSheet extends PureComponent {
68
82
  this.onDidBlur = this.onDidBlur.bind(this);
69
83
  this.handleBackPress = this.handleBackPress.bind(this);
70
84
  this.onVisibilityChange = this.onVisibilityChange.bind(this);
85
+ this.onInitialPresentReady = this.onInitialPresentReady.bind(this);
86
+ }
87
+ onInitialPresentReady() {
88
+ this.setState({
89
+ initialPresentReady: true
90
+ });
71
91
  }
72
92
  validateDetents() {
73
93
  const {
@@ -338,6 +358,17 @@ export class TrueSheet extends PureComponent {
338
358
  if (prevProps.detents !== this.props.detents) {
339
359
  this.validateDetents();
340
360
  }
361
+
362
+ // initialDetentIndex set at runtime on a lazily-mounted sheet: render the
363
+ // native tree so InitialPresentGate can deliver the index (constructor
364
+ // only computes this for the initial prop).
365
+ const prevInitialDetentIndex = prevProps.initialDetentIndex ?? -1;
366
+ const initialDetentIndex = this.props.initialDetentIndex ?? -1;
367
+ if (prevInitialDetentIndex < 0 && initialDetentIndex >= 0 && !this.state.shouldRenderNativeView) {
368
+ this.setState({
369
+ shouldRenderNativeView: true
370
+ });
371
+ }
341
372
  }
342
373
  componentWillUnmount() {
343
374
  this.unregisterInstance();
@@ -391,6 +422,11 @@ export class TrueSheet extends PureComponent {
391
422
  return Math.min(1, detent);
392
423
  });
393
424
 
425
+ // Hold initialDetentIndex back from native until the gate's effect flushes
426
+ // (see InitialPresentGate) — native presents when the prop lands.
427
+ const autoPresent = initialDetentIndex >= 0;
428
+ const gatedInitialDetentIndex = autoPresent && !this.state.initialPresentReady ? -1 : initialDetentIndex;
429
+
394
430
  // Cache grabberOptions to avoid creating a new object every render
395
431
  if (grabberOptions !== this.cachedGrabberOptions) {
396
432
  this.cachedGrabberOptions = grabberOptions;
@@ -413,7 +449,7 @@ export class TrueSheet extends PureComponent {
413
449
  accessibilityOptions: accessibilityOptions,
414
450
  dimmed: dimmed,
415
451
  dimmedDetentIndex: dimmedDetentIndex,
416
- initialDetentIndex: initialDetentIndex,
452
+ initialDetentIndex: gatedInitialDetentIndex,
417
453
  initialDetentAnimated: initialDetentAnimated,
418
454
  dismissible: dismissible,
419
455
  draggable: draggable,
@@ -467,6 +503,8 @@ export class TrueSheet extends PureComponent {
467
503
  autoBottomInset: insetAdjustment === 'automatic',
468
504
  style: [styles.footer, footerOptions?.position === 'absolute' ? styles.absoluteFooter : styles.relativeFooter, footerStyle],
469
505
  children: /*#__PURE__*/isValidElement(footer) ? footer : /*#__PURE__*/createElement(footer)
506
+ }), autoPresent && !this.state.initialPresentReady && /*#__PURE__*/_jsx(InitialPresentGate, {
507
+ onReady: this.onInitialPresentReady
470
508
  })]
471
509
  })
472
510
  });
@@ -1 +1 @@
1
- {"version":3,"names":["PureComponent","createRef","isValidElement","createElement","TrueSheetViewNativeComponent","TrueSheetContainerViewNativeComponent","TrueSheetContentViewNativeComponent","TrueSheetHeaderViewNativeComponent","TrueSheetFooterViewNativeComponent","TrueSheetModule","Platform","StyleSheet","BackHandler","findNodeHandle","processColor","jsx","_jsx","jsxs","_jsxs","LINKING_ERROR","select","ios","default","Error","absorbUnclaimedTouches","stopTouchPropagation","event","stopPropagation","TrueSheet","displayName","backHandlerSubscription","isPresented","isSheetVisible","instances","presentationResolver","isPresenting","constructor","props","nativeRef","validateDetents","shouldRenderImmediately","initialDetentIndex","undefined","state","shouldRenderNativeView","onMount","bind","onWillDismiss","onDidDismiss","onWillPresent","onDidPresent","onDetentChange","onDragBegin","onDragChange","onDragEnd","onPositionChange","onWillFocus","onDidFocus","onWillBlur","onDidBlur","handleBackPress","onVisibilityChange","detents","length","console","warn","forEach","detent","index","detentsLength","Math","min","getInstance","name","instance","handle","nodeHandle","current","present","animated","dismiss","dismissStack","resize","dismissAll","registerInstance","unregisterInstance","OS","remove","addEventListener","setState","nativeEvent","visible","dismissible","onBackPress","Promise","resolve","presentByRef","resizeByRef","dismissByRef","dismissStackByRef","componentDidMount","componentDidUpdate","prevProps","componentWillUnmount","render","backgroundColor","draggable","grabber","grabberOptions","accessibilityOptions","dimmed","initialDetentAnimated","dimmedDetentIndex","backgroundBlur","blurOptions","cornerRadius","maxContentHeight","maxContentWidth","anchor","anchorOffset","scrollableOptions","footerOptions","presentation","children","style","header","headerStyle","headerOptions","footer","footerStyle","insetAdjustment","rest","resolvedDetents","slice","map","cachedGrabberOptions","resolvedGrabberOptions","color","ref","styles","sheetView","footerPosition","position","keyboardOffset","onStartShouldSetResponder","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel","container","absoluteHeader","autoBottomInset","absoluteFooter","relativeFooter","create","absoluteFill","zIndex","pointerEvents","top","left","right","marginTop","b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D;EACAP,cAAc,EAAE;IACdR,QAAQ,EAAE,UAAU;IACpBgB,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRJ,MAAM,EAAE;EACV,CAAC;EACD5B,MAAM,EAAE;IACN6B,aAAa,EAAE;EACjB,CAAC;EACD;EACA;EACAJ,cAAc,EAAE;IACdQ,SAAS,EAAE;EACb,CAAC;EACD;EACAT,cAAc,EAAE;IACdV,QAAQ,EAAE,UAAU;IACpBiB,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRE,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["PureComponent","createRef","isValidElement","createElement","useEffect","TrueSheetViewNativeComponent","TrueSheetContainerViewNativeComponent","TrueSheetContentViewNativeComponent","TrueSheetHeaderViewNativeComponent","TrueSheetFooterViewNativeComponent","TrueSheetModule","Platform","StyleSheet","BackHandler","findNodeHandle","processColor","jsx","_jsx","jsxs","_jsxs","LINKING_ERROR","select","ios","default","Error","absorbUnclaimedTouches","stopTouchPropagation","event","stopPropagation","InitialPresentGate","onReady","TrueSheet","displayName","backHandlerSubscription","isPresented","isSheetVisible","instances","presentationResolver","isPresenting","constructor","props","nativeRef","validateDetents","shouldRenderImmediately","initialDetentIndex","undefined","state","shouldRenderNativeView","initialPresentReady","onMount","bind","onWillDismiss","onDidDismiss","onWillPresent","onDidPresent","onDetentChange","onDragBegin","onDragChange","onDragEnd","onPositionChange","onWillFocus","onDidFocus","onWillBlur","onDidBlur","handleBackPress","onVisibilityChange","onInitialPresentReady","setState","detents","length","console","warn","forEach","detent","index","detentsLength","Math","min","getInstance","name","instance","handle","nodeHandle","current","present","animated","dismiss","dismissStack","resize","dismissAll","registerInstance","unregisterInstance","OS","remove","addEventListener","nativeEvent","visible","dismissible","onBackPress","Promise","resolve","presentByRef","resizeByRef","dismissByRef","dismissStackByRef","componentDidMount","componentDidUpdate","prevProps","prevInitialDetentIndex","componentWillUnmount","render","backgroundColor","draggable","grabber","grabberOptions","accessibilityOptions","dimmed","initialDetentAnimated","dimmedDetentIndex","backgroundBlur","blurOptions","cornerRadius","maxContentHeight","maxContentWidth","anchor","anchorOffset","scrollableOptions","footerOptions","presentation","children","style","header","headerStyle","headerOptions","footer","footerStyle","insetAdjustment","rest","resolvedDetents","slice","map","autoPresent","gatedInitialDetentIndex","cachedGrabberOptions","resolvedGrabberOptions","color","ref","styles","sheetView","footerPosition","position","keyboardOffset","onStartShouldSetResponder","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel","container","absoluteHeader","autoBottomInset","absoluteFooter","relativeFooter","create","absoluteFill","zIndex","pointerEvents","top","left","right","marginTop","bottom"],"sourceRoot":"../../src","sources":["TrueSheet.tsx"],"mappings":";;AAAA,SACEA,aAAa,EAEbC,SAAS,EAGTC,cAAc,EACdC,aAAa,EACbC,SAAS,QACJ,OAAO;AAqBd,OAAOC,4BAA4B,MAAM,uCAAuC;AAChF,OAAOC,qCAAqC,MAAM,gDAAgD;AAClG,OAAOC,mCAAmC,MAAM,8CAA8C;AAC9F,OAAOC,kCAAkC,MAAM,6CAA6C;AAC5F,OAAOC,kCAAkC,MAAM,6CAA6C;AAE5F,OAAOC,eAAe,MAAM,kCAA+B;AAE3D,SACEC,QAAQ,EACRC,UAAU,EACVC,WAAW,EACXC,cAAc,EACdC,YAAY,QAGP,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtB,MAAMC,aAAa,GACjB,2FAA2F,GAC3FT,QAAQ,CAACU,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B,GAC/B,iDAAiD;AAEnD,IAAI,CAACb,eAAe,EAAE;EACpB,MAAM,IAAIc,KAAK,CAACJ,aAAa,CAAC;AAChC;AAIA;AACA;AACA,MAAMK,sBAAsB,GAAGA,CAAA,K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,CAC3D;MAAA,CACoC;IACxC,CAC2B,CAAC;EAEnC;AACF;;AAEA;AACAnC,SAAS;AAET,MAAMoH,MAAM,GAAGvI,UAAU,CAACsJ,MAAM,CAAC;EAC/Bd,SAAS,EAAE;IACT,GAAGxI,UAAU,CAACuJ,YAAY;IAC1BC,MAAM,EAAE,CAAC,IAAI;IACbC,aAAa,EAAE;EACjB,CAAC;EACD;EACAR,SAAS,EAAE;IACT,GAAGjJ,UAAU,CAACuJ;EAChB,CAAC;EACDhC,MAAM,EAAE;IACNkC,aAAa,EAAE;EACjB,CAAC;EACD;EACAP,cAAc,EAAE;IACdR,QAAQ,EAAE,UAAU;IACpBgB,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRJ,MAAM,EAAE;EACV,CAAC;EACD9B,MAAM,EAAE;IACN+B,aAAa,EAAE;EACjB,CAAC;EACD;EACA;EACAJ,cAAc,EAAE;IACdQ,SAAS,EAAE;EACb,CAAC;EACD;EACAT,cAAc,EAAE;IACdV,QAAQ,EAAE,UAAU;IACpBiB,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRE,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
@@ -2,6 +2,7 @@ import { PureComponent, type ReactNode } from 'react';
2
2
  import type { TrueSheetProps, TrueSheetMethods } from './TrueSheet.types';
3
3
  interface TrueSheetState {
4
4
  shouldRenderNativeView: boolean;
5
+ initialPresentReady: boolean;
5
6
  }
6
7
  export declare class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> implements TrueSheetMethods {
7
8
  displayName: string;
@@ -24,6 +25,7 @@ export declare class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetSt
24
25
  */
25
26
  private isPresenting;
26
27
  constructor(props: TrueSheetProps);
28
+ private onInitialPresentReady;
27
29
  private validateDetents;
28
30
  private static getInstance;
29
31
  private get handle();
@@ -1 +1 @@
1
- {"version":3,"file":"TrueSheet.d.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AAG,OAAO,CAAC,IAAI,CAAC;IAStE;;;;;OAKG;WACiB,UAAU,CAAC,QAAQ,GAAE,OAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvE,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,eAAe;IAkBvB;;;;OAIG;IACU,OAAO,CAAC,KAAK,GAAE,MAAU,EAAE,QAAQ,GAAE,OAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBhF;;;OAGG;IACU,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD;;;OAGG;IACU,OAAO,CAAC,QAAQ,GAAE,OAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7D;;;;OAIG;IACU,YAAY,CAAC,QAAQ,GAAE,OAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlE,iBAAiB,IAAI,IAAI;IAIzB,kBAAkB,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI;IAsBnD,oBAAoB,IAAI,IAAI;IAO5B,MAAM,IAAI,SAAS;CA4JpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodev09/react-native-true-sheet",
3
- "version": "4.0.0-beta.2",
3
+ "version": "4.0.0-beta.3",
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",
package/src/TrueSheet.tsx CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  type ComponentRef,
7
7
  isValidElement,
8
8
  createElement,
9
+ useEffect,
9
10
  } from 'react';
10
11
 
11
12
  import type {
@@ -67,8 +68,22 @@ const stopTouchPropagation = (event: GestureResponderEvent) => event.stopPropaga
67
68
 
68
69
  interface TrueSheetState {
69
70
  shouldRenderNativeView: boolean;
71
+ initialPresentReady: boolean;
70
72
  }
71
73
 
74
+ // Gates auto-present (initialDetentIndex) by one commit. Rendered last in the
75
+ // sheet subtree so its mount effect runs after the content's mount effects —
76
+ // updates they schedule (e.g. a navigation footer via setOptions) batch with
77
+ // onReady's, so native receives initialDetentIndex together with the settled
78
+ // tree and presents at the final height instead of resizing mid-flight.
79
+ const InitialPresentGate = ({ onReady }: { onReady: () => void }) => {
80
+ useEffect(() => {
81
+ onReady();
82
+ }, [onReady]);
83
+
84
+ return null;
85
+ };
86
+
72
87
  export class TrueSheet
73
88
  extends PureComponent<TrueSheetProps, TrueSheetState>
74
89
  implements TrueSheetMethods
@@ -111,6 +126,7 @@ export class TrueSheet
111
126
 
112
127
  this.state = {
113
128
  shouldRenderNativeView: shouldRenderImmediately,
129
+ initialPresentReady: false,
114
130
  };
115
131
 
116
132
  this.onMount = this.onMount.bind(this);
@@ -129,6 +145,11 @@ export class TrueSheet
129
145
  this.onDidBlur = this.onDidBlur.bind(this);
130
146
  this.handleBackPress = this.handleBackPress.bind(this);
131
147
  this.onVisibilityChange = this.onVisibilityChange.bind(this);
148
+ this.onInitialPresentReady = this.onInitialPresentReady.bind(this);
149
+ }
150
+
151
+ private onInitialPresentReady(): void {
152
+ this.setState({ initialPresentReady: true });
132
153
  }
133
154
 
134
155
  private validateDetents(): void {
@@ -443,6 +464,19 @@ export class TrueSheet
443
464
  if (prevProps.detents !== this.props.detents) {
444
465
  this.validateDetents();
445
466
  }
467
+
468
+ // initialDetentIndex set at runtime on a lazily-mounted sheet: render the
469
+ // native tree so InitialPresentGate can deliver the index (constructor
470
+ // only computes this for the initial prop).
471
+ const prevInitialDetentIndex = prevProps.initialDetentIndex ?? -1;
472
+ const initialDetentIndex = this.props.initialDetentIndex ?? -1;
473
+ if (
474
+ prevInitialDetentIndex < 0 &&
475
+ initialDetentIndex >= 0 &&
476
+ !this.state.shouldRenderNativeView
477
+ ) {
478
+ this.setState({ shouldRenderNativeView: true });
479
+ }
446
480
  }
447
481
 
448
482
  componentWillUnmount(): void {
@@ -498,6 +532,12 @@ export class TrueSheet
498
532
  return Math.min(1, detent);
499
533
  });
500
534
 
535
+ // Hold initialDetentIndex back from native until the gate's effect flushes
536
+ // (see InitialPresentGate) — native presents when the prop lands.
537
+ const autoPresent = initialDetentIndex >= 0;
538
+ const gatedInitialDetentIndex =
539
+ autoPresent && !this.state.initialPresentReady ? -1 : initialDetentIndex;
540
+
501
541
  // Cache grabberOptions to avoid creating a new object every render
502
542
  if (grabberOptions !== this.cachedGrabberOptions) {
503
543
  this.cachedGrabberOptions = grabberOptions;
@@ -522,7 +562,7 @@ export class TrueSheet
522
562
  accessibilityOptions={accessibilityOptions}
523
563
  dimmed={dimmed}
524
564
  dimmedDetentIndex={dimmedDetentIndex}
525
- initialDetentIndex={initialDetentIndex}
565
+ initialDetentIndex={gatedInitialDetentIndex}
526
566
  initialDetentAnimated={initialDetentAnimated}
527
567
  dismissible={dismissible}
528
568
  draggable={draggable}
@@ -594,6 +634,9 @@ export class TrueSheet
594
634
  {isValidElement(footer) ? footer : createElement(footer)}
595
635
  </TrueSheetFooterViewNativeComponent>
596
636
  )}
637
+ {autoPresent && !this.state.initialPresentReady && (
638
+ <InitialPresentGate onReady={this.onInitialPresentReady} />
639
+ )}
597
640
  </TrueSheetContainerViewNativeComponent>
598
641
  )}
599
642
  </TrueSheetViewNativeComponent>