react-native-swipeable-actions 0.1.1 → 0.1.3
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.
|
@@ -914,6 +914,15 @@ class SwipeableView(context: Context, appContext: AppContext) : ExpoView(context
|
|
|
914
914
|
))
|
|
915
915
|
}
|
|
916
916
|
|
|
917
|
+
override fun onAttachedToWindow() {
|
|
918
|
+
super.onAttachedToWindow()
|
|
919
|
+
// Re-register in the view registry after reattach (e.g. returning from navigation).
|
|
920
|
+
// onDetachedFromWindow unregisters the view, but the recyclingKey prop setter
|
|
921
|
+
// short-circuits when the value hasn't changed, so the view is never re-registered
|
|
922
|
+
// unless we do it here.
|
|
923
|
+
recyclingKey?.let { registerView(this, it) }
|
|
924
|
+
}
|
|
925
|
+
|
|
917
926
|
override fun onDetachedFromWindow() {
|
|
918
927
|
super.onDetachedFromWindow()
|
|
919
928
|
stopProgressUpdates()
|
package/ios/SwipeableView.swift
CHANGED
|
@@ -57,6 +57,10 @@ public class SwipeableView: ExpoView {
|
|
|
57
57
|
registryQueue.async(flags: .barrier) { _viewRegistry.removeValue(forKey: key) }
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
private static func clearOpenState(for key: String) {
|
|
61
|
+
registryQueue.async(flags: .barrier) { _openStateCache.removeValue(forKey: key) }
|
|
62
|
+
}
|
|
63
|
+
|
|
60
64
|
private static func getAllViews() -> [SwipeableView] {
|
|
61
65
|
registryQueue.sync { _viewRegistry.values.compactMap { $0.value } }
|
|
62
66
|
}
|
|
@@ -239,7 +243,24 @@ public class SwipeableView: ExpoView {
|
|
|
239
243
|
|
|
240
244
|
public override func willMove(toSuperview newSuperview: UIView?) {
|
|
241
245
|
if newSuperview == nil {
|
|
246
|
+
// Stop all timers and animations
|
|
242
247
|
stopProgressUpdates()
|
|
248
|
+
cancelAutoClose()
|
|
249
|
+
currentAnimator?.stopAnimation(true)
|
|
250
|
+
currentAnimator = nil
|
|
251
|
+
isAnimating = false
|
|
252
|
+
|
|
253
|
+
// Reset layer properties to prevent corruption
|
|
254
|
+
contentView?.transform = .identity
|
|
255
|
+
contentView?.layer.zPosition = 0
|
|
256
|
+
actionsView?.transform = .identity
|
|
257
|
+
actionsView?.layer.zPosition = 0
|
|
258
|
+
|
|
259
|
+
// Unregister from static registry and clear cached state
|
|
260
|
+
if let key = recyclingKey {
|
|
261
|
+
Self.unregisterView(for: key)
|
|
262
|
+
Self.clearOpenState(for: key)
|
|
263
|
+
}
|
|
243
264
|
}
|
|
244
265
|
super.willMove(toSuperview: newSuperview)
|
|
245
266
|
}
|
|
@@ -254,6 +275,14 @@ public class SwipeableView: ExpoView {
|
|
|
254
275
|
super.didMoveToWindow()
|
|
255
276
|
guard window != nil else { return }
|
|
256
277
|
|
|
278
|
+
// Re-register in the view registry after reattach (e.g. returning from navigation).
|
|
279
|
+
// willMove(toSuperview: nil) unregisters the view, but the recyclingKey prop setter
|
|
280
|
+
// short-circuits when the value hasn't changed, so the view is never re-registered
|
|
281
|
+
// unless we do it here.
|
|
282
|
+
if let key = recyclingKey {
|
|
283
|
+
Self.registerView(self, for: key)
|
|
284
|
+
}
|
|
285
|
+
|
|
257
286
|
// Ensure gesture is attached to this view (handles view hierarchy changes)
|
|
258
287
|
if panGesture.view !== self {
|
|
259
288
|
panGesture.view?.removeGestureRecognizer(panGesture)
|
package/package.json
CHANGED