From 1fe872c45e11974a8e66e4c3c178300eff68d7ea Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Wed, 6 Dec 2023 16:47:16 +0100 Subject: [PATCH 1/3] refactor: align handling of default values PRN-92 --- src/components/PlayerView/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/PlayerView/index.tsx b/src/components/PlayerView/index.tsx index 86155c25..d48ae4ed 100644 --- a/src/components/PlayerView/index.tsx +++ b/src/components/PlayerView/index.tsx @@ -48,9 +48,9 @@ export function PlayerView({ config, fullscreenHandler, customMessageHandler, - isFullscreenRequested = false, + isFullscreenRequested, scalingMode, - isPictureInPictureRequested = false, + isPictureInPictureRequested, ...props }: PlayerViewProps) { // Workaround React Native UIManager commands not sent until UI refresh @@ -125,7 +125,7 @@ export function PlayerView({ useEffect(() => { const node = findNodeHandle(nativeView.current); - if (node) { + if (node && isFullscreenRequested) { dispatch('setFullscreen', node, isFullscreenRequested); } }, [isFullscreenRequested, nativeView]); @@ -139,7 +139,7 @@ export function PlayerView({ useEffect(() => { const node = findNodeHandle(nativeView.current); - if (node) { + if (node && isPictureInPictureRequested) { dispatch('setPictureInPicture', node, isPictureInPictureRequested); } }, [isPictureInPictureRequested, nativeView]); From d071e780aa5520610de20d9d53613109dd503bb8 Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Thu, 7 Dec 2023 12:27:17 +0100 Subject: [PATCH 2/3] fix: compare to undefined --- src/components/PlayerView/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/PlayerView/index.tsx b/src/components/PlayerView/index.tsx index d48ae4ed..b70325ea 100644 --- a/src/components/PlayerView/index.tsx +++ b/src/components/PlayerView/index.tsx @@ -125,21 +125,21 @@ export function PlayerView({ useEffect(() => { const node = findNodeHandle(nativeView.current); - if (node && isFullscreenRequested) { + if (node && isFullscreenRequested != undefined) { dispatch('setFullscreen', node, isFullscreenRequested); } }, [isFullscreenRequested, nativeView]); useEffect(() => { const node = findNodeHandle(nativeView.current); - if (node && scalingMode) { + if (node && scalingMode != undefined) { dispatch('setScalingMode', node, scalingMode); } }, [scalingMode, nativeView]); useEffect(() => { const node = findNodeHandle(nativeView.current); - if (node && isPictureInPictureRequested) { + if (node && isPictureInPictureRequested != undefined) { dispatch('setPictureInPicture', node, isPictureInPictureRequested); } }, [isPictureInPictureRequested, nativeView]); From 7cdf47e49ce10c315cb7724eb71973af7f60451e Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Thu, 7 Dec 2023 13:37:10 +0100 Subject: [PATCH 3/3] Use !== instead of != MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Roland Kákonyi --- src/components/PlayerView/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/PlayerView/index.tsx b/src/components/PlayerView/index.tsx index b70325ea..ee105c86 100644 --- a/src/components/PlayerView/index.tsx +++ b/src/components/PlayerView/index.tsx @@ -125,21 +125,21 @@ export function PlayerView({ useEffect(() => { const node = findNodeHandle(nativeView.current); - if (node && isFullscreenRequested != undefined) { + if (node && isFullscreenRequested !== undefined) { dispatch('setFullscreen', node, isFullscreenRequested); } }, [isFullscreenRequested, nativeView]); useEffect(() => { const node = findNodeHandle(nativeView.current); - if (node && scalingMode != undefined) { + if (node && scalingMode !== undefined) { dispatch('setScalingMode', node, scalingMode); } }, [scalingMode, nativeView]); useEffect(() => { const node = findNodeHandle(nativeView.current); - if (node && isPictureInPictureRequested != undefined) { + if (node && isPictureInPictureRequested !== undefined) { dispatch('setPictureInPicture', node, isPictureInPictureRequested); } }, [isPictureInPictureRequested, nativeView]);