From 82386bc3619be6bf7ec4a84024b6888a749e5811 Mon Sep 17 00:00:00 2001 From: Justin Bambrick <55550194+jbambrick@users.noreply.github.com> Date: Wed, 22 Nov 2023 15:35:49 -0800 Subject: [PATCH] feat(mobile-alphabet): implement routing * WIP: add routing with detox tests * WIP: test routes with detox using typescript * WIP: change home screen button to Alphabet * WIP: make changes from PR suggestions --- .detoxrc.json | 80 + apps/mobile-alphabet-e2e/.detoxrc.json | 2 +- .../java/com/mobilealphabet/MainActivity.java | 8 + apps/mobile-alphabet/package.json | 15 +- apps/mobile-alphabet/src/app/App.tsx | 666 +-- .../src/app/Components/Credits.tsx | 11 + .../src/app/Components/Home.tsx | 14 + apps/mobile-alphabet/src/app/app.test.ts | 12 + apps/mobile-alphabet/yarn.lock | 4137 +++++++++++++++++ e2e/jest.config.ts | 13 + e2e/starter.test.ts | 20 + package.json | 16 +- yarn.lock | 321 +- 13 files changed, 4630 insertions(+), 685 deletions(-) create mode 100644 .detoxrc.json create mode 100644 apps/mobile-alphabet/src/app/Components/Credits.tsx create mode 100644 apps/mobile-alphabet/src/app/Components/Home.tsx create mode 100644 apps/mobile-alphabet/src/app/app.test.ts create mode 100644 apps/mobile-alphabet/yarn.lock create mode 100644 e2e/jest.config.ts create mode 100644 e2e/starter.test.ts diff --git a/.detoxrc.json b/.detoxrc.json new file mode 100644 index 000000000..25dcc05ac --- /dev/null +++ b/.detoxrc.json @@ -0,0 +1,80 @@ +{ + "testRunner": { + "args": { + "$0": "jest", + "config": "e2e/jest.config.ts" + }, + "jest": { + "setupTimeout": 120000 + } + }, + "apps": { + "ios.debug": { + "type": "ios.app", + "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/YOUR_APP.app", + "build": "xcodebuild -workspace ios/YOUR_APP.xcworkspace -scheme YOUR_APP -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build" + }, + "ios.release": { + "type": "ios.app", + "binaryPath": "ios/build/Build/Products/Release-iphonesimulator/YOUR_APP.app", + "build": "xcodebuild -workspace ios/YOUR_APP.xcworkspace -scheme YOUR_APP -configuration Release -sdk iphonesimulator -derivedDataPath ios/build" + }, + "android.debug": { + "type": "android.apk", + "build": "cd apps/mobile-alphabet/android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug", + "binaryPath": "apps/mobile-alphabet/android/app/build/outputs/apk/debug/app-debug.apk", + "reversePorts": [8081] + }, + "android.release": { + "type": "android.apk", + "binaryPath": "android/app/build/outputs/apk/release/app-release.apk", + "build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release" + } + }, + "devices": { + "simulator": { + "type": "ios.simulator", + "device": { + "type": "iPhone 12" + } + }, + "attached": { + "type": "android.attached", + "device": { + "adbName": ".*" + } + }, + "emulator": { + "type": "android.emulator", + "device": { + "avdName": "Pixel_3a_API_34_extension_level_7_x86_64" + } + } + }, + "configurations": { + "ios.sim.debug": { + "device": "simulator", + "app": "ios.debug" + }, + "ios.sim.release": { + "device": "simulator", + "app": "ios.release" + }, + "android.att.debug": { + "device": "attached", + "app": "android.debug" + }, + "android.att.release": { + "device": "attached", + "app": "android.release" + }, + "android.emu.debug": { + "device": "emulator", + "app": "android.debug" + }, + "android.emu.release": { + "device": "emulator", + "app": "android.release" + } + } +} diff --git a/apps/mobile-alphabet-e2e/.detoxrc.json b/apps/mobile-alphabet-e2e/.detoxrc.json index ff900064c..34bb3883c 100644 --- a/apps/mobile-alphabet-e2e/.detoxrc.json +++ b/apps/mobile-alphabet-e2e/.detoxrc.json @@ -34,7 +34,7 @@ "emulator": { "type": "android.emulator", "device": { - "avdName": "Pixel_4a_API_30" + "avdName": "Pixel_3a_API_34_extension_level_7_x86_64" } } }, diff --git a/apps/mobile-alphabet/android/app/src/main/java/com/mobilealphabet/MainActivity.java b/apps/mobile-alphabet/android/app/src/main/java/com/mobilealphabet/MainActivity.java index 17683ae2f..4297ede73 100644 --- a/apps/mobile-alphabet/android/app/src/main/java/com/mobilealphabet/MainActivity.java +++ b/apps/mobile-alphabet/android/app/src/main/java/com/mobilealphabet/MainActivity.java @@ -1,5 +1,6 @@ package com.mobilealphabet; +import android.os.Bundle; import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; @@ -7,6 +8,8 @@ public class MainActivity extends ReactActivity { + + /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. @@ -16,6 +19,11 @@ protected String getMainComponentName() { return "MobileAlphabet"; } + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(null); + } + /** * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React diff --git a/apps/mobile-alphabet/package.json b/apps/mobile-alphabet/package.json index 9aeb7ca75..e3e8fdcb9 100644 --- a/apps/mobile-alphabet/package.json +++ b/apps/mobile-alphabet/package.json @@ -3,12 +3,19 @@ "version": "0.0.1", "private": true, "dependencies": { + "@react-native-async-storage/async-storage": "*", + "@react-native-community/masked-view": "^0.1.11", + "@react-navigation/native": "^6.1.9", "@testing-library/jest-native": "*", "@testing-library/react-native": "*", "react": "*", - "react-native": "*", + "react-native": "^0.72.6", "react-native-config": "*", - "react-native-svg": "*", - "@react-native-async-storage/async-storage": "*" - } + "react-native-gesture-handler": "^2.13.4", + "react-native-reanimated": "^3.5.4", + "react-native-safe-area-context": "^4.7.4", + "react-native-screens": "^3.27.0", + "react-native-svg": "*" + }, + "devDependencies": {} } diff --git a/apps/mobile-alphabet/src/app/App.tsx b/apps/mobile-alphabet/src/app/App.tsx index 03ca14fc4..2561cb0e1 100644 --- a/apps/mobile-alphabet/src/app/App.tsx +++ b/apps/mobile-alphabet/src/app/App.tsx @@ -1,644 +1,36 @@ -/* eslint-disable jsx-a11y/accessible-emoji */ -import React, { useRef, useState } from 'react'; -import { - Linking, - SafeAreaView, - ScrollView, - StatusBar, - StyleSheet, - Text, - TouchableOpacity, - View, -} from 'react-native'; -import Svg, { Path } from 'react-native-svg'; +import { NavigationContainer } from '@react-navigation/native'; +import { createNativeStackNavigator } from '@react-navigation/native-stack'; +import React from 'react'; +import 'react-native-gesture-handler'; +import CreditsScreen from './Components/Credits'; +import HomeScreen from './Components/Home'; -export const App = () => { - const [whatsNextYCoord, setWhatsNextYCoord] = useState(0); - const scrollViewRef = useRef(null); +// function HomeScreens({ navigation }) { +// return ( +// +// Home screen works! +//