mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-05-24 15:29:48 +00:00
fix(ios): store view as week reference in HybridVideoViewViewManager
This commit is contained in:
@@ -9,23 +9,31 @@ import Foundation
|
||||
import NitroModules
|
||||
|
||||
class HybridVideoViewViewManager: HybridVideoViewViewManagerSpec {
|
||||
weak var view: VideoComponentView?
|
||||
|
||||
var player: (any HybridVideoPlayerSpec)? {
|
||||
get {
|
||||
view.player
|
||||
guard let view = view else {
|
||||
print("RN Video: VideoComponentView is no longer available. It is likely that the view was deallocated.")
|
||||
return nil
|
||||
}
|
||||
return view.player
|
||||
}
|
||||
set {
|
||||
guard let view = view else {
|
||||
print("RN Video: VideoComponentView is no longer available. It is likely that the view was deallocated.")
|
||||
return
|
||||
}
|
||||
view.player = newValue
|
||||
}
|
||||
}
|
||||
|
||||
let view: VideoComponentView
|
||||
|
||||
init(nitroId: Double) throws {
|
||||
guard let view = VideoComponentView.globalViewsMap.object(forKey: NSNumber(value: nitroId)) else {
|
||||
throw RuntimeError.error(withMessage: "No view found for \(nitroId)")
|
||||
}
|
||||
|
||||
self.view = view
|
||||
self.view = view
|
||||
}
|
||||
|
||||
// Initialize HybridContext
|
||||
|
||||
Reference in New Issue
Block a user