Skip to content

Commit

Permalink
Merge pull request #23 from wcandillon/wcandillon-patch-7
Browse files Browse the repository at this point in the history
fix(regression): Fix 1.1.8 regression
  • Loading branch information
wcandillon authored Mar 22, 2017
2 parents c622eeb + 8b1b955 commit 12fd058
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const SHA1 = require("crypto-js/sha1");

const dirs = RNFetchBlob.fs.dirs;
const s4 = () => Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);

const FILE_PREFIX = Platform.OS === "ios" ? "" : "file://";
export type CacheHandler = (path: string) => void;

type CacheEntry = {
Expand Down Expand Up @@ -129,7 +129,6 @@ export interface CachedImageState {
export class CachedImage extends Component<CachedImageProps, CachedImageState> {

private uri: string;
private static readonly filePrefix = Platform.OS === "ios" ? "" : "file://";

private handler: CacheHandler = (path: string) => {
this.setState({ path });
Expand Down Expand Up @@ -171,7 +170,7 @@ export class CachedImage extends Component<CachedImageProps, CachedImageState>

render() {
const {style, blurRadius} = this.props;
const source = this.state.path ? { uri: CachedImage.filePrefix + this.state.path } : {};
const source = this.state.path ? { uri: FILE_PREFIX + this.state.path } : {};
return <Image style={style} blurRadius={blurRadius} source={source}>{this.props.children}</Image>;
}
}

0 comments on commit 12fd058

Please sign in to comment.