Skip to content

Commit 0fb60a8

Browse files
committedMar 11, 2025
chore: update Expo example app
1 parent 486fbb7 commit 0fb60a8

39 files changed

+5153
-5102
lines changed
 

‎examples/publish-ci/expo/.eslintrc.json

-41
This file was deleted.

‎examples/publish-ci/expo/.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ node_modules/
88
.expo/
99
dist/
1010
web-build/
11+
expo-env.d.ts
12+
build/
1113

1214
# Native
1315
*.orig.*
@@ -36,3 +38,9 @@ yarn-error.*
3638

3739
# typescript
3840
*.tsbuildinfo
41+
42+
# IDE
43+
.vscode
44+
45+
.yalc/
46+
yalc.lock
+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"arrowParens": "avoid",
3-
"bracketSameLine": true,
4-
"singleQuote": true,
5-
"trailingComma": "all"
3+
"semi": false,
4+
"singleQuote": true
65
}

‎examples/publish-ci/expo/App.tsx

+10-83
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,10 @@
1-
import type { FC } from 'react';
2-
import {
3-
SafeAreaView,
4-
ScrollView,
5-
StatusBar,
6-
StyleSheet,
7-
Text,
8-
View,
9-
useColorScheme,
10-
} from 'react-native';
11-
import { Provider } from 'react-redux';
12-
import { store } from './src/app/store';
13-
import { Counter } from './src/features/counter/Counter';
14-
15-
import {
16-
DebugInstructions,
17-
HermesBadge,
18-
LearnMoreLinks,
19-
ReloadInstructions,
20-
} from 'react-native/Libraries/NewAppScreen';
21-
import { Header } from './src/components/Header';
22-
import { LearnReduxLinks } from './src/components/LearnReduxLinks';
23-
import { Section } from './src/components/Section';
24-
import { TypedColors } from './src/constants/TypedColors';
25-
26-
export const App: FC = () => {
27-
const isDarkMode = useColorScheme() === 'dark';
28-
29-
const backgroundStyle = {
30-
backgroundColor: isDarkMode ? TypedColors.darker : TypedColors.lighter,
31-
};
32-
33-
return (
34-
<Provider store={store}>
35-
<SafeAreaView style={backgroundStyle}>
36-
<StatusBar
37-
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
38-
backgroundColor={backgroundStyle.backgroundColor}
39-
/>
40-
<ScrollView
41-
contentInsetAdjustmentBehavior="automatic"
42-
style={backgroundStyle}>
43-
<Header />
44-
<HermesBadge />
45-
<View
46-
style={{
47-
backgroundColor: isDarkMode
48-
? TypedColors.black
49-
: TypedColors.white,
50-
}}>
51-
<Counter />
52-
<Section title="Step One">
53-
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
54-
screen and then come back to see your edits.
55-
</Section>
56-
<Section title="See Your Changes">
57-
<ReloadInstructions />
58-
</Section>
59-
<Section title="Debug">
60-
<DebugInstructions />
61-
</Section>
62-
<Section title="Learn More Redux">
63-
Discover what to do next with Redux:
64-
</Section>
65-
<LearnReduxLinks />
66-
<Section title="Learn More React Native">
67-
Read the docs to discover what to do next:
68-
</Section>
69-
<LearnMoreLinks />
70-
</View>
71-
</ScrollView>
72-
</SafeAreaView>
73-
</Provider>
74-
);
75-
};
76-
77-
const styles = StyleSheet.create({
78-
highlight: {
79-
fontWeight: '700',
80-
},
81-
});
82-
83-
export default App;
1+
import type { JSX } from 'react'
2+
import { Provider } from 'react-redux'
3+
import { store } from './src/app/store'
4+
import { Main } from './src/Main'
5+
6+
export const App = (): JSX.Element => (
7+
<Provider store={store}>
8+
<Main />
9+
</Provider>
10+
)

‎examples/publish-ci/expo/__tests__/App.test.tsx

-9
This file was deleted.

‎examples/publish-ci/expo/__tests__/counterSlice.test.ts

-37
This file was deleted.

‎examples/publish-ci/expo/app.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
"orientation": "portrait",
77
"icon": "./assets/icon.png",
88
"userInterfaceStyle": "light",
9+
"newArchEnabled": true,
910
"splash": {
10-
"image": "./assets/splash.png",
11+
"image": "./assets/splash-icon.png",
1112
"resizeMode": "contain",
1213
"backgroundColor": "#ffffff"
1314
},
14-
"assetBundlePatterns": ["**/*"],
1515
"ios": {
1616
"supportsTablet": true
1717
},
17.1 KB
Loading
-46.2 KB
Binary file not shown.
+19-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1-
/** @type {import('@babel/core').ConfigFunction} */
2-
module.exports = api => {
3-
api.cache.forever();
1+
/** @import { ConfigFunction } from "@babel/core" */
2+
/** @import { BabelPresetExpoOptions } from "babel-preset-expo" */
3+
4+
/**
5+
* @satisfies {ConfigFunction}
6+
*/
7+
const config = api => {
8+
api.cache.forever()
9+
410
return {
5-
presets: ['babel-preset-expo'],
6-
};
7-
};
11+
presets: [
12+
/**
13+
* @satisfies {['babel-preset-expo', BabelPresetExpoOptions?]}
14+
*/
15+
(['babel-preset-expo']),
16+
],
17+
}
18+
}
19+
20+
module.exports = config
+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import js from '@eslint/js'
2+
import prettierConfig from 'eslint-config-prettier/flat'
3+
import jestPlugin from 'eslint-plugin-jest'
4+
import reactPlugin from 'eslint-plugin-react'
5+
import reactHooksPlugin from 'eslint-plugin-react-hooks'
6+
import globals from 'globals'
7+
import { config, configs } from 'typescript-eslint'
8+
9+
const eslintConfig = config(
10+
{
11+
name: 'global-ignores',
12+
ignores: [
13+
'**/*.snap',
14+
'**/dist/',
15+
'**/.yalc/',
16+
'**/build/',
17+
'**/temp/',
18+
'**/.temp/',
19+
'**/.tmp/',
20+
'**/.yarn/',
21+
'**/coverage/',
22+
],
23+
},
24+
{
25+
name: `${js.meta.name}/recommended`,
26+
...js.configs.recommended,
27+
},
28+
configs.strictTypeChecked,
29+
configs.stylisticTypeChecked,
30+
{
31+
name: `${jestPlugin.meta.name}/recommended`,
32+
...jestPlugin.configs['flat/recommended'],
33+
},
34+
{
35+
name: 'eslint-plugin-react/jsx-runtime',
36+
...reactPlugin.configs.flat['jsx-runtime'],
37+
},
38+
reactHooksPlugin.configs['recommended-latest'],
39+
{
40+
name: 'main',
41+
linterOptions: {
42+
reportUnusedDisableDirectives: 2,
43+
},
44+
languageOptions: {
45+
ecmaVersion: 2020,
46+
globals: globals.node,
47+
parserOptions: {
48+
projectService: true,
49+
tsconfigRootDir: import.meta.dirname,
50+
},
51+
},
52+
rules: {
53+
'no-undef': [0],
54+
'no-restricted-imports': [
55+
2,
56+
{
57+
paths: [
58+
{
59+
name: 'react-redux',
60+
importNames: ['useSelector', 'useStore', 'useDispatch'],
61+
message:
62+
'Please use pre-typed versions from `src/app/hooks.ts` instead.',
63+
},
64+
],
65+
},
66+
],
67+
'@typescript-eslint/consistent-type-definitions': [2, 'type'],
68+
'@typescript-eslint/consistent-type-imports': [
69+
2,
70+
{
71+
prefer: 'type-imports',
72+
fixStyle: 'separate-type-imports',
73+
disallowTypeAnnotations: true,
74+
},
75+
],
76+
},
77+
},
78+
{
79+
name: 'commonjs',
80+
files: ['metro.config.js'],
81+
languageOptions: {
82+
sourceType: 'commonjs',
83+
},
84+
rules: {
85+
'@typescript-eslint/no-require-imports': [
86+
0,
87+
[{ allow: [], allowAsImport: false }],
88+
],
89+
},
90+
},
91+
92+
prettierConfig,
93+
)
94+
95+
export default eslintConfig

‎examples/publish-ci/expo/globals.d.ts

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
declare module '*.gif' {
2-
const logo: number;
3-
export default logo;
4-
}
5-
6-
declare module 'react-native/Libraries/NewAppScreen' {
7-
import type { FC } from 'react';
8-
export const HermesBadge: FC;
9-
}
10-
11-
declare module 'react-native/Libraries/Core/Devtools/openURLInBrowser' {
12-
export default function openURLInBrowser(url: string): void;
2+
const logo: number
3+
export default logo
134
}

‎examples/publish-ci/expo/index.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { registerRootComponent } from 'expo'
2+
import { App } from './App'
3+
4+
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
5+
// It also ensures that whether you load the app in Expo Go or in a native build,
6+
// the environment is set up appropriately
7+
registerRootComponent(App)
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import '@testing-library/react-native/extend-expect';
1+
import '@testing-library/react-native'

0 commit comments

Comments
 (0)
Failed to load comments.