Skip to content

Commit 41a539c

Browse files
feat(example-app): Add a LOT of functionality to the demo app (#1424) [skip ci]
This work builds on the old demo app that was removed a while ago. @morganick added the basic app framework the other day and this PR fleshes out the app to be more Reactotron branded. There's still some work to do particularly fleshing out the custom commands screen and getting some interaction there. Maybe we navigate them to a screen that has no way to go back, but instruct them to run a command in Reactotron to fix the navigation state or something. I think that this will continue to be a work in progress. I really like having a "kitchen sink" app that demo's all of Reactotron's functionality. Check out this video for how it looks in action: https://github.com/infinitered/reactotron/assets/139261/d78f1782-579b-45c4-bbb7-1959d042e5e9 # Here's some screenshots: <table> <tr> <td><img src="https://github.com/infinitered/reactotron/assets/139261/66775f4b-9fd7-47dc-a8eb-db6a1e4a42ef" /></td> <td><img src="https://github.com/infinitered/reactotron/assets/139261/665bb848-c15c-41ea-80e9-925aa18a8fe6" /></td> <td><img src="https://github.com/infinitered/reactotron/assets/139261/483e1759-96e2-4b6e-84b1-565a73829a45" /> </td> </tr> </table> --------- Co-authored-by: Nick Morgan <[email protected]>
1 parent 726f255 commit 41a539c

File tree

127 files changed

+1682
-2355
lines changed

Some content is hidden

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

127 files changed

+1682
-2355
lines changed

apps/example-app/.prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"printWidth": 100,
3+
"semi": false,
4+
"singleQuote": false,
5+
"trailingComma": "es5"
6+
}

apps/example-app/app.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
"fallbackToCacheTimeout": 0
1818
},
1919
"jsEngine": "hermes",
20-
"assetBundlePatterns": [
21-
"**/*"
22-
],
20+
"assetBundlePatterns": ["**/*"],
2321
"android": {
2422
"icon": "./assets/images/app-icon-android-legacy.png",
2523
"package": "com.exampleapp",
@@ -74,4 +72,4 @@
7472
"ignite": {
7573
"version": "9.4.0"
7674
}
77-
}
75+
}

apps/example-app/app/app.tsx

+29-22
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* it very often. But take some time to look through and understand
88
* what is going on here.
99
*
10-
* The app navigation resides in ./app/navigators, so head over there
10+
* The app navigation resides in app/app/navigators, so head over there
1111
* if you're interested in adding screens and navigators.
1212
*/
1313
if (__DEV__) {
@@ -16,23 +16,27 @@ if (__DEV__) {
1616
// to only execute this in development.
1717
require("./devtools/ReactotronConfig.ts")
1818
}
19-
import "./i18n"
20-
import "./utils/ignoreWarnings"
19+
import "app/i18n"
20+
import "app/utils/ignoreWarnings"
2121
import { useFonts } from "expo-font"
2222
import React from "react"
2323
import { initialWindowMetrics, SafeAreaProvider } from "react-native-safe-area-context"
2424
import * as Linking from "expo-linking"
25-
import { useInitialRootStore } from "./models"
26-
import { AppNavigator, useNavigationPersistence } from "./navigators"
27-
import { ErrorBoundary } from "./screens/ErrorScreen/ErrorBoundary"
28-
import * as storage from "./utils/storage"
29-
import { customFontsToLoad } from "./theme"
30-
import Config from "./config"
25+
import { useInitialRootStore } from "app/mobxStateTree"
26+
import { AppNavigator, useNavigationPersistence } from "app/navigators"
27+
import { ErrorBoundary } from "app/screens/ErrorScreen/ErrorBoundary"
28+
import * as storage from "app/utils/storage"
29+
import { customFontsToLoad } from "app/theme"
30+
import Config from "app/config"
3131
import { GestureHandlerRootView } from "react-native-gesture-handler"
32-
import { ViewStyle } from "react-native"
32+
import { StatusBar, ViewStyle } from "react-native"
33+
import { store } from "app/redux"
34+
import { Provider as ReduxProvider } from "react-redux"
3335

3436
export const NAVIGATION_PERSISTENCE_KEY = "NAVIGATION_STATE"
3537

38+
StatusBar.setBarStyle("light-content")
39+
3640
// Web linking configuration
3741
const prefix = Linking.createURL("/")
3842
const config = {
@@ -96,21 +100,24 @@ function App(props: AppProps) {
96100

97101
// otherwise, we're ready to render the app
98102
return (
99-
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
100-
<ErrorBoundary catchErrors={Config.catchErrors}>
101-
<GestureHandlerRootView style={$container}>
102-
<AppNavigator
103-
linking={linking}
104-
initialState={initialNavigationState}
105-
onStateChange={onNavigationStateChange}
106-
/>
107-
</GestureHandlerRootView>
108-
</ErrorBoundary>
109-
</SafeAreaProvider>
103+
<ReduxProvider store={store}>
104+
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
105+
<ErrorBoundary catchErrors={Config.catchErrors}>
106+
<GestureHandlerRootView style={$container}>
107+
<AppNavigator
108+
linking={linking}
109+
initialState={initialNavigationState}
110+
onStateChange={onNavigationStateChange}
111+
/>
112+
</GestureHandlerRootView>
113+
</ErrorBoundary>
114+
</SafeAreaProvider>
115+
</ReduxProvider>
110116
)
111117
}
112118

113-
export default App
119+
// eslint-disable-next-line reactotron/no-tron-in-production
120+
export default __DEV__ ? console.tron.overlay(App) : App
114121

115122
const $container: ViewStyle = {
116123
flex: 1,

apps/example-app/app/components/AutoImage.tsx

-72
This file was deleted.

apps/example-app/app/components/Button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
TextStyle,
88
ViewStyle,
99
} from "react-native"
10-
import { colors, spacing, typography } from "../theme"
10+
import { colors, spacing, typography } from "app/theme"
1111
import { Text, TextProps } from "./Text"
1212

1313
type Presets = keyof typeof $viewPresets

0 commit comments

Comments
 (0)