diff --git a/ios/packages/swiftui/Sources/ManagedPlayer/ManagedPlayer.swift b/ios/packages/swiftui/Sources/ManagedPlayer/ManagedPlayer.swift index 54449218e..d096a4ea0 100644 --- a/ios/packages/swiftui/Sources/ManagedPlayer/ManagedPlayer.swift +++ b/ios/packages/swiftui/Sources/ManagedPlayer/ManagedPlayer.swift @@ -128,11 +128,6 @@ internal struct ManagedPlayer14: View { private var handleScroll: Bool - // Whether or not its a the start of a new flow - // once the animation has been shown we need to remove it - // otherwise you get flickering double transitions between views in a flow - @State private var newFlow = true - /** Creates a `ManagedPlayer` - parameters: @@ -192,8 +187,7 @@ internal struct ManagedPlayer14: View { flow: flow, plugins: plugins + [viewModel] + (handleScroll ? [ScrollPlugin()] : []), result: $viewModel.result, - context: context, - unloadOnDisappear: false + context: context ) } } @@ -211,7 +205,11 @@ public extension SwiftUIPlayer.Context { } private extension JSContext { - static let sharedManaged: JSContext! = JSContext() + static var sharedManaged: JSContext! { JSContext(virtualMachine: .playerShared) } +} + +private extension JSVirtualMachine { + static let playerShared: JSVirtualMachine = .init() } internal struct ManagedPlayer13: View { @@ -225,11 +223,6 @@ internal struct ManagedPlayer13: View { private var handleScroll: Bool - // Whether or not its a the start of a new flow - // once the animation has been shown we need to remove it - // otherwise you get flickering double transitions between views in a flow - @State private var newFlow = true - // For ViewInspector testing internal let inspection = Inspection() @@ -293,8 +286,7 @@ internal struct ManagedPlayer13: View { flow: flow, plugins: plugins + [viewModel] + (handleScroll ? [ScrollPlugin()] : []), result: $viewModel.result, - context: context, - unloadOnDisappear: false + context: context ) } }