@lodev09/react-native-true-sheet 3.10.0-beta.0 → 3.10.0-beta.1

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/README.md CHANGED
@@ -15,6 +15,7 @@ The true native bottom sheet experience for your React Native Apps. 💩
15
15
  * 🚀 **Fully Native** - Implemented in the native realm, zero JS hacks
16
16
  * ♿ **Accessible** - Native accessibility and screen reader support out of the box
17
17
  * 🔄 **Flexible API** - Use [imperative methods](https://sheet.lodev09.com/reference/methods#ref-methods) or [lifecycle events](https://sheet.lodev09.com/reference/events)
18
+ * ⌨️ **Keyboard Handling** - Built-in [keyboard handling](https://sheet.lodev09.com/guides/keyboard) with automatic adjustment
18
19
  * 📐 **Side Sheets** - Native [side sheet](https://sheet.lodev09.com/guides/side-sheets) support for iPad and Android tablets
19
20
  * 🪟 **Liquid Glass** - [iOS 26+ Liquid Glass](https://sheet.lodev09.com/guides/liquid-glass) support out of the box, featured in [Expo Blog](https://expo.dev/blog/how-to-create-apple-maps-style-liquid-glass-sheets)
20
21
  * 🐎 **Reanimated** - First-class support for [react-native-reanimated](https://sheet.lodev09.com/guides/reanimated)
@@ -119,9 +119,6 @@ class TrueSheetView(private val reactContext: ThemedReactContext) :
119
119
 
120
120
  if (child is TrueSheetContainerView) {
121
121
  child.delegate = this
122
- viewController.createSheet()
123
- setupScrollable()
124
-
125
122
  val surfaceId = UIManagerHelper.getSurfaceId(this)
126
123
  eventDispatcher?.dispatchEvent(MountEvent(surfaceId, id))
127
124
  }
@@ -349,11 +346,8 @@ class TrueSheetView(private val reactContext: ThemedReactContext) :
349
346
  return
350
347
  }
351
348
 
352
- if (viewController.coordinatorLayout == null || viewController.sheetView == null) {
353
- RNLog.w(reactContext, "TrueSheet: sheet is not ready. Ensure it is mounted before presenting.")
354
- promiseCallback()
355
- return
356
- }
349
+ viewController.createSheet()
350
+ setupScrollable()
357
351
 
358
352
  // Dismiss keyboard if focused view is within a sheet or if target detent will be dimmed
359
353
  val parentSheet = TrueSheetStackManager.getTopmostSheet()
@@ -216,15 +216,18 @@ using namespace facebook::react;
216
216
  animations:^{
217
217
  [self setScrollViewContentInset:height
218
218
  indicatorInset:self->_originalIndicatorBottomInset + height];
219
-
220
- if (firstResponder) {
221
- CGRect responderFrame = [firstResponder convertRect:firstResponder.bounds
222
- toView:self->_pinnedScrollView.scrollView];
223
- responderFrame.size.height += self.keyboardScrollOffset;
224
- [self->_pinnedScrollView.scrollView scrollRectToVisible:responderFrame animated:NO];
225
- }
226
219
  }
227
220
  completion:nil];
221
+
222
+ // Defer scroll until the next run loop so content insets are applied first
223
+ if (firstResponder) {
224
+ dispatch_async(dispatch_get_main_queue(), ^{
225
+ CGRect responderFrame = [firstResponder convertRect:firstResponder.bounds
226
+ toView:self->_pinnedScrollView.scrollView];
227
+ responderFrame.size.height += self.keyboardScrollOffset;
228
+ [self->_pinnedScrollView.scrollView scrollRectToVisible:responderFrame animated:YES];
229
+ });
230
+ }
228
231
  }
229
232
 
230
233
  - (void)keyboardWillHide:(NSTimeInterval)duration curve:(UIViewAnimationOptions)curve {
@@ -261,11 +261,7 @@ using namespace facebook::react;
261
261
  _insetAdjustment = (NSInteger)newProps.insetAdjustment;
262
262
  _controller.insetAdjustment = _insetAdjustment;
263
263
 
264
- if (_containerView) {
265
- _containerView.scrollableEnabled = _scrollable;
266
- _containerView.insetAdjustment = _insetAdjustment;
267
- _containerView.scrollableOptions = _scrollableOptions;
268
- }
264
+ [self setupScrollable];
269
265
  }
270
266
 
271
267
  - (void)updateState:(const State::Shared &)state oldState:(const State::Shared &)oldState {
@@ -314,9 +310,7 @@ using namespace facebook::react;
314
310
  if (!(updateMask & RNComponentViewUpdateMaskProps) || !_controller)
315
311
  return;
316
312
 
317
- if (_containerView) {
318
- [_containerView setupScrollable];
319
- }
313
+ [self setupScrollable];
320
314
 
321
315
  if (_controller.isPresented) {
322
316
  [self applySheetPropsUpdate];
@@ -384,11 +378,6 @@ using namespace facebook::react;
384
378
  _controller.headerHeight = @(headerHeight);
385
379
  }
386
380
 
387
- _containerView.scrollableEnabled = _scrollable;
388
- _containerView.insetAdjustment = _insetAdjustment;
389
- _containerView.scrollableOptions = _scrollableOptions;
390
- [_containerView setupScrollable];
391
-
392
381
  if (_eventEmitter) {
393
382
  [TrueSheetLifecycleEvents emitMount:_eventEmitter];
394
383
  } else {
@@ -449,6 +438,8 @@ using namespace facebook::react;
449
438
  [_controller setupSheetDetents];
450
439
  [_controller setupActiveDetentWithIndex:index];
451
440
 
441
+ [self setupScrollable];
442
+
452
443
  [_screensEventObserver capturePresenterScreenFromView:self];
453
444
  [_screensEventObserver startObservingWithState:_state.get()->getData()];
454
445
 
@@ -575,7 +566,7 @@ using namespace facebook::react;
575
566
 
576
567
  // When the ScrollView changes (e.g. conditional remount), re-pin the new ScrollView.
577
568
  - (void)containerViewScrollViewDidChange {
578
- [_containerView setupScrollable];
569
+ [self setupScrollable];
579
570
  }
580
571
 
581
572
  #pragma mark - TrueSheetViewControllerDelegate
@@ -697,6 +688,16 @@ using namespace facebook::react;
697
688
 
698
689
  #pragma mark - Private Helpers
699
690
 
691
+ - (void)setupScrollable {
692
+ if (!_containerView)
693
+ return;
694
+
695
+ _containerView.scrollableEnabled = _scrollable;
696
+ _containerView.insetAdjustment = _insetAdjustment;
697
+ _containerView.scrollableOptions = _scrollableOptions;
698
+ [_containerView setupScrollable];
699
+ }
700
+
700
701
  - (void)applySheetPropsUpdate {
701
702
  BOOL pendingLayoutUpdate = _pendingLayoutUpdate;
702
703
  _pendingLayoutUpdate = NO;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodev09/react-native-true-sheet",
3
- "version": "3.10.0-beta.0",
3
+ "version": "3.10.0-beta.1",
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",