Skip to content

Commit fc2b357

Browse files
frankcalisecoolsoftwaretylerjamonholmgren
authored
feat: upgrade to Expo SDK 52 (#2843 by @frankcalise)
* feat: upgrade to Expo SDK 52 * fix(boilerplate): revert mmkv back to v2 for old arch * fix(cli): add `newArch` to cli output * fix(boilerplate): update deps via expo install --fix * fix(boilerplate): disable a few lint rules * chore: deps * chore: ts fixes * fix: return empty array if patches directory does not exist * fix(boilerplate): simplify splash config * chore: update rn * fix(boilerplate): transparent img for splash * fix(boilerplate): web fixes for gesture-handler, useEffect, welcome screen styling and drawer fix (#2856 by @frankcalise) * fix(cli): upgrade yaml pkg to support multi line strings properly (#2862 by @frankcalise) --------- Co-authored-by: Tyler Williams <[email protected]> Co-authored-by: Jamon Holmgren <[email protected]>
1 parent 9d6eae7 commit fc2b357

21 files changed

+89
-127
lines changed

boilerplate/.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ module.exports = {
2626
},
2727
],
2828
"@typescript-eslint/no-var-requires": 0,
29+
"@typescript-eslint/no-require-imports": 0,
30+
"@typescript-eslint/no-empty-object-type": 0,
2931
// eslint
3032
"no-use-before-define": 0,
3133
"no-restricted-imports": [

boilerplate/app.json

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@
99
"orientation": "portrait",
1010
"userInterfaceStyle": "automatic",
1111
"icon": "./assets/images/app-icon-all.png",
12-
"splash": {
13-
"image": "./assets/images/splash-logo-all.png",
14-
"resizeMode": "contain",
15-
"backgroundColor": "#191015"
16-
},
1712
"updates": {
1813
"fallbackToCacheTimeout": 0
1914
},
15+
"newArchEnabled": false,
2016
"jsEngine": "hermes",
2117
"assetBundlePatterns": [
2218
"**/*"
@@ -27,47 +23,29 @@
2723
"adaptiveIcon": {
2824
"foregroundImage": "./assets/images/app-icon-android-adaptive-foreground.png",
2925
"backgroundImage": "./assets/images/app-icon-android-adaptive-background.png"
30-
},
31-
"splash": {
32-
"image": "./assets/images/splash-logo-android-universal.png",
33-
"resizeMode": "contain",
34-
"backgroundColor": "#191015"
3526
}
3627
},
3728
"ios": {
3829
"icon": "./assets/images/app-icon-ios.png",
3930
"supportsTablet": true,
40-
"bundleIdentifier": "com.helloworld",
41-
"splash": {
42-
"image": "./assets/images/splash-logo-ios-mobile.png",
43-
"tabletImage": "./assets/images/splash-logo-ios-tablet.png",
44-
"resizeMode": "contain",
45-
"backgroundColor": "#191015"
46-
}
31+
"bundleIdentifier": "com.helloworld"
4732
},
4833
"web": {
4934
"favicon": "./assets/images/app-icon-web-favicon.png",
50-
"splash": {
51-
"image": "./assets/images/splash-logo-web.png",
52-
"resizeMode": "contain",
53-
"backgroundColor": "#191015"
54-
},
5535
"bundler": "metro"
5636
},
5737
"plugins": [
5838
"expo-localization",
39+
"expo-font",
5940
[
60-
"expo-build-properties",
41+
"expo-splash-screen",
6142
{
62-
"ios": {
63-
"newArchEnabled": false
64-
},
65-
"android": {
66-
"newArchEnabled": false
67-
}
43+
"image": "./assets/images/app-icon-android-adaptive-foreground.png",
44+
"imageWidth": 300,
45+
"resizeMode": "contain",
46+
"backgroundColor": "#191015"
6847
}
69-
],
70-
"expo-font"
48+
]
7149
],
7250
"experiments": {
7351
"tsconfigPaths": true

boilerplate/app/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const config = {
5656
}
5757

5858
interface AppProps {
59-
hideSplashScreen: () => Promise<boolean>
59+
hideSplashScreen: () => Promise<void>
6060
}
6161

6262
/**

boilerplate/app/models/Episode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const EpisodeModel = types
5050
date: formatted,
5151
}),
5252
}
53-
} catch (error) {
53+
} catch {
5454
return { textLabel: "", accessibilityLabel: "" }
5555
}
5656
},

boilerplate/app/screens/DemoShowroomScreen/DemoShowroomScreen.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,13 @@ export const DemoShowroomScreen: FC<DemoTabScreenProps<"DemoShowroom">> =
102102
}
103103
}, [open])
104104

105-
const handleScroll = useCallback(
106-
(sectionIndex: number, itemIndex = 0) => {
107-
listRef.current?.scrollToLocation({
108-
animated: true,
109-
itemIndex,
110-
sectionIndex,
111-
})
112-
toggleDrawer()
113-
},
114-
[toggleDrawer],
115-
)
105+
const handleScroll = useCallback((sectionIndex: number, itemIndex = 0) => {
106+
listRef.current?.scrollToLocation({
107+
animated: true,
108+
itemIndex,
109+
sectionIndex,
110+
})
111+
}, [])
116112

117113
// handle Web links
118114
useEffect(() => {

boilerplate/app/screens/WelcomeScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import { isRTL } from "../i18n"
1010
import { useStores } from "../models" // @demo remove-current-line
1111
import { AppStackScreenProps } from "../navigators"
12-
import type { ThemedStyle } from "@/theme"
12+
import { $styles, type ThemedStyle } from "@/theme"
1313
import { useHeader } from "../utils/useHeader" // @demo remove-current-line
1414
import { useSafeAreaInsetsStyle } from "../utils/useSafeAreaInsetsStyle"
1515
import { useAppTheme } from "@/utils/useAppTheme"
@@ -48,7 +48,7 @@ export const WelcomeScreen: FC<WelcomeScreenProps> = observer(
4848
const $bottomContainerInsets = useSafeAreaInsetsStyle(["bottom"])
4949

5050
return (
51-
<Screen preset="fixed">
51+
<Screen preset="fixed" contentContainerStyle={$styles.flex1}>
5252
<View style={themed($topContainer)}>
5353
<Image style={themed($welcomeLogo)} source={welcomeLogo} resizeMode="contain" />
5454
<Text
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
// Don't import react-native-gesture-handler on web
22
// https://reactnavigation.org/docs/drawer-navigator/#installation
3+
4+
// This however is needed at the moment
5+
// https://github.com/software-mansion/react-native-gesture-handler/issues/2402
6+
import "setimmediate"

boilerplate/app/utils/useHeader.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { useLayoutEffect } from "react"
1+
import { useEffect, useLayoutEffect } from "react"
22
import { useNavigation } from "@react-navigation/native"
33
import { Header, HeaderProps } from "../components"
4+
import { Platform } from "react-native"
45

56
/**
67
* A hook that can be used to easily set the Header of a react-navigation screen from within the screen's component.
@@ -14,9 +15,17 @@ export function useHeader(
1415
) {
1516
const navigation = useNavigation()
1617

18+
/**
19+
* We need to have multiple implementations of this hook for web and mobile.
20+
* Web needs to use useEffect to avoid a rendering loop.
21+
* In mobile and also to avoid a visible header jump when navigating between screens, we use
22+
* `useLayoutEffect`, which will apply the settings before the screen renders.
23+
*/
24+
const usePlatformEffect = Platform.OS === "web" ? useEffect : useLayoutEffect
25+
1726
// To avoid a visible header jump when navigating between screens, we use
1827
// `useLayoutEffect`, which will apply the settings before the screen renders.
19-
useLayoutEffect(() => {
28+
usePlatformEffect(() => {
2029
navigation.setOptions({
2130
headerShown: true,
2231
header: () => <Header {...headerProps} />,
-80.4 KB
Binary file not shown.
-114 KB
Binary file not shown.

0 commit comments

Comments
 (0)