Skip to content

Commit c271062

Browse files
committed
chore(example): fix ts issues
1 parent d526c2a commit c271062

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

example/src/examples/FlappyBird/components/BaseActor.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import {
77
} from '@shopify/react-native-skia';
88
import { Config } from '../state/config';
99
import { addDrawListener } from '../state/stage';
10+
import type { b2Body, b2Vec2 } from 'react-native-box2d';
1011

1112
type Props = {
1213
width: number;
1314
height: number;
14-
position: Box2D.Common.Math.b2Vec2;
15-
body: Box2D.Dynamics.b2Body;
15+
position: b2Vec2;
16+
body: b2Body;
1617
};
1718

1819
export const BaseActor: React.FC<Props> = ({

example/src/examples/FlappyBird/components/Bird.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { Rect } from '@shopify/react-native-skia';
22
import React from 'react';
3-
import { Box2d } from 'react-native-box2d';
3+
import { b2Body, b2Vec2, Box2d } from 'react-native-box2d';
44
import { BaseActor } from './BaseActor';
55
import { Config } from '../state/config';
66
import { addDrawListener, WORLD } from '../state/stage';
77

88
type Props = {
9-
position: Box2d.Common.Math.b2Vec2;
9+
position: b2Vec2;
1010
};
1111
export const HEIGHT = 1;
1212
export const WIDTH = 1.5;
1313

1414
// https://github.dev/YieldNull/FlappyBird/blob/master/core/src/com/yieldnull/flappybird/screen/GameScreen.java
1515
export class Bird extends React.PureComponent<Props> {
16-
private body: Box2d.Dynamics.b2Body;
16+
private body: b2Body;
1717

1818
constructor(props: Props) {
1919
super(props);

example/src/examples/SpawnBoxesScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22

33
import { StyleSheet, Dimensions, StatusBar, Platform } from 'react-native';
4-
import { Box2d } from 'react-native-box2d';
4+
import { b2World, Box2d } from 'react-native-box2d';
55
import {
66
Skia,
77
Canvas,
@@ -44,7 +44,7 @@ const Box = ({
4444
world,
4545
registerStepListener,
4646
}: {
47-
world: Box2D.Dynamics.b2World;
47+
world: b2World;
4848
registerStepListener: (listener: () => unknown) => () => void;
4949
}) => {
5050
const boxWorldPos = useValue({

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"baseUrl": ".",
44
"paths": {
5-
"react-native-fast-crypto": ["./src/index"]
5+
"react-native-box2d": ["./src/index"]
66
},
77
"allowUnreachableCode": false,
88
"allowUnusedLabels": false,

0 commit comments

Comments
 (0)