@swmansion/react-native-bottom-sheet 0.8.0-next.3 → 0.8.0-next.4
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.
|
@@ -140,11 +140,10 @@ class BottomSheetView(context: Context) : ReactViewGroup(context) {
|
|
|
140
140
|
val closedTy = detentSpecs.lastOrNull()?.height ?: h.toFloat()
|
|
141
141
|
sheetContainer.translationY = closedTy
|
|
142
142
|
emitPosition()
|
|
143
|
-
snapToIndex(targetIndex, 0f)
|
|
143
|
+
snapToIndex(targetIndex, 0f, emitIndexChange = false)
|
|
144
144
|
} else {
|
|
145
145
|
sheetContainer.translationY = translationY(targetIndex)
|
|
146
146
|
emitPosition()
|
|
147
|
-
listener?.onIndexChange(targetIndex)
|
|
148
147
|
}
|
|
149
148
|
return
|
|
150
149
|
}
|
|
@@ -288,7 +287,7 @@ class BottomSheetView(context: Context) : ReactViewGroup(context) {
|
|
|
288
287
|
|
|
289
288
|
// MARK: - Spring animation
|
|
290
289
|
|
|
291
|
-
private fun snapToIndex(index: Int, velocity: Float) {
|
|
290
|
+
private fun snapToIndex(index: Int, velocity: Float, emitIndexChange: Boolean = true) {
|
|
292
291
|
if (index < 0 || index >= detentSpecs.size) return
|
|
293
292
|
targetIndex = index
|
|
294
293
|
|
|
@@ -310,7 +309,7 @@ class BottomSheetView(context: Context) : ReactViewGroup(context) {
|
|
|
310
309
|
emitPosition()
|
|
311
310
|
activeAnimation = null
|
|
312
311
|
updateInteractionState()
|
|
313
|
-
listener?.onIndexChange(index)
|
|
312
|
+
if (emitIndexChange) listener?.onIndexChange(index)
|
|
314
313
|
}
|
|
315
314
|
}
|
|
316
315
|
|
|
@@ -112,11 +112,10 @@ public final class RNSBottomSheetHostingView: UIView {
|
|
|
112
112
|
let closedTy = detentSpecs.last?.height ?? bounds.height
|
|
113
113
|
sheetContainer.transform = CGAffineTransform(translationX: 0, y: closedTy)
|
|
114
114
|
emitPosition()
|
|
115
|
-
snapToIndex(targetIndex, velocity: 0)
|
|
115
|
+
snapToIndex(targetIndex, velocity: 0, emitIndexChange: false)
|
|
116
116
|
} else {
|
|
117
117
|
sheetContainer.transform = CGAffineTransform(translationX: 0, y: translationY(for: targetIndex))
|
|
118
118
|
emitPosition()
|
|
119
|
-
eventDelegate?.bottomSheetHostingView(self, didChangeIndex: targetIndex)
|
|
120
119
|
}
|
|
121
120
|
return
|
|
122
121
|
}
|
|
@@ -297,7 +296,7 @@ public final class RNSBottomSheetHostingView: UIView {
|
|
|
297
296
|
snapToIndex(closedIndex, velocity: 0)
|
|
298
297
|
}
|
|
299
298
|
|
|
300
|
-
private func snapToIndex(_ index: Int, velocity: CGFloat) {
|
|
299
|
+
private func snapToIndex(_ index: Int, velocity: CGFloat, emitIndexChange: Bool = true) {
|
|
301
300
|
guard index >= 0, index < detentSpecs.count else { return }
|
|
302
301
|
targetIndex = index
|
|
303
302
|
|
|
@@ -323,7 +322,9 @@ public final class RNSBottomSheetHostingView: UIView {
|
|
|
323
322
|
self.activeAnimator = nil
|
|
324
323
|
self.setContentInteractionEnabled(true)
|
|
325
324
|
self.updateInteractionState()
|
|
326
|
-
|
|
325
|
+
if emitIndexChange {
|
|
326
|
+
self.eventDelegate?.bottomSheetHostingView(self, didChangeIndex: index)
|
|
327
|
+
}
|
|
327
328
|
}
|
|
328
329
|
animator.startAnimation()
|
|
329
330
|
activeAnimator = animator
|
package/package.json
CHANGED