Skip to content

Commit 5f90f16

Browse files
byCedricnecolas
andcommitted
Upgrade to Expo SDK 51 and Flow 0.240.0
Close #159 Co-authored-by: Nicolas Gallagher <necolas@meta.com>
1 parent 67b421b commit 5f90f16

7 files changed

Lines changed: 2904 additions & 1568 deletions

File tree

.flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[version]
2-
0.233.0
2+
0.240.0
33

44
[ignore]
55
.*/malformed_package_json/.*

apps/examples/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
"dev:web": "expo start --web --clear"
1111
},
1212
"dependencies": {
13-
"@expo/metro-runtime": "~3.1.3",
13+
"@expo/metro-runtime": "~3.2.1",
1414
"@stylexjs/babel-plugin": "^0.7.0",
15-
"expo": "^50.0.7",
16-
"expo-build-properties": "~0.11.1",
17-
"expo-status-bar": "~1.11.1",
15+
"expo": "^51.0.18",
16+
"expo-build-properties": "~0.12.3",
17+
"expo-status-bar": "~1.12.1",
1818
"react": "^18.2.0",
1919
"react-dom": "^18.2.0",
20-
"react-native": "^0.73.2",
20+
"react-native": ">=0.74.3",
2121
"react-native-web": "^0.19.10"
2222
},
2323
"devDependencies": {

package-lock.json

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"eslint-plugin-promise": "^6.0.0",
3737
"eslint-plugin-react": "^7.33.1",
3838
"eslint-plugin-react-hooks": "^4.5.0",
39-
"flow-api-translator": "^0.20.1",
40-
"flow-bin": "^0.233.0",
39+
"flow-api-translator": "^0.22.0",
40+
"flow-bin": "^0.240.0",
4141
"husky": "^8.0.0",
4242
"jest": "^29.7.0",
4343
"jest-environment-jsdom": "^29.7.0",

packages/react-strict-dom/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"peerDependencies": {
4040
"react": "^18.2.0",
4141
"react-dom": "^18.2.0",
42-
"react-native": "^0.73.2"
42+
"react-native": ">=0.74.3"
4343
},
4444
"engines": {
4545
"node": ">=18.0.0"

packages/react-strict-dom/src/native/modules/createStrictDOMComponent.js

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -46,47 +46,56 @@ import { useStyleProps } from './useStyleProps';
4646
import { useStyleTransition } from './useStyleTransition';
4747
import * as stylex from '../stylex';
4848

49-
const elements = {
50-
article: View,
51-
aside: View,
52-
blockquote: Text,
53-
br: Text,
54-
button: Pressable,
55-
code: Text,
56-
div: View,
57-
em: Text,
58-
fieldset: View,
59-
footer: View,
60-
form: View,
61-
header: View,
62-
h1: Text,
63-
h2: Text,
64-
h3: Text,
65-
h4: Text,
66-
h5: Text,
67-
h6: Text,
68-
img: Image,
69-
input: TextInput,
70-
main: View,
71-
nav: View,
72-
ol: View,
73-
p: Text,
74-
pre: Text,
75-
section: View,
76-
strong: Text,
77-
sub: Text,
78-
sup: Text,
79-
textarea: TextInput,
80-
ul: View
81-
};
49+
function getComponentFromElement(tagName: string) {
50+
switch (tagName) {
51+
case 'article':
52+
case 'aside':
53+
case 'div':
54+
case 'fieldset':
55+
case 'footer':
56+
case 'form':
57+
case 'header':
58+
case 'main':
59+
case 'nav':
60+
case 'ol':
61+
case 'section':
62+
case 'ul': {
63+
return View;
64+
}
65+
case 'blockquote':
66+
case 'br':
67+
case 'code':
68+
case 'em':
69+
case 'h1':
70+
case 'h2':
71+
case 'h3':
72+
case 'h4':
73+
case 'h5':
74+
case 'h6':
75+
case 'p':
76+
case 'pre':
77+
case 'strong':
78+
case 'sub':
79+
case 'sup': {
80+
return Text;
81+
}
82+
case 'button': {
83+
return Pressable;
84+
}
85+
case 'img': {
86+
return Image;
87+
}
88+
case 'input':
89+
case 'textarea': {
90+
return TextInput;
91+
}
92+
default:
93+
return Text;
94+
}
95+
}
8296

8397
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
8498

85-
const roles = {
86-
a: 'link',
87-
header: 'header'
88-
};
89-
9099
const unsupportedProps = new Set([
91100
'onBeforeInput',
92101
'onInvalid',
@@ -131,9 +140,7 @@ export function createStrictDOMComponent<T, P: StrictProps>(
131140
): React.AbstractComponent<P, T> {
132141
const component: React.AbstractComponent<P, T> = React.forwardRef(
133142
function (props, forwardedRef) {
134-
let nativeComponent =
135-
elements[tagName] != null ? elements[tagName] : Text;
136-
143+
let nativeComponent = getComponentFromElement(tagName);
137144
const elementRef = useStrictDOMElement<T>({ tagName });
138145

139146
if (__DEV__) {
@@ -246,7 +253,10 @@ export function createStrictDOMComponent<T, P: StrictProps>(
246253
if (ariaPosInSet != null) {
247254
nativeProps.accessibilityPosInSet = ariaPosInSet;
248255
}
249-
const ariaRole = role || roles[tagName];
256+
const ariaRole =
257+
role ||
258+
(tagName === 'a' && 'link') ||
259+
(tagName === 'header' && 'header');
250260
if (ariaRole) {
251261
nativeProps.role = ariaRole;
252262
}

packages/react-strict-dom/src/native/modules/useStyleTransition.js

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ export function useStyleTransition(
217217
});
218218
continue;
219219
}
220-
if (singleTransform.rotate != null) {
220+
if (
221+
singleRefTransform.rotate != null &&
222+
singleTransform.rotate != null
223+
) {
221224
animatedTransforms.push({
222225
rotate: animatedRef.current.interpolate({
223226
inputRange: INPUT_RANGE,
@@ -226,7 +229,10 @@ export function useStyleTransition(
226229
});
227230
continue;
228231
}
229-
if (singleTransform.rotateX != null) {
232+
if (
233+
singleRefTransform.rotateX != null &&
234+
singleTransform.rotateX != null
235+
) {
230236
animatedTransforms.push({
231237
rotateX: animatedRef.current.interpolate({
232238
inputRange: INPUT_RANGE,
@@ -238,7 +244,10 @@ export function useStyleTransition(
238244
});
239245
continue;
240246
}
241-
if (singleTransform.rotateY != null) {
247+
if (
248+
singleRefTransform.rotateY != null &&
249+
singleTransform.rotateY != null
250+
) {
242251
animatedTransforms.push({
243252
rotateY: animatedRef.current.interpolate({
244253
inputRange: INPUT_RANGE,
@@ -250,7 +259,10 @@ export function useStyleTransition(
250259
});
251260
continue;
252261
}
253-
if (singleTransform.rotateZ != null) {
262+
if (
263+
singleRefTransform.rotateZ != null &&
264+
singleTransform.rotateZ != null
265+
) {
254266
animatedTransforms.push({
255267
rotateZ: animatedRef.current.interpolate({
256268
inputRange: INPUT_RANGE,
@@ -307,7 +319,10 @@ export function useStyleTransition(
307319
});
308320
continue;
309321
}
310-
if (singleTransform.skewX != null) {
322+
if (
323+
singleRefTransform.skewX != null &&
324+
singleTransform.skewX != null
325+
) {
311326
animatedTransforms.push({
312327
skewX: animatedRef.current.interpolate({
313328
inputRange: INPUT_RANGE,
@@ -316,7 +331,10 @@ export function useStyleTransition(
316331
});
317332
continue;
318333
}
319-
if (singleTransform.skewY != null) {
334+
if (
335+
singleRefTransform.skewY != null &&
336+
singleTransform.skewY != null
337+
) {
320338
animatedTransforms.push({
321339
skewY: animatedRef.current.interpolate({
322340
inputRange: INPUT_RANGE,
@@ -325,7 +343,10 @@ export function useStyleTransition(
325343
});
326344
continue;
327345
}
328-
if (singleTransform.translateX != null) {
346+
if (
347+
singleRefTransform.translateX != null &&
348+
singleTransform.translateX != null
349+
) {
329350
animatedTransforms.push({
330351
translateX: animatedRef.current.interpolate({
331352
inputRange: INPUT_RANGE,
@@ -337,7 +358,10 @@ export function useStyleTransition(
337358
});
338359
continue;
339360
}
340-
if (singleTransform.translateY != null) {
361+
if (
362+
singleRefTransform.translateY != null &&
363+
singleTransform.translateY != null
364+
) {
341365
animatedTransforms.push({
342366
translateY: animatedRef.current.interpolate({
343367
inputRange: INPUT_RANGE,

0 commit comments

Comments
 (0)