From 7cdeb8fb2013f273b1e9265f96f472671b4803e1 Mon Sep 17 00:00:00 2001 From: Josh Fung Date: Mon, 29 Jan 2024 00:46:33 +0100 Subject: [PATCH 01/10] Modified file structure and implemented skeleton --- App.tsx | 22 ++++--- package-lock.json | 14 ++-- package.json | 6 +- src/Components/LapsList/LapsList.tsx | 22 +++++++ src/Components/StopWatch/StopWatch.tsx | 11 ++++ .../StopWatchButton/StopWatchButton.tsx | 44 +++++++++++++ .../StopWatchScreen/StopWatchScreen.tsx | 47 ++++++++++++++ src/StopWatch.tsx | 8 --- src/StopWatchButton.tsx | 8 --- tests/Stopwatch.test.js | 64 ++++++++++--------- 10 files changed, 180 insertions(+), 66 deletions(-) create mode 100644 src/Components/LapsList/LapsList.tsx create mode 100644 src/Components/StopWatch/StopWatch.tsx create mode 100644 src/Components/StopWatchButton/StopWatchButton.tsx create mode 100644 src/Screens/StopWatchScreen/StopWatchScreen.tsx delete mode 100644 src/StopWatch.tsx delete mode 100644 src/StopWatchButton.tsx diff --git a/App.tsx b/App.tsx index 0329d0c..81c9e5c 100644 --- a/App.tsx +++ b/App.tsx @@ -1,20 +1,24 @@ -import { StatusBar } from 'expo-status-bar'; -import { StyleSheet, Text, View } from 'react-native'; +import { StatusBar } from "expo-status-bar"; +import { SafeAreaView, StyleSheet, Text, View } from "react-native"; +import StopWatch from "./src/Components/StopWatch/StopWatch"; +import StopWatchScreen from "./src/Screens/StopWatchScreen/StopWatchScreen"; export default function App() { return ( - - Open up App.tsx to start working on your app! - - + + {/* Open up App.tsx to start working on your app! */} + + + {/* */} + ); } const styles = StyleSheet.create({ container: { flex: 1, - backgroundColor: '#fff', - alignItems: 'center', - justifyContent: 'center', + backgroundColor: "#fff", + alignItems: "center", + justifyContent: "center", }, }); diff --git a/package-lock.json b/package-lock.json index ea36168..a360b56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9208,9 +9208,9 @@ } }, "node_modules/expo": { - "version": "49.0.21", - "resolved": "https://registry.npmjs.org/expo/-/expo-49.0.21.tgz", - "integrity": "sha512-JpHL6V0yt8/fzsmkAdPdtsah+lU6Si4ac7MDklLYvzEil7HAFEsN/pf06wQ21ax4C+BL27hI6JJoD34tzXUCJA==", + "version": "49.0.22", + "resolved": "https://registry.npmjs.org/expo/-/expo-49.0.22.tgz", + "integrity": "sha512-1hhcphaKN74gDqEmGzU4sqxnusLi/i8SsWZ04rRn7b6zdyEchyudVLN3SOzeIUgfGmn7AcXm78JAQ7+e0WqSyw==", "dependencies": { "@babel/runtime": "^7.20.0", "@expo/cli": "0.10.16", @@ -9225,7 +9225,7 @@ "expo-font": "~11.4.0", "expo-keep-awake": "~12.3.0", "expo-modules-autolinking": "1.5.1", - "expo-modules-core": "1.5.12", + "expo-modules-core": "1.5.13", "fbemitter": "^3.0.0", "invariant": "^2.2.4", "md5-file": "^3.2.3", @@ -9415,9 +9415,9 @@ } }, "node_modules/expo-modules-core": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/expo-modules-core/-/expo-modules-core-1.5.12.tgz", - "integrity": "sha512-mY4wTDU458dhwk7IVxLNkePlYXjs9BTgk4NQHBUXf0LapXsvr+i711qPZaFNO4egf5qq6fQV+Yfd/KUguHstnQ==", + "version": "1.5.13", + "resolved": "https://registry.npmjs.org/expo-modules-core/-/expo-modules-core-1.5.13.tgz", + "integrity": "sha512-cKRsiHKwpDPRkBgMW3XdUWmEUDzihEPWXAyeo629BXpJ6uX6a66Zbz63SEXhlgsbLq8FB77gvYku3ceBqb+hHg==", "dependencies": { "compare-versions": "^3.4.0", "invariant": "^2.2.4" diff --git a/package.json b/package.json index bf0f5a3..ac35609 100644 --- a/package.json +++ b/package.json @@ -12,10 +12,10 @@ "dependencies": { "expo": "~49.0.15", "expo-status-bar": "~1.6.0", - "react": "18.2.0", - "react-native": "0.72.6", + "jest": "^29.2.1", "jest-expo": "~49.0.0", - "jest": "^29.2.1" + "react": "18.2.0", + "react-native": "0.72.6" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/src/Components/LapsList/LapsList.tsx b/src/Components/LapsList/LapsList.tsx new file mode 100644 index 0000000..3f5cc7c --- /dev/null +++ b/src/Components/LapsList/LapsList.tsx @@ -0,0 +1,22 @@ +import React from "react"; +import { ScrollView, StyleSheet, Text, View } from "react-native"; + +const LapsList = () => { + return ( + + + 1 + 2 + 3 + + + ); +}; + +const styles = StyleSheet.create({ + container: { + height: "50%", + }, +}); + +export default LapsList; diff --git a/src/Components/StopWatch/StopWatch.tsx b/src/Components/StopWatch/StopWatch.tsx new file mode 100644 index 0000000..11f9794 --- /dev/null +++ b/src/Components/StopWatch/StopWatch.tsx @@ -0,0 +1,11 @@ +import { useState } from "react"; +import { Text, View } from "react-native"; +import StopWatchButton from "../StopWatchButton/StopWatchButton"; + +export default function StopWatch() { + return ( + + 00:00:00 + + ); +} diff --git a/src/Components/StopWatchButton/StopWatchButton.tsx b/src/Components/StopWatchButton/StopWatchButton.tsx new file mode 100644 index 0000000..0c4a943 --- /dev/null +++ b/src/Components/StopWatchButton/StopWatchButton.tsx @@ -0,0 +1,44 @@ +import { + Alert, + Button, + StyleSheet, + Text, + TouchableHighlight, + View, +} from "react-native"; + +const StopWatchButton = () => { + return ( + + {/*