11import { Image } from 'react-native' ;
2- import { FileSystem } from 'expo' ;
2+ import * as FileSystem from 'expo-file-system ' ;
33const { writeAsStringAsync, documentDirectory } = FileSystem ;
44const EncodingType = FileSystem . EncodingType || FileSystem . EncodingTypes ;
55
@@ -8,11 +8,11 @@ import uuidv1 from 'uuid/v1';
88import Element from './Element' ;
99
1010const b64Extensions = {
11- '/' : 'jpg' ,
12- 'i' : 'png' ,
13- 'R' : 'gif' ,
14- 'U' : 'webp' ,
15- }
11+ '/' : 'jpg' ,
12+ i : 'png' ,
13+ R : 'gif' ,
14+ U : 'webp' ,
15+ } ;
1616
1717function b64WithoutPrefix ( b64 ) {
1818 return b64 . split ( ',' ) [ 1 ] ;
@@ -23,15 +23,14 @@ function getMIMEforBase64String(b64) {
2323 if ( b64 . includes ( ',' ) ) {
2424 input = b64WithoutPrefix ( b64 ) ;
2525 }
26- const first = input . charAt ( 0 ) ;
26+ const first = input . charAt ( 0 ) ;
2727 const mime = b64Extensions [ first ] ;
2828 if ( ! mime ) {
2929 throw new Error ( 'Unknown Base64 MIME type: ' , b64 ) ;
3030 }
3131 return mime ;
3232}
3333
34-
3534class HTMLImageElement extends Element {
3635 get src ( ) {
3736 return this . localUri ;
@@ -75,7 +74,11 @@ class HTMLImageElement extends Element {
7574
7675 _load ( ) {
7776 if ( this . src ) {
78- if ( typeof this . src === 'string' && this . src . startsWith && this . src . startsWith ( 'data:' ) ) {
77+ if (
78+ typeof this . src === 'string' &&
79+ this . src . startsWith &&
80+ this . src . startsWith ( 'data:' )
81+ ) {
7982 // is base64 - convert and try again;
8083 this . _base64 = this . src ;
8184 const base64result = this . src . split ( ',' ) [ 1 ] ;
0 commit comments