Skip to content

Commit e140582

Browse files
authored
Merge pull request #22 from expo/0.1.0
0.1.0
2 parents 2c80df8 + 0a93ad0 commit e140582

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@expo/browser-polyfill",
3-
"version": "0.0.1-alpha.6",
3+
"version": "0.1.0",
44
"sideEffects": false,
55
"description": "Browser polyfill for making React Native compatible with web libs like pixi.js, three.js, phaser.js",
66
"homepage": "https://github.com/expo/browser-polyfill#readme",
@@ -47,8 +47,7 @@
4747
"sync-example": "rsync -rv src example/node_modules/@expo/browser-polyfill && rsync -rv package.json example/node_modules/@expo/browser-polyfill"
4848
},
4949
"peerDependencies": {
50-
"expo": "^32.0.6",
51-
"expo-file-system": "*",
50+
"expo-file-system": "^5.0.1",
5251
"react": "^16.8.6",
5352
"react-native": "*"
5453
},

src/DOM/HTMLImageElement.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Image } from 'react-native';
2-
import { FileSystem } from 'expo';
2+
import * as FileSystem from 'expo-file-system';
33
const { writeAsStringAsync, documentDirectory } = FileSystem;
44
const EncodingType = FileSystem.EncodingType || FileSystem.EncodingTypes;
55

@@ -8,11 +8,11 @@ import uuidv1 from 'uuid/v1';
88
import Element from './Element';
99

1010
const 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

1717
function 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-
3534
class 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

Comments
 (0)