Initial
This commit is contained in:
20
reactnative/app/_layout.js
Normal file
20
reactnative/app/_layout.js
Normal 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
30
reactnative/app/index.js
Normal 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;
|
||||
44
reactnative/app/projects.js
Normal file
44
reactnative/app/projects.js
Normal 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
7
reactnative/app/time.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import {Text} from "react-native";
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
<Text>Time</Text>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user