Skip to content

Commit 4b68c9f

Browse files
authored
chore(bump): upgrade to expo SDK 50 (#60)
* chore: update expo sdk 50 * chore: add new components * chore: update packages * chore: bypass web unit test * chore: bypass web unit test * chore: update button component to pressable * chore: update button * chore: update unit test * chore: update github action * chore: update prefetch * chore: update prefetch * chore: update app config * chore: load env variable from .env file * fix: disable bottomsheet on web * chore: tweak UI * chore: update demo * chore: add task.json * chore: update config * fix: package.lock path issue * fix: node version specification in eas.json * fix: android package DNS notation issue * chore: conditional EAS update * fix: react-native-reanimated plugin * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md
1 parent de70c25 commit 4b68c9f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+9857
-11839
lines changed

.env.development

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
EXPO_PUBLIC_ENV=development
2+
EXPO_PUBLIC_API_URL=https://dev.example.com

.env.production

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
EXPO_PUBLIC_ENV=production
2+
EXPO_PUBLIC_API_URL=https://example.com

.env.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
EXPO_PUBLIC_ENV=test
2+
EXPO_PUBLIC_API_URL=https://test.example.com

.github/workflows/preview.yml

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,78 @@
1-
name: Preview
1+
name: CI - APP Preview
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
- 'releases/**'
84
pull_request:
9-
branches:
10-
- '*'
5+
branches: ['*']
6+
push:
7+
branches: ['dev', 'staging', 'main', 'release/**']
118

129
jobs:
1310
update:
1411
name: Publish Preview Channel
1512
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [20.x]
1616
steps:
17+
# Check for EXPO_TOKEN
1718
- name: Check for EXPO_TOKEN
1819
run: |
1920
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
20-
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
21+
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets."
2122
exit 1
2223
fi
2324
25+
# checkout the repository
2426
- name: Checkout repository
2527
uses: actions/checkout@v2
2628

29+
# setup node
2730
- name: Setup Node
28-
uses: actions/setup-node@v2
31+
uses: actions/setup-node@v3
2932
with:
30-
node-version: 20.x
33+
cache-dependency-path: package-lock.json
34+
node-version: ${{ matrix.node-version }}
3135
cache: npm
3236

37+
# setup expo
3338
- name: Setup Expo
3439
uses: expo/expo-github-action@v7
3540
with:
3641
expo-version: latest
3742
eas-version: latest
3843
token: ${{ secrets.EXPO_TOKEN }}
3944

45+
# install dependencies
4046
- name: Install dependencies
4147
run: npm ci
4248

49+
# get branch name
4350
- name: Get branch name
4451
id: branch-name
4552
uses: tj-actions/branch-names@v7
4653

54+
# eas update (PR)
55+
- name: EAS update
56+
if: github.event_name == 'pull_request' && steps.branch-name.outputs.current_branch != 'main'
57+
run: eas update --branch ${{ steps.branch-name.outputs.current_branch }} --message "${{ github.event.pull_request.title }}"
58+
env:
59+
NODE_ENV: development
60+
4761
- name: EAS update
48-
if: github.event_name == 'pull_request'
62+
if: github.event_name == 'pull_request' && steps.branch-name.outputs.current_branch == 'main'
4963
run: eas update --branch ${{ steps.branch-name.outputs.current_branch }} --message "${{ github.event.pull_request.title }}"
64+
env:
65+
NODE_ENV: production
66+
67+
# eas update (PUSH)
68+
- name: EAS update
69+
if: github.event_name == 'push' && steps.branch-name.outputs.current_branch != 'main'
70+
run: eas update --branch ${{ steps.branch-name.outputs.current_branch }} --message "${{ github.event.head_commit.message }}"
71+
env:
72+
NODE_ENV: development
5073

5174
- name: EAS update
52-
if: github.event_name == 'push'
75+
if: github.event_name == 'push' && steps.branch-name.outputs.current_branch == 'main'
5376
run: eas update --branch ${{ steps.branch-name.outputs.current_branch }} --message "${{ github.event.head_commit.message }}"
77+
env:
78+
NODE_ENV: production

.github/workflows/test.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,43 @@
1-
name: Test
1+
name: CI - APP
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
- 'releases/**'
84
pull_request:
9-
branches:
10-
- '*'
5+
branches: ['*']
6+
push:
7+
branches: ['dev', 'staging', 'main']
118

129
jobs:
1310
test:
14-
name: Code format, lint, unit test
11+
name: App Test
1512
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [20.x]
1616
steps:
17-
- uses: actions/checkout@v2
17+
# checkout the repository
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
21+
# setup node
22+
- name: Setup Node
23+
uses: actions/setup-node@v3
24+
with:
25+
cache-dependency-path: package-lock.json
26+
node-version: ${{ matrix.node-version }}
27+
cache: npm
1828

29+
# install dependencies
1930
- name: Install dependencies
2031
run: npm ci
2132

33+
# run code formatter
2234
- name: Code Formatter
2335
run: npm run format
2436

37+
# run lint test
2538
- name: Lint Test
2639
run: npm run lint
2740

41+
# run unit test
2842
- name: Unit Test
2943
run: npm run test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
node_modules/
22
.expo/
33
dist/
4+
coverage/
45
npm-debug.*
56
*.jks
67
*.p8
@@ -15,3 +16,5 @@ web-build/
1516

1617
# Temporary files created by Metro to check the health of the file watcher
1718
.metro-health-check*
19+
20+
.env*.local

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"typescript.tsdk": "node_modules/typescript/lib",
33
"editor.formatOnSave": true,
44
"editor.codeActionsOnSave": {
5-
"source.fixAll.eslint": true
5+
"source.fixAll.eslint": "explicit"
66
}
77
}

.vscode/tasks.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "RUN-DEV",
6+
"dependsOn": ["root", "app:test:watch", "app:run:dev"]
7+
},
8+
{
9+
"label": "RUN-PROD",
10+
"dependsOn": ["root", "app:test:watch", "app:run:prod"]
11+
},
12+
{
13+
"type": "process",
14+
"label": "root",
15+
"command": "/bin/bash",
16+
"args": ["-l"],
17+
"problemMatcher": [],
18+
"presentation": {
19+
"echo": false,
20+
"focus": true,
21+
"group": "build",
22+
"panel": "dedicated"
23+
}
24+
},
25+
{
26+
"label": "app:test:watch",
27+
"type": "shell",
28+
"command": "npm run test:watch",
29+
"presentation": {
30+
"reveal": "always",
31+
"group": "app"
32+
}
33+
},
34+
{
35+
"label": "app:run:prod",
36+
"type": "shell",
37+
"command": "npm run start",
38+
"presentation": {
39+
"reveal": "always",
40+
"group": "app"
41+
}
42+
},
43+
{
44+
"label": "app:run:dev",
45+
"type": "shell",
46+
"command": "npm run start:dev",
47+
"presentation": {
48+
"reveal": "always",
49+
"group": "app"
50+
}
51+
}
52+
]
53+
}

App.tsx

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,14 @@
1-
import { useState, useEffect } from 'react';
21
import { Provider } from 'react-redux';
3-
import * as SplashScreen from 'expo-splash-screen';
2+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
43
import Navigator from '@navigator';
54
import store from '@utils/store';
6-
import { loadImages, loadFonts } from '@theme';
7-
import 'react-native-gesture-handler';
8-
9-
// keep the splash screen visible while we fetch resources
10-
SplashScreen.preventAutoHideAsync();
115

126
export default function App() {
13-
const [isReady, setReady] = useState<boolean>(false);
14-
15-
// assets preloading
16-
const preloadAssets = async () => {
17-
try {
18-
await Promise.all([loadImages(), loadFonts()]);
19-
} finally {
20-
setReady(true);
21-
SplashScreen.hideAsync();
22-
}
23-
};
24-
25-
useEffect(() => {
26-
preloadAssets();
27-
}, []);
28-
29-
if (!isReady) return null;
307
return (
31-
<Provider store={store}>
32-
<Navigator />
33-
</Provider>
8+
<GestureHandlerRootView style={{ flex: 1 }}>
9+
<Provider store={store}>
10+
<Navigator />
11+
</Provider>
12+
</GestureHandlerRootView>
3413
);
3514
}

0 commit comments

Comments
 (0)