Skip to content
Snippets Groups Projects
Commit bdbc6791 authored by Tobias Olaussen Orø's avatar Tobias Olaussen Orø
Browse files

Final commit

parent e1c0035c
No related branches found
No related tags found
No related merge requests found
### TODO-Mobile-Application (IDATT 2506)
# TODO-Mobile-Application (IDATT 2506)
## Running the Application
First time? You will most likely be asked to sign into an Expo account (https://expo.dev/signup).
If you want to test it on your own phone, you need to have Expo version 51.
1. Install Android Studio if you dont already have it.
1. Install Android Studio if you do not already have it.
Choose the emulator Google Pixel 6 API 34.
2. Install dependencies
......@@ -20,13 +20,6 @@ If you want to test it on your own phone, you need to have Expo version 51.
npx expo start
```
In the output, you'll find options to open the app in a
- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo
## Android
Press A to open Android.
......@@ -34,11 +27,3 @@ Press A to open Android.
## Something wrong?
Try typing npx expo-doctor.
## Get a fresh project
When you're ready, run:
```bash
npm run reset-project
```
......@@ -4,7 +4,6 @@
"version": "1.0.0",
"scripts": {
"start": "expo start",
"reset-project": "node ./src/scripts/reset-project.js",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
......
......@@ -5,6 +5,7 @@ import { Stack } from "expo-router";
*
* @returns The default header is not visible.
*/
export default function RootLayout() {
return (
<Stack>
......
......@@ -16,6 +16,7 @@ const Tab = createBottomTabNavigator();
*
* @returns The bottom tab navigator with configured tabs and options.
*/
export default function Index() {
return (
<Tab.Navigator
......
......@@ -26,6 +26,7 @@ export interface AddListProps {
* @param props - The props for the "AddList" component.
* @returns The rendered "AddList" modal component.
*/
const AddList = (props: AddListProps) => {
return (
<Modal
......
import {
View,
Text,
TextInput,
StyleSheet,
Dimensions,
......
......@@ -36,10 +36,7 @@ const Item = (props: ItemProps) => {
<Text style={props.completed ? styles.completedText : styles.text}>
{props.text}
</Text>
<Pressable
style={styles.deleteButton}
onPress={() => props.onDelete(props.id)}
>
<Pressable onPress={() => props.onDelete(props.id)}>
<MaterialIcons name="delete" size={21} color="#b83333" />
</Pressable>
</View>
......@@ -66,15 +63,14 @@ const styles = StyleSheet.create({
completedText: {
textDecorationLine: "line-through",
color: "#808080",
paddingLeft: 4,
paddingLeft: 5,
paddingRight: 5,
flexShrink: 1,
},
text: {
color: "#000",
paddingLeft: 4,
paddingLeft: 5,
paddingRight: 5,
alignItems: "flex-start",
flexShrink: 1,
},
undoCheckButton: {
......@@ -83,7 +79,6 @@ const styles = StyleSheet.create({
borderColor: "#256f99",
padding: 3,
},
deleteButton: {},
});
export default Item;
#!/usr/bin/env node
/**
* This script is used to reset the project to a blank state.
* It moves the /app directory to /app-example and creates a new /app directory with an index.tsx and _layout.tsx file.
* You can remove the `reset-project` script from package.json and safely delete this file after running it.
*/
const fs = require('fs');
const path = require('path');
const root = process.cwd();
const oldDirPath = path.join(root, 'app');
const newDirPath = path.join(root, 'app-example');
const newAppDirPath = path.join(root, 'app');
const indexContent = `import { Text, View } from "react-native";
export default function Index() {
return (
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
}}
>
<Text>Edit app/index.tsx to edit this screen.</Text>
</View>
);
}
`;
const layoutContent = `import { Stack } from "expo-router";
export default function RootLayout() {
return (
<Stack>
<Stack.Screen name="index" />
</Stack>
);
}
`;
fs.rename(oldDirPath, newDirPath, (error) => {
if (error) {
return console.error(`Error renaming directory: ${error}`);
}
console.log('/app moved to /app-example.');
fs.mkdir(newAppDirPath, { recursive: true }, (error) => {
if (error) {
return console.error(`Error creating new app directory: ${error}`);
}
console.log('New /app directory created.');
const indexPath = path.join(newAppDirPath, 'index.tsx');
fs.writeFile(indexPath, indexContent, (error) => {
if (error) {
return console.error(`Error creating index.tsx: ${error}`);
}
console.log('app/index.tsx created.');
const layoutPath = path.join(newAppDirPath, '_layout.tsx');
fs.writeFile(layoutPath, layoutContent, (error) => {
if (error) {
return console.error(`Error creating _layout.tsx: ${error}`);
}
console.log('app/_layout.tsx created.');
});
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment