Skip to content

Commit

Permalink
Fix RCTView width NaN crash with react-native-video-controls in full …
Browse files Browse the repository at this point in the history
…screen mode

Patch was provided here: itsnubix/react-native-video-controls#238 (comment)
  • Loading branch information
mitchdowney committed Feb 2, 2023
1 parent 551fc41 commit 1872520
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"react-native-tracking-transparency": "0.1.1",
"react-native-vector-icons": "8.1.0",
"react-native-video": "6.0.0-alpha.4",
"react-native-video-controls": "^2.8.1",
"react-native-video-controls": "2.8.1",
"react-native-webview": "11.26.0",
"react-native-xml2js": "1.0.3",
"react-navigation": "4.4.4",
Expand Down
13 changes: 13 additions & 0 deletions patches/react-native-video-controls+2.8.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/react-native-video-controls/VideoPlayer.js b/node_modules/react-native-video-controls/VideoPlayer.js
index 7d36b4b..e300dc4 100644
--- a/node_modules/react-native-video-controls/VideoPlayer.js
+++ b/node_modules/react-native-video-controls/VideoPlayer.js
@@ -613,7 +613,7 @@ export default class VideoPlayer extends Component {
* @return {float} position of seeker handle in px based on currentTime
*/
calculateSeekerPosition() {
- const percent = this.state.currentTime / this.state.duration;
+ const percent = this.state.duration === 0 ? 0 : this.state.currentTime / this.state.duration;
return this.player.seekerWidth * percent;
}

0 comments on commit 1872520

Please sign in to comment.