From 61f2acdb27636c7f5b255eb277f346f707b597a8 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Thu, 16 Nov 2023 17:34:27 +0100 Subject: [PATCH 1/5] fix: Fix types for `ReactVideoSource` to also allow `require(..)` sources We need to be careful here to not use `any`, so I used `NodeRequire` - which is afaik present in all React Native environments as a type. --- src/types/video.ts | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/types/video.ts b/src/types/video.ts index e3b03bc0ed..c34c1ba345 100644 --- a/src/types/video.ts +++ b/src/types/video.ts @@ -6,22 +6,24 @@ import type FilterType from './FilterType'; export type Headers = Record; -export type ReactVideoSource = Readonly<{ - uri?: string; - isNetwork?: boolean; - isAsset?: boolean; - shouldCache?: boolean; - type?: string; - mainVer?: number; - patchVer?: number; - headers?: Headers; - startTime?: number; - endTime?: number; - title?: string; - subtitle?: string; - description?: string; - customImageUri?: string; -}>; +export type ReactVideoSource = + | Readonly<{ + uri?: string + isNetwork?: boolean + isAsset?: boolean + shouldCache?: boolean + type?: string + mainVer?: number + patchVer?: number + headers?: Headers + startTime?: number + endTime?: number + title?: string + subtitle?: string + description?: string + customImageUri?: string + }> + | NodeRequire; export type DebugConfig = Readonly<{ enable?: boolean; From dbdb7fbfd4d20f4097552775e56b68ac22ffdcf9 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Thu, 16 Nov 2023 17:36:45 +0100 Subject: [PATCH 2/5] Update CHANGELOG.md --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee341c3848..7712db4cfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ ## Next - Android, iOS: add onVolumeChange event #3322 +- Fix types for ReactVideoSource to also allow require(..) sources + ### Version 6.0.0-alpha.9 - All: add built-in typescript support [#3266](https://github.com/react-native-video/react-native-video/pull/3266) @@ -371,4 +373,4 @@ - Add cookie support for ExoPlayer [#922](https://github.com/react-native-community/react-native-video/pull/922) - Remove ExoPlayer onMetadata that wasn't being used [#1040](https://github.com/react-native-community/react-native-video/pull/1040) - Fix bug where setting the progress interval on iOS didn't work [#800](https://github.com/react-native-community/react-native-video/pull/800) -- Support setting the poster resize mode [#595](https://github.com/react-native-community/react-native-video/pull/595) \ No newline at end of file +- Support setting the poster resize mode [#595](https://github.com/react-native-community/react-native-video/pull/595) From d4fb5d21e0edd2948a452b883d093268dce2cc95 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Fri, 17 Nov 2023 14:52:09 +0100 Subject: [PATCH 3/5] Update CHANGELOG.md Co-authored-by: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7712db4cfd..7ac59a4b26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,6 @@ ## Next - Android, iOS: add onVolumeChange event #3322 -- Fix types for ReactVideoSource to also allow require(..) sources ### Version 6.0.0-alpha.9 From a887ef95a0dace5d011a9707fdace63087c53426 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Fri, 17 Nov 2023 14:52:14 +0100 Subject: [PATCH 4/5] Update CHANGELOG.md Co-authored-by: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ac59a4b26..5870c0f031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,6 @@ ## Next - Android, iOS: add onVolumeChange event #3322 - ### Version 6.0.0-alpha.9 - All: add built-in typescript support [#3266](https://github.com/react-native-video/react-native-video/pull/3266) - All: update documentation generation [#3296](https://github.com/react-native-video/react-native-video/pull/3296) From c0a30935eeb2c9fcb0cc34f2eea0feafc293f570 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Fri, 17 Nov 2023 15:29:37 +0100 Subject: [PATCH 5/5] fix: Fix lint --- src/types/video.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/types/video.ts b/src/types/video.ts index c34c1ba345..65e7cf7d23 100644 --- a/src/types/video.ts +++ b/src/types/video.ts @@ -8,20 +8,20 @@ export type Headers = Record; export type ReactVideoSource = | Readonly<{ - uri?: string - isNetwork?: boolean - isAsset?: boolean - shouldCache?: boolean - type?: string - mainVer?: number - patchVer?: number - headers?: Headers - startTime?: number - endTime?: number - title?: string - subtitle?: string - description?: string - customImageUri?: string + uri?: string; + isNetwork?: boolean; + isAsset?: boolean; + shouldCache?: boolean; + type?: string; + mainVer?: number; + patchVer?: number; + headers?: Headers; + startTime?: number; + endTime?: number; + title?: string; + subtitle?: string; + description?: string; + customImageUri?: string; }> | NodeRequire;