Fix video rendering with React Native 0.86

Fold the mobile repository's react-native-video patch into the maintained fork. Avoid the bridgeless RCTBridge.current() trap, preserve the TypeScript install build, and use the supported absolute-fill style so legacy-interoperability video views receive their layout.
This commit is contained in:
2026-08-03 23:30:41 -07:00
parent 69a9159a43
commit d7563cfd93
5 changed files with 15 additions and 7 deletions

View File

@@ -4,7 +4,13 @@ import React
@objc(RCTVideoManager)
class RCTVideoManager: RCTViewManager {
override func view() -> UIView {
return RCTVideo(eventDispatcher: (RCTBridge.current().eventDispatcher() as! RCTEventDispatcher))
// `RCTBridge.current()` returns nil under bridgeless (New Architecture), and it
// is nonnull-annotated, so Swift emits an unconditional nil-check trap around
// the call -- optional chaining does not avoid it. Every <Video> mount killed
// the app. RCTVideo only stores this dispatcher and never reads it (events go
// out through the RCT_EXPORT_VIEW_PROPERTY direct event blocks), so skip the
// lookup entirely.
return RCTVideo(eventDispatcher: nil)
}
func methodQueue() -> DispatchQueue {

View File

@@ -43,6 +43,7 @@
"react-native": "*"
},
"scripts": {
"install": "tsc --noCheck",
"lint": "yarn eslint .",
"build": "yarn tsc",
"prepare": "yarn build",
@@ -61,6 +62,8 @@
"windows",
"src",
"lib",
"tsconfig.json",
"tsconfig.build.json",
"react-native-video.podspec",
"app.plugin.js",
"!android/build",

View File

@@ -734,7 +734,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
// poster style
const baseStyle: StyleProp<ImageStyle> = {
...StyleSheet.absoluteFillObject,
...StyleSheet.absoluteFill,
resizeMode: _posterResizeMode,
};
@@ -787,7 +787,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
const _style: StyleProp<ViewStyle> = useMemo(
() => ({
...StyleSheet.absoluteFillObject,
...StyleSheet.absoluteFill,
...(showPoster ? {display: 'none'} : {}),
}),
[showPoster],

View File

@@ -1,4 +1,3 @@
{
"extends": "./tsconfig",
"exclude": ["examples", "lib"]

View File

@@ -14,8 +14,8 @@
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": ["esnext"],
"module": "CommonJS",
"moduleResolution": "node",
"module": "Node16",
"moduleResolution": "Node16",
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noImplicitUseStrict": false,