Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ module.exports = {
},
],
"@babel/preset-react",
"@babel/preset-typescript",
["@babel/preset-typescript", { allowDeclareFields: true }],
],
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"fast-uri": "^3.1.2",
"follow-redirects": "^1.16.0",
"ip-address": "^10.2.0",
"@xmldom/xmldom": "^0.8.13"
"@xmldom/xmldom": "^0.8.13",
"gl": "9.0.0-rc.9"
},
"devDependencies": {
"@babel/cli": "^7.26.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/gl-react-dom/src/GLViewDOM.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default class GLViewDOM extends Component<
);
for (let k in propTypes) {
if (rest.hasOwnProperty(k)) {
delete rest[k];
delete (rest as any)[k];
}
}
return (
Expand Down Expand Up @@ -177,7 +177,7 @@ export default class GLViewDOM extends Component<
debug
? { ...webglContextAttributes, preserveDrawingBuffer: true }
: webglContextAttributes,
version || "auto"
(version || "auto") as "webgl" | "webgl2" | "auto"
);
this.webglContextAttributes = webglContextAttributes || {};
return gl;
Expand Down
8 changes: 4 additions & 4 deletions packages/gl-react-dom/src/getContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ const getContext = (
) => {
let gl: WebGLRenderingContext | null = null;
if (version === "webgl2" || version === "auto") {
gl = canvas.getContext("webgl2", opts) as WebGLRenderingContext | null;
gl = canvas.getContext("webgl2", opts) as unknown as WebGLRenderingContext | null;
}
Comment on lines 6 to 9
if (!gl && (version === "webgl" || version === "auto")) {
gl =
(canvas.getContext("webgl", opts) as WebGLRenderingContext | null) ||
(canvas.getContext("webgl", opts) as unknown as WebGLRenderingContext | null) ||
(canvas.getContext(
"webgl-experimental" as any,
opts
) as WebGLRenderingContext | null) ||
) as unknown as WebGLRenderingContext | null) ||
(canvas.getContext(
"experimental-webgl" as any,
opts
) as WebGLRenderingContext | null);
) as unknown as WebGLRenderingContext | null);
}
return gl;
};
Expand Down
1 change: 1 addition & 0 deletions packages/gl-react-expo/src/GLViewNative.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default class GLViewNative extends Component<{
style={[{ position: "relative", overflow: "hidden" }, style]}
>
<EXGLView
{...({} as any)}
style={[
style,
Comment on lines 57 to 60
{
Expand Down
8 changes: 8 additions & 0 deletions packages/gl-react-expo/src/globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declare module "react-native" {
export const View: any;
}
declare const __DEV__: boolean;
declare var global: typeof globalThis & {
requestAnimationFrame: (callback: FrameRequestCallback) => number;
cancelAnimationFrame: (id: number) => void;
};
2 changes: 1 addition & 1 deletion packages/gl-react-headless/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class GLView extends Component<{
render() {
const { width, height, debug, children, ...rest } = this.props;
for (let k in propTypes) {
delete rest[k];
delete (rest as any)[k];
}
return (
<canvas ref={this.onRef} width={width} height={height} {...rest}>
Expand Down
7 changes: 7 additions & 0 deletions packages/gl-react-native/src/globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare module "react-native" {
export const View: any;
}
declare var global: typeof globalThis & {
requestAnimationFrame: (callback: FrameRequestCallback) => number;
cancelAnimationFrame: (id: number) => void;
};
2 changes: 1 addition & 1 deletion packages/gl-react/src/Bus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class Bus extends Component<Props, any> {
id: number = genId();
static contextType = GLContext;

context!: {
declare context: {
glParent: any;
glSurface: any;
glSizable: any;
Expand Down
2 changes: 1 addition & 1 deletion packages/gl-react/src/Node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ const NodePropTypes = {
*/
export default class Node extends Component<Props, any> {
drawProps: Props = this.props;
context!: SurfaceContext;
declare context: SurfaceContext;
framebuffer?: Framebuffer;
backbuffer?: Framebuffer;
_needsRedraw: boolean = false;
Expand Down
2 changes: 1 addition & 1 deletion packages/gl-react/src/connectSize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const connectSize = (GLComponent: any) =>
children?: any;
onConnectSizeComponentRef?: (ref: any) => void;
}> {
context!: {
declare context: {
glSizable: { getGLSize: () => [number, number] };
glParent: any;
glSurface: any;
Expand Down
2 changes: 1 addition & 1 deletion packages/gl-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outDir": "lib",
"rootDir": "src",
"composite": true,
"typeRoots": ["./src/types"]
"typeRoots": ["./src/types", "../../node_modules/@types"]
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["lib", "node_modules"]
Expand Down
4 changes: 2 additions & 2 deletions packages/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
},
"version": "5.2.1",
"dependencies": {
"gl-react": "^5.2.0",
"gl-react-headless": "^5.2.1",
"gl-react": "^6.0.0",
"gl-react-headless": "^6.0.0",
"gl-texture2d": "^2.0.12",
"invariant": "^2.2.4",
"jest": "^29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export BABEL_ENV=production

for d in ./packages/gl-react*; do
cd $d
rm -rf lib
rm -rf lib *.tsbuildinfo
babel --root-mode upward --source-maps --extensions '.ts,.tsx' -d lib src
cd - 1> /dev/null
done
Expand Down
Loading
Loading