This commit is contained in:
Florian Federspiel
2023-11-25 16:53:52 +01:00
commit 677030f712
685 changed files with 148719 additions and 0 deletions

14
reactnative/.gitignore vendored Normal file
View File

@@ -0,0 +1,14 @@
node_modules/
.expo/
dist/
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
# macOS
.DS_Store

14
reactnative/README.md Normal file
View File

@@ -0,0 +1,14 @@
# Expo Router Example
Use [`expo-router`](https://expo.github.io/router) to build native navigation using files in the `app/` directory.
## 🚀 How to use
```sh
npx create-expo-app -e with-router
```
## 📝 Notes
- [Expo Router: Docs](https://expo.github.io/router)
- [Expo Router: Repo](https://github.com/expo/router)

13
reactnative/app.json Normal file
View File

@@ -0,0 +1,13 @@
{
"expo": {
"scheme": "acme",
"web": {
"bundler": "metro"
},
"plugins": [
"expo-router"
],
"name": "reactnative",
"slug": "reactnative"
}
}

View File

@@ -0,0 +1,20 @@
import {Stack} from "expo-router"
import {Tabs} from "expo-router";
const Layout = () => {
return (
<Tabs>
<Tabs.Screen
name="index"
/>
<Tabs.Screen
name="time"
options={{
href: null
}}
/>
</Tabs>
)
}
export default Layout

30
reactnative/app/index.js Normal file
View File

@@ -0,0 +1,30 @@
import {StyleSheet,View, Text, Pressable} from 'react-native'
import {Link} from "expo-router";
const Home = () => {
return (
<View style={styles.container}>
<Text>Home</Text>
<Link href="/time" asChild>
<Pressable>
<Text>Zeiten</Text>
</Pressable>
</Link>
<Link href="/projects">Projekte</Link>
</View>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: "center",
justifyContent: "center"
}
})
export default Home;

View File

@@ -0,0 +1,44 @@
import {ActivityIndicator, FlatList, Text, View} from "react-native";
import {useState, useEffect} from "react";
export default function Page() {
const [isLoading, setLoading] = useState(true);
const [data, setData] = useState([]);
const getProjects = () => {
return fetch('http://192.168.178.129:1337/api/projects?populate=*')
.then(response => response.json())
.then(json => {
setData(json.data);
setLoading(false)
})
.catch(error => {
console.error(error);
});
};
useEffect(() => {
getProjects();
})
return (
<View style={{flex:1,padding: 24}}>
{
isLoading ? (
<ActivityIndicator/>
) : (
<FlatList
data={data}
keyExtractor={({id}) => id}
renderItem={({item}) => (
<View style={{height: "120px", width: '95%', backgroundColor: 'grey', marginTop: 10, borderColor: '#69c350'}}>
<Text>{item.attributes.name}</Text>
</View>
)}
/>
)
}
</View>
)
}

7
reactnative/app/time.js Normal file
View File

@@ -0,0 +1,7 @@
import {Text} from "react-native";
export default function Page() {
return (
<Text>Time</Text>
)
}

View File

@@ -0,0 +1,11 @@
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
"@babel/plugin-proposal-export-namespace-from",
"react-native-reanimated/plugin",
require.resolve("expo-router/babel"),
],
};
};

1
reactnative/index.js Normal file
View File

@@ -0,0 +1 @@
import "expo-router/entry";

14289
reactnative/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

43
reactnative/package.json Normal file
View File

@@ -0,0 +1,43 @@
{
"name": "reactnative",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"axios": "^1.6.2",
"expo": "^49.0.3",
"expo-constants": "~14.4.2",
"expo-font": "^11.6.0",
"expo-linking": "~5.0.2",
"expo-router": "2.0.0",
"expo-splash-screen": "~0.20.4",
"expo-status-bar": "~1.6.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.72.3",
"react-native-dotenv": "^3.4.9",
"react-native-gesture-handler": "~2.12.0",
"react-native-reanimated": "~3.3.0",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.22.0",
"react-native-web": "~0.19.6"
},
"devDependencies": {
"@babel/core": "^7.19.3",
"@babel/plugin-proposal-export-namespace-from": "^7.18.9"
},
"resolutions": {
"metro": "^0.73.7",
"metro-resolver": "^0.73.7"
},
"overrides": {
"metro": "^0.73.7",
"metro-resolver": "^0.73.7"
},
"private": true
}