fix(types): support ImageRequireSource in ReactVideoSource (#4901)#4904
Closed
vanhci wants to merge 1 commit into
Closed
fix(types): support ImageRequireSource in ReactVideoSource (#4901)#4904vanhci wants to merge 1 commit into
vanhci wants to merge 1 commit into
Conversation
React Native asset require() returns ImageRequireSource (number), but the ReactVideoSource type only accepted string | NodeRequire. The runtime code in Video.tsx already handles numeric asset ids at both source positions: - typeof _source === 'number' - typeof _source.uri === 'number' This change widens ReactVideoSource to also accept ImageRequireSource directly, matching the documented runtime behavior and the README example. Fixes #4901
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: TypeScript type bug in ReactVideoSource (#4901)
Problem: React Native asset
require()returnsImageRequireSource(anumber), butReactVideoSourcetype only acceptedstring | NodeRequire. The runtime code inVideo.tsxalready handles numeric asset ids at both source positions, but the TS type didn't reflect this.Fix: Widen
ReactVideoSourceto also acceptImageRequireSourcedirectly, matching the documented runtime behavior and the README example.Changed file:
src/types/video.ts(support/6.x.x branch)Testing: This is a pure type-only change. The runtime behavior is already correct (the code in
Video.tsxalready handlestypeof _source === 'number'andtypeof _source.uri === 'number').Fixes #4901