fix(ios): fix wrong fullscreen method definition (#3338)

This commit is contained in:
YangJH 2023-11-09 03:04:39 +09:00 committed by GitHub
parent 6df0f7d1c0
commit 7f49b56027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 10 deletions

View File

@ -1085,11 +1085,11 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
_resouceLoaderDelegate?.setLicenseResultError(error, licenseUrl)
}
func dismissFullscreenPlayer(_ error:String!) {
func dismissFullscreenPlayer() {
setFullscreen(false)
}
func presentFullscreenPlayer(_ error:String!) {
func presentFullscreenPlayer() {
setFullscreen(true)
}

View File

@ -81,8 +81,9 @@ RCT_EXTERN_METHOD(setLicenseResultError:(NSString *)error
RCT_EXTERN_METHOD(setPlayerPauseState:(nonnull NSNumber *)paused
reactTag:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(presentFullscreenPlayer
reactTag:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(presentFullscreenPlayer:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(dismissFullscreenPlayer:(nonnull NSNumber *)reactTag)
RCT_EXTERN_METHOD(dismissFullscreenPlayer
reactTag:(nonnull NSNumber *)reactTag)

View File

@ -48,25 +48,25 @@ class RCTVideoManager: RCTViewManager {
})
}
@objc(dismissFullscreenPlayer:reactTag:)
func dismissFullscreenPlayer(error: NSString, reactTag: NSNumber) -> Void {
@objc(dismissFullscreenPlayer:)
func dismissFullscreenPlayer(_ reactTag: NSNumber) -> Void {
bridge.uiManager.prependUIBlock({_ , viewRegistry in
let view = viewRegistry?[reactTag]
if !(view is RCTVideo) {
RCTLogError("Invalid view returned from registry, expecting RCTVideo, got: %@", String(describing: view))
} else if let view = view as? RCTVideo {
view.dismissFullscreenPlayer(error as String)
view.dismissFullscreenPlayer()
}
})
}
@objc(presentFullscreenPlayer:reactTag:)
func presentFullscreenPlayer(error: NSString, reactTag: NSNumber) -> Void {
@objc(presentFullscreenPlayer:)
func presentFullscreenPlayer(_ reactTag: NSNumber) -> Void {
bridge.uiManager.prependUIBlock({_ , viewRegistry in
let view = viewRegistry?[reactTag]
if !(view is RCTVideo) {
RCTLogError("Invalid view returned from registry, expecting RCTVideo, got: %@", String(describing: view))
} else if let view = view as? RCTVideo {
view.presentFullscreenPlayer(error as String)
view.presentFullscreenPlayer()
}
})
}