Skip to content

Commit 8a90848

Browse files
committed
Upgrade React types to fix compatibility with Expo 46 projects.
1 parent 009bd13 commit 8a90848

File tree

21 files changed

+301
-183
lines changed

21 files changed

+301
-183
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"license": "MIT",
1818
"devDependencies": {
1919
"@types/jest": "27.4.0",
20-
"@types/react": "17.0.38",
20+
"@types/react": "18.0.18",
2121
"@types/react-native": "0.66.15",
2222
"@types/react-test-renderer": "17.0.1",
2323
"@types/uuid": "8.3.4",

react-native/components/Aligned/index.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ const styles = StyleSheet.create({
4646
* A React component which fills its container and aligns its children
4747
* horizontally and vertically.
4848
*/
49-
export const Aligned: React.FunctionComponent<{
50-
readonly horizontally: `left` | `centered` | `right`;
51-
readonly vertically: `top` | `centered` | `bottom`;
52-
}> = ({ horizontally, vertically, children }) => {
49+
export const Aligned: React.FunctionComponent<
50+
React.PropsWithChildren<{
51+
readonly horizontally: `left` | `centered` | `right`;
52+
readonly vertically: `top` | `centered` | `bottom`;
53+
}>
54+
> = ({ horizontally, vertically, children }) => {
5355
let style: ViewStyle;
5456

5557
switch (horizontally) {

react-native/components/Hitbox/index.tsx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,32 @@ import {
77
} from "react-native";
88
import { useMeasure } from "../../..";
99

10-
type Component = React.FunctionComponent<{
11-
/**
12-
* When true, this component does not accept touch input.
13-
* This will, of course, not apply until the next render. To synchronously
14-
* disable all Hitboxes, use the "enabled" static property.
15-
*/
16-
readonly disabled?: undefined | boolean;
10+
type Component = React.FunctionComponent<
11+
React.PropsWithChildren<{
12+
/**
13+
* When true, this component does not accept touch input.
14+
* This will, of course, not apply until the next render. To synchronously
15+
* disable all Hitboxes, use the "enabled" static property.
16+
*/
17+
readonly disabled?: undefined | boolean;
1718

18-
/**
19-
* Passed down to TouchableOpacity.
20-
*/
21-
readonly style?: ViewStyle;
19+
/**
20+
* Passed down to TouchableOpacity.
21+
*/
22+
readonly style?: ViewStyle;
2223

23-
/**
24-
* Passed to useMeasure.
25-
*/
26-
readonly onMeasure?: undefined | MeasureOnSuccessCallback;
24+
/**
25+
* Passed to useMeasure.
26+
*/
27+
readonly onMeasure?: undefined | MeasureOnSuccessCallback;
2728

28-
/**
29-
* Similar to TouchableOpacity's onPress, but remote-controlled using the
30-
* "enabled" static property.
31-
*/
32-
readonly onPress: () => void;
33-
}>;
29+
/**
30+
* Similar to TouchableOpacity's onPress, but remote-controlled using the
31+
* "enabled" static property.
32+
*/
33+
readonly onPress: () => void;
34+
}>
35+
>;
3436

3537
/**
3638
* A React component which mimics TouchableOpacity, but can be remotely,

react-native/components/Row/index.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@ const styles: { [key: string]: ViewStyle } = {};
77
* A React component which fills the container horizontally and applies a flex
88
* row to its children.
99
*/
10-
export const Row: React.FunctionComponent<{
11-
readonly height: `fitsContent` | `fillsContainer`;
12-
readonly horizontalDistribution:
13-
| `left`
14-
| `centered`
15-
| `right`
16-
| `spaced`
17-
| `spacedTouchingEnds`;
18-
readonly verticalAlignment: `top` | `centered` | `bottom` | `stretched`;
19-
}> = ({ height, horizontalDistribution, verticalAlignment, children }) => {
10+
export const Row: React.FunctionComponent<
11+
React.PropsWithChildren<{
12+
readonly height: `fitsContent` | `fillsContainer`;
13+
readonly horizontalDistribution:
14+
| `left`
15+
| `centered`
16+
| `right`
17+
| `spaced`
18+
| `spacedTouchingEnds`;
19+
readonly verticalAlignment: `top` | `centered` | `bottom` | `stretched`;
20+
}>
21+
> = ({ height, horizontalDistribution, verticalAlignment, children }) => {
2022
const styleKey = `${height}-${horizontalDistribution}-${verticalAlignment}`;
2123

2224
if (!(styleKey in styles)) {

react-native/components/SimpleModal/index.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ let webStyles: null | {
1818
* A replacement for the React Native `Modal` component which supports web
1919
* browsers as a target.
2020
*/
21-
export const SimpleModal: React.FunctionComponent<{
22-
/**
23-
* Called when the back button is pressed or the background is clicked or
24-
* touched.
25-
*/
26-
readonly onClose: () => void;
27-
}> = ({ onClose, children }) => {
21+
export const SimpleModal: React.FunctionComponent<
22+
React.PropsWithChildren<{
23+
/**
24+
* Called when the back button is pressed or the background is clicked or
25+
* touched.
26+
*/
27+
readonly onClose: () => void;
28+
}>
29+
> = ({ onClose, children }) => {
2830
switch (Platform.OS) {
2931
case `android`:
3032
case `ios`:

0 commit comments

Comments
 (0)