@sdcx/bottom-sheet 0.5.0 → 0.7.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.
package/README.md CHANGED
@@ -65,7 +65,7 @@ const App = () => {
65
65
 
66
66
  - `'hidden'`,隐藏状态,此时 BottomSheet 的高度为 0。
67
67
 
68
- - `fitToContents`,是指 BottomSheet 在展开时,是否适应内容的高度,默认是 `false`。
68
+ - `fitToContents`,是指 BottomSheet 在展开时,是否适应内容的高度,默认是 `false`。当和可滚动列表,譬如 ScrollView 一起使用时,请保持默认值。
69
69
 
70
70
  ### 回调
71
71
 
@@ -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)) {
178
+ if (!view.canScrollHorizontally(1) && !view.canScrollHorizontally(-1) &&
179
+ (view.canScrollVertically(-1) || view.canScrollVertically(1))) {
174
180
  return view;
175
181
  }
176
182
  }
@@ -187,6 +193,7 @@ public class BottomSheet extends ReactViewGroup implements NestedScrollingParent
187
193
  }
188
194
  }
189
195
  }
196
+
190
197
  return null;
191
198
  }
192
199
 
@@ -252,7 +259,7 @@ public class BottomSheet extends ReactViewGroup implements NestedScrollingParent
252
259
  // it is not the top most view of its parent. This is not necessary when the touch event is
253
260
  // happening over the scrolling content as nested scrolling logic handles that case.
254
261
  View scroll = nestedScrollingChildRef != null ? nestedScrollingChildRef.get() : null;
255
- return action == MotionEvent.ACTION_MOVE
262
+ return action == MotionEvent.ACTION_MOVE
256
263
  && scroll != null
257
264
  && !ignoreEvents
258
265
  && state != DRAGGING
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.5.0",
4
+ "version": "0.7.0",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",
7
7
  "react-native": "src/index",