From 3df20ff131a237b550fbb30ba26f41bdca384732 Mon Sep 17 00:00:00 2001 From: n1ru4l Date: Tue, 22 Jan 2019 10:56:49 +0100 Subject: [PATCH] fix: omit packager assets from caching --- CHANGELOG.md | 4 ++ Video.js | 2 + examples/video-caching/App.ios.js | 78 +++++++++++++++++++++++-------- ios/Video/RCTVideo.m | 19 ++++---- 4 files changed, 75 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24a19ba40c..280ada24fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Changelog +### next + +* Fix loading package resolved videos when using video-caching [#1438](https://github.com/react-native-community/react-native-video/pull/1438) + ### Version 4.3.0 * Fix iOS video not displaying after switching source [#1395](https://github.com/react-native-community/react-native-video/pull/1395) * Add the filterEnabled flag, fixes iOS video start time regression [#1384](https://github.com/react-native-community/react-native-video/pull/1384) diff --git a/Video.js b/Video.js index 92544467c0..ff893efb29 100644 --- a/Video.js +++ b/Video.js @@ -213,6 +213,7 @@ export default class Video extends Component { render() { const resizeMode = this.props.resizeMode; const source = resolveAssetSource(this.props.source) || {}; + const shouldCache = !Boolean(source.__packager_asset) let uri = source.uri || ''; if (uri && uri.match(/^\//)) { @@ -241,6 +242,7 @@ export default class Video extends Component { uri, isNetwork, isAsset, + shouldCache, type: source.type || '', mainVer: source.mainVer || 0, patchVer: source.patchVer || 0, diff --git a/examples/video-caching/App.ios.js b/examples/video-caching/App.ios.js index 20f69745ea..f38f945a01 100644 --- a/examples/video-caching/App.ios.js +++ b/examples/video-caching/App.ios.js @@ -5,39 +5,70 @@ */ import React, { Component } from "react"; -import { StyleSheet, Text, View, Dimensions, TouchableOpacity } from "react-native"; +import { Alert, StyleSheet, Text, View, Dimensions, TouchableOpacity } from "react-native"; import Video from "react-native-video"; const { height, width } = Dimensions.get("screen"); type Props = {}; -export default class App extends Component { + +type State = { + showLocal: boolean +}; + +function Button({ text, onPress }: { text: string, onPress: () => void }) { + return ( + + {text} + + ) +} + +export default class App extends Component { + state = { + showLocal: false + } render() { return (