From 9d2035fe44f2cd640d83e60cc1705e10ca1fbde0 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 --- Video.js | 2 + examples/video-caching/App.ios.js | 72 +++++++++++++++++++++++-------- ios/Video/RCTVideo.m | 19 ++++---- 3 files changed, 66 insertions(+), 27 deletions(-) diff --git a/Video.js b/Video.js index 92544467c0..4d1bf8d64f 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..2c6743c1eb 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 (