Skip to content

Commit 9baa6de

Browse files
committed
chore: update Expo example app
1 parent 94c517e commit 9baa6de

39 files changed

+12137
-13845
lines changed

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

Lines changed: 0 additions & 41 deletions
This file was deleted.

examples/publish-ci/expo/.gitignore

Lines changed: 8 additions & 0 deletions
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
Lines changed: 2 additions & 3 deletions
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

Lines changed: 10 additions & 83 deletions
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

Lines changed: 0 additions & 9 deletions
This file was deleted.

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

Lines changed: 0 additions & 37 deletions
This file was deleted.

examples/publish-ci/expo/app.json

Lines changed: 2 additions & 2 deletions
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.
Lines changed: 19 additions & 6 deletions
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
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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+
'**/dist/',
14+
'**/build/',
15+
'**/lib/',
16+
'**/coverage/',
17+
'**/__snapshots__/',
18+
'**/temp/',
19+
'**/.temp/',
20+
'**/.tmp/',
21+
'**/.yalc/',
22+
'**/.yarn/',
23+
'**/.docusaurus/',
24+
'**/.next/',
25+
'**/.expo/',
26+
'**/*.snap',
27+
],
28+
},
29+
{
30+
name: `${js.meta.name}/recommended`,
31+
...js.configs.recommended,
32+
},
33+
configs.strictTypeChecked,
34+
configs.stylisticTypeChecked,
35+
{
36+
name: `${jestPlugin.meta.name}/recommended`,
37+
...jestPlugin.configs['flat/recommended'],
38+
},
39+
{
40+
name: 'eslint-plugin-react/jsx-runtime',
41+
...reactPlugin.configs.flat['jsx-runtime'],
42+
},
43+
reactHooksPlugin.configs['recommended-latest'],
44+
{
45+
name: 'main',
46+
languageOptions: {
47+
ecmaVersion: 2020,
48+
globals: globals.node,
49+
parserOptions: {
50+
projectService: true,
51+
tsconfigRootDir: import.meta.dirname,
52+
},
53+
},
54+
rules: {
55+
'no-undef': [0],
56+
'no-restricted-imports': [
57+
2,
58+
{
59+
paths: [
60+
{
61+
name: 'react-redux',
62+
importNames: ['useSelector', 'useStore', 'useDispatch'],
63+
message:
64+
'Please use pre-typed versions from `src/app/hooks.ts` instead.',
65+
},
66+
],
67+
},
68+
],
69+
'@typescript-eslint/consistent-type-definitions': [2, 'type'],
70+
'@typescript-eslint/consistent-type-imports': [
71+
2,
72+
{
73+
prefer: 'type-imports',
74+
fixStyle: 'separate-type-imports',
75+
disallowTypeAnnotations: true,
76+
},
77+
],
78+
},
79+
80+
linterOptions: {
81+
reportUnusedDisableDirectives: 2,
82+
},
83+
},
84+
{
85+
name: 'commonjs-files',
86+
files: ['metro.config.js'],
87+
languageOptions: {
88+
sourceType: 'commonjs',
89+
},
90+
rules: {
91+
'@typescript-eslint/no-require-imports': [
92+
0,
93+
{ allow: [], allowAsImport: false },
94+
],
95+
},
96+
},
97+
98+
prettierConfig,
99+
)
100+
101+
export default eslintConfig

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

Lines changed: 2 additions & 11 deletions
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

Lines changed: 7 additions & 0 deletions
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)
Lines changed: 1 addition & 1 deletion
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)