@swmansion/react-native-bottom-sheet 0.7.0-next.4 → 0.7.0-next.5

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.
@@ -408,8 +408,19 @@ class BottomSheetView(context: Context) : ReactViewGroup(context) {
408
408
 
409
409
  fun destroy() {
410
410
  activeAnimation?.cancel()
411
+ activeAnimation = null
411
412
  stopChoreographer()
412
413
  velocityTracker?.recycle()
413
414
  velocityTracker = null
415
+ detentSpecs = emptyList()
416
+ targetIndex = 0
417
+ pendingIndex = null
418
+ hasLaidOut = false
419
+ isPanning = false
420
+ initialTouchY = 0f
421
+ lastTouchY = 0f
422
+ activePointerId = MotionEvent.INVALID_POINTER_ID
423
+ sheetContainer.translationY = 0f
424
+ sheetContainer.removeAllViews()
414
425
  }
415
426
  }
@@ -92,6 +92,12 @@ using namespace facebook::react;
92
92
  }
93
93
  }
94
94
 
95
+ - (void)prepareForRecycle
96
+ {
97
+ [super prepareForRecycle];
98
+ [_sheetView resetSheetState];
99
+ }
100
+
95
101
  @end
96
102
 
97
103
  Class<RCTComponentViewProtocol> BottomSheetViewCls(void)
@@ -19,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
19
19
  - (void)setDetentIndex:(NSInteger)newIndex;
20
20
  - (void)mountChildComponentView:(UIView *)childView atIndex:(NSInteger)index;
21
21
  - (void)unmountChildComponentView:(UIView *)childView;
22
+ - (void)resetSheetState;
22
23
 
23
24
  @end
24
25
 
@@ -60,6 +60,11 @@
60
60
  [_impl unmountChildComponentView:childView];
61
61
  }
62
62
 
63
+ - (void)resetSheetState
64
+ {
65
+ [_impl resetSheetState];
66
+ }
67
+
63
68
  - (void)bottomSheetHostingView:(RNSBottomSheetHostingView *)view didChangeIndex:(NSInteger)index
64
69
  {
65
70
  [self.delegate bottomSheetView:self didChangeIndex:index];
@@ -132,6 +132,22 @@ public final class RNSBottomSheetHostingView: UIView {
132
132
  childView.removeFromSuperview()
133
133
  }
134
134
 
135
+ public func resetSheetState() {
136
+ activeAnimator?.stopAnimation(true)
137
+ activeAnimator = nil
138
+ stopDisplayLink()
139
+ detentSpecs = []
140
+ targetIndex = 0
141
+ pendingIndex = nil
142
+ hasLaidOut = false
143
+ isPanning = false
144
+ setContentInteractionEnabled(true)
145
+ sheetContainer.transform = .identity
146
+ for subview in sheetContainer.subviews {
147
+ subview.removeFromSuperview()
148
+ }
149
+ }
150
+
135
151
  private func detent(at index: Int) -> DetentSpec {
136
152
  guard detentSpecs.indices.contains(index) else {
137
153
  return DetentSpec(height: 0, programmatic: false)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/react-native-bottom-sheet",
3
- "version": "0.7.0-next.4",
3
+ "version": "0.7.0-next.5",
4
4
  "description": "Provides bottom-sheet components for React Native.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",