@sdcx/bottom-sheet 0.6.0 → 0.8.0

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.
@@ -91,6 +91,11 @@ public class BottomSheet extends ReactViewGroup implements NestedScrollingParent
91
91
  viewDragHelper = ViewDragHelper.create(this, dragCallback);
92
92
  }
93
93
 
94
+ viewDragHelper.abort();
95
+ if (settleRunnable != null && settleRunnable.isPosted) {
96
+ settleRunnable.run();
97
+ }
98
+
94
99
  layoutChild();
95
100
  }
96
101
 
@@ -110,7 +115,7 @@ public class BottomSheet extends ReactViewGroup implements NestedScrollingParent
110
115
  if (state == COLLAPSED) {
111
116
  child.offsetTopAndBottom(collapsedOffset - top);
112
117
  } else if (state == EXPANDED) {
113
- child.offsetTopAndBottom(expandedOffset -top);
118
+ child.offsetTopAndBottom(expandedOffset - top);
114
119
  } else if (state == HIDDEN) {
115
120
  child.offsetTopAndBottom(getHeight() - top);
116
121
  }
@@ -170,7 +175,8 @@ public class BottomSheet extends ReactViewGroup implements NestedScrollingParent
170
175
  @VisibleForTesting
171
176
  View findScrollingChild(View view) {
172
177
  if (ViewCompat.isNestedScrollingEnabled(view)) {
173
- if (!view.canScrollHorizontally(1) && !view.canScrollHorizontally(-1) && (view.canScrollVertically(-1) || view.canScrollVertically(1))) {
178
+ if (!view.canScrollHorizontally(1) && !view.canScrollHorizontally(-1) &&
179
+ (view.canScrollVertically(-1) || view.canScrollVertically(1))) {
174
180
  return view;
175
181
  }
176
182
  }
@@ -253,7 +259,7 @@ public class BottomSheet extends ReactViewGroup implements NestedScrollingParent
253
259
  // it is not the top most view of its parent. This is not necessary when the touch event is
254
260
  // happening over the scrolling content as nested scrolling logic handles that case.
255
261
  View scroll = nestedScrollingChildRef != null ? nestedScrollingChildRef.get() : null;
256
- return action == MotionEvent.ACTION_MOVE
262
+ return action == MotionEvent.ACTION_MOVE
257
263
  && scroll != null
258
264
  && !ignoreEvents
259
265
  && state != DRAGGING
@@ -158,7 +158,7 @@
158
158
  }
159
159
  }
160
160
 
161
- if (pan.state == UIGestureRecognizerStateEnded) {
161
+ if (pan.state == UIGestureRecognizerStateEnded || pan.state == UIGestureRecognizerStateCancelled) {
162
162
  if (self.lastDragDistance > 0) {
163
163
  if (self.target && self.target.contentOffset.y <= 0) {
164
164
  //如果是类似轻扫的那种
@@ -307,6 +307,11 @@
307
307
  }
308
308
 
309
309
  - (void)stopWatchBottomSheetTransition {
310
+ if ([self.state isEqualToString:@"collapsed"]) {
311
+ [self dispatchOnSlide:self.maxY];
312
+ } else if ([self.state isEqualToString:@"expanded"]) {
313
+ [self dispatchOnSlide:self.minY];
314
+ }
310
315
  if(_displayLink){
311
316
  [_displayLink invalidate];
312
317
  _displayLink = nil;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sdcx/bottom-sheet",
3
3
  "description": "A react-native BottomSheet component.",
4
- "version": "0.6.0",
4
+ "version": "0.8.0",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",
7
7
  "react-native": "src/index",