Skip to content

Commit 469b879

Browse files
author
Emile
committed
Compute lib
1 parent e91d24d commit 469b879

6 files changed

+39
-40
lines changed

lib/RNExtension.js

+14-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/RNExtension.js.flow

+2-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default {
2929
},
3030
createWithContext: (gl: RNWebGLRenderingContext, ctxId: number): Extension =>
3131
middlewares.reduce((ext, middleware) => middleware(ext), {
32-
loadTexture: config => {
32+
loadTexture: config =>
3333
// WARNING can only load 8 textures at a time
3434
// Loading 9 textures will break the app
3535
RNWebGLTextureManager.create({
@@ -38,8 +38,7 @@ export default {
3838
}).then(({ objId, width, height }) => {
3939
const texture = new RNWebGLTexture(objId);
4040
return { texture, width, height };
41-
});
42-
},
41+
}),
4342
unloadTexture: texture => RNWebGLTextureManager.destroy(texture.id),
4443
endFrame: gl.__endFrame.bind(gl)
4544
})

lib/RNExtension.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/WebGLView.js

+12-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/WebGLView.js.flow

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//@flow
2-
import React from "react";
3-
import PropTypes from "prop-types";
2+
import React from 'react';
3+
import PropTypes from 'prop-types';
44
import {
55
Platform,
66
View,
77
ViewPropTypes,
88
requireNativeComponent
9-
} from "react-native";
10-
import RNExtension from "./RNExtension";
11-
import wrapGLMethods from "./wrapGLMethods";
9+
} from 'react-native';
10+
import RNExtension from './RNExtension';
11+
import wrapGLMethods from './wrapGLMethods';
1212

1313
// Get the GL interface from an RNWebGLContextID and do JS-side setup
1414
const getGl = (ctxId: number): ?WebGLRenderingContext => {
@@ -27,7 +27,6 @@ const getGl = (ctxId: number): ?WebGLRenderingContext => {
2727
gl.__proto__ = global.WebGLRenderingContext.prototype;
2828
}
2929
wrapGLMethods(gl, RNExtension.createWithContext(gl, ctxId));
30-
3130
gl.canvas = null;
3231

3332
const viewport = gl.getParameter(gl.VIEWPORT);
@@ -67,9 +66,9 @@ export default class WebGLView extends React.Component {
6766
return (
6867
<View {...viewProps}>
6968
<WebGLView.NativeView
70-
style={{ flex: 1, backgroundColor: "transparent" }}
69+
style={{ flex: 1, backgroundColor: 'transparent' }}
7170
onSurfaceCreate={this.onSurfaceCreate}
72-
msaaSamples={Platform.OS === "ios" ? msaaSamples : undefined}
71+
msaaSamples={Platform.OS === 'ios' ? msaaSamples : undefined}
7372
/>
7473
</View>
7574
);
@@ -84,7 +83,7 @@ export default class WebGLView extends React.Component {
8483
try {
8584
gl = getGl(ctxId);
8685
if (!gl) {
87-
error = new Error("RNWebGL context creation failed");
86+
error = new Error('RNWebGL context creation failed');
8887
}
8988
} catch (e) {
9089
error = e;
@@ -100,7 +99,7 @@ export default class WebGLView extends React.Component {
10099
}
101100
};
102101

103-
static NativeView = requireNativeComponent("RNWebGLView", WebGLView, {
102+
static NativeView = requireNativeComponent('RNWebGLView', WebGLView, {
104103
nativeOnly: { onSurfaceCreate: true }
105104
});
106105
}

0 commit comments

Comments
 (0)