diff --git a/example/app.config.ts b/example/app.config.ts index 23f9c8ad..4661c24d 100644 --- a/example/app.config.ts +++ b/example/app.config.ts @@ -4,9 +4,11 @@ import 'ts-node/register'; const config: ExpoConfig = { name: "react-native-mcu-manager-example", slug: "react-native-mcu-manager-example", - version: "1.0.0", - orientation: "portrait", assetBundlePatterns: ["**/*"], + orientation: "portrait", + platforms: ["ios", "android"], + scheme: "rnmcumgr", + version: "1.0.0", splash: { image: ".assets/images/pd.png", backgroundColor: "#FFFFFF", @@ -27,6 +29,7 @@ const config: ExpoConfig = { }, plugins: [ ["expo-document-picker"], + ["expo-router"], ["./gradlePlugin.ts"] ] }; diff --git a/example/index.ts b/example/index.ts deleted file mode 100644 index 018d06f9..00000000 --- a/example/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { registerRootComponent } from 'expo'; - -import App from './src/App'; - -// registerRootComponent calls AppRegistry.registerComponent('main', () => App); -// It also ensures that whether you load the app in Expo Go or in a native build, -// the environment is set up appropriately -registerRootComponent(App); diff --git a/example/package.json b/example/package.json index 90416df4..e27849a8 100644 --- a/example/package.json +++ b/example/package.json @@ -1,8 +1,9 @@ { "name": "react-native-mcu-manager-example", "description": "Example app for react-native-mcu-manager", + "main": "expo-router/entry", "version": "0.0.1", - "private": true, + "license": "MIT", "scripts": { "android": "expo run:android", "ios": "expo run:ios", @@ -13,12 +14,19 @@ "dependencies": { "@playerdata/react-native-mcu-manager": "workspace:*", "expo": "52.0.25", + "expo-constants": "~17.0.4", "expo-document-picker": "13.0.2", + "expo-linking": "~7.0.4", + "expo-router": "~4.0.16", "expo-splash-screen": "0.29.20", + "expo-status-bar": "~2.0.1", "lodash": "4.17.21", "react": "18.3.1", "react-native": "0.76.3", "react-native-ble-plx": "3.4.0", + "react-native-reanimated": "~3.16.1", + "react-native-safe-area-context": "4.12.0", + "react-native-screens": "~4.4.0", "react-native-toast-message": "2.2.1" }, "devDependencies": { @@ -27,7 +35,6 @@ "@types/lodash": "4.17.14", "@types/react": "19.0.7", "metro-react-native-babel-preset": "0.77.0", - "pod-install": "0.3.4", "ts-node": "^10.9.2", "typescript": "5.7.3" } diff --git a/example/src/app/(home)/_layout.tsx b/example/src/app/(home)/_layout.tsx new file mode 100644 index 00000000..f61245a7 --- /dev/null +++ b/example/src/app/(home)/_layout.tsx @@ -0,0 +1,15 @@ +import { Stack } from 'expo-router'; + +const HomeLayout = () => { + return ( + + + + + ); +}; + +export default HomeLayout; diff --git a/example/src/app/(home)/index.tsx b/example/src/app/(home)/index.tsx new file mode 100644 index 00000000..94a04ab5 --- /dev/null +++ b/example/src/app/(home)/index.tsx @@ -0,0 +1,62 @@ +import React, { useState } from 'react'; +import { Button, StyleSheet, Text, View } from 'react-native'; + +import { Link } from 'expo-router'; + +import { resetDevice } from '@playerdata/react-native-mcu-manager'; + +import { useSelectedDevice } from '../../context/selectedDevice'; + +const styles = StyleSheet.create({ + root: { + padding: 16, + }, + + block: { + marginBottom: 16, + }, +}); + +const Home = () => { + const { selectedDevice } = useSelectedDevice(); + const [resetState, setResetState] = useState(''); + + return ( + + + + Select a device, then use the tabs below to choose which function to + test + + + + +