Initial commit
This commit is contained in:
41
.gitignore
vendored
Normal file
41
.gitignore
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Expo
|
||||||
|
.expo/
|
||||||
|
dist/
|
||||||
|
web-build/
|
||||||
|
expo-env.d.ts
|
||||||
|
|
||||||
|
# Native
|
||||||
|
.kotlin/
|
||||||
|
*.orig.*
|
||||||
|
*.jks
|
||||||
|
*.p8
|
||||||
|
*.p12
|
||||||
|
*.key
|
||||||
|
*.mobileprovision
|
||||||
|
|
||||||
|
# Metro
|
||||||
|
.metro-health-check*
|
||||||
|
|
||||||
|
# debug
|
||||||
|
npm-debug.*
|
||||||
|
yarn-debug.*
|
||||||
|
yarn-error.*
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
.DS_Store
|
||||||
|
*.pem
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env*.local
|
||||||
|
|
||||||
|
# typescript
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# generated native folders
|
||||||
|
/ios
|
||||||
|
/android
|
||||||
52
App.tsx
Normal file
52
App.tsx
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import { NavigationContainer, DefaultTheme } from '@react-navigation/native';
|
||||||
|
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
||||||
|
import UsersScreen from './screens/UsersScreen';
|
||||||
|
import PostsScreen from './screens/PostsScreen';
|
||||||
|
import TodosScreen from './screens/TodosScreen';
|
||||||
|
import { View, TextInput, StyleSheet } from 'react-native';
|
||||||
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
||||||
|
|
||||||
|
const Tab = createBottomTabNavigator();
|
||||||
|
|
||||||
|
const DarkTheme = {
|
||||||
|
...DefaultTheme,
|
||||||
|
colors: {
|
||||||
|
...DefaultTheme.colors,
|
||||||
|
primary: '#ff00ff',
|
||||||
|
background: '#000000',
|
||||||
|
card: '#1a1a1a',
|
||||||
|
text: '#ffffff',
|
||||||
|
border: '#333333',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function App() {
|
||||||
|
const [filter, setFilter] = useState('');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<GestureHandlerRootView style={{ flex: 1 }}>
|
||||||
|
<NavigationContainer theme={DarkTheme}>
|
||||||
|
<View style={styles.container}>
|
||||||
|
<TextInput
|
||||||
|
style={styles.filter}
|
||||||
|
placeholder="Globális szűrő"
|
||||||
|
placeholderTextColor="#999999"
|
||||||
|
value={filter}
|
||||||
|
onChangeText={setFilter}
|
||||||
|
/>
|
||||||
|
<Tab.Navigator>
|
||||||
|
<Tab.Screen name="Users">{() => <UsersScreen filter={filter} />}</Tab.Screen>
|
||||||
|
<Tab.Screen name="Posts">{() => <PostsScreen filter={filter} />}</Tab.Screen>
|
||||||
|
<Tab.Screen name="Todos">{() => <TodosScreen filter={filter} />}</Tab.Screen>
|
||||||
|
</Tab.Navigator>
|
||||||
|
</View>
|
||||||
|
</NavigationContainer>
|
||||||
|
</GestureHandlerRootView>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: { flex: 1, backgroundColor: '#000000' },
|
||||||
|
filter: { padding: 16, borderBottomWidth: 1, borderBottomColor: '#333333', marginTop: 40, backgroundColor: '#1a1a1a', color: '#ffffff' },
|
||||||
|
});
|
||||||
28
app.json
Normal file
28
app.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"expo": {
|
||||||
|
"name": "feladat4-dashboard",
|
||||||
|
"slug": "feladat4-dashboard",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"orientation": "portrait",
|
||||||
|
"icon": "./assets/icon.png",
|
||||||
|
"userInterfaceStyle": "light",
|
||||||
|
"newArchEnabled": true,
|
||||||
|
"splash": {
|
||||||
|
"image": "./assets/splash-icon.png",
|
||||||
|
"resizeMode": "contain",
|
||||||
|
"backgroundColor": "#ffffff"
|
||||||
|
},
|
||||||
|
"ios": {
|
||||||
|
"supportsTablet": true
|
||||||
|
},
|
||||||
|
"android": {
|
||||||
|
"adaptiveIcon": {
|
||||||
|
"foregroundImage": "./assets/adaptive-icon.png",
|
||||||
|
"backgroundColor": "#ffffff"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"web": {
|
||||||
|
"favicon": "./assets/favicon.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
assets/adaptive-icon.png
Normal file
BIN
assets/adaptive-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
assets/favicon.png
Normal file
BIN
assets/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
assets/icon.png
Normal file
BIN
assets/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
assets/splash-icon.png
Normal file
BIN
assets/splash-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
8
index.ts
Normal file
8
index.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { registerRootComponent } from 'expo';
|
||||||
|
|
||||||
|
import App from './App';
|
||||||
|
|
||||||
|
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
|
||||||
|
// It also ensures that whether you load the app in Expo Go or in a native build,
|
||||||
|
// the environment is set up appropriately
|
||||||
|
registerRootComponent(App);
|
||||||
9145
package-lock.json
generated
Normal file
9145
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
27
package.json
Normal file
27
package.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "feladat4-dashboard",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.ts",
|
||||||
|
"scripts": {
|
||||||
|
"start": "expo start",
|
||||||
|
"android": "expo start --android",
|
||||||
|
"ios": "expo start --ios",
|
||||||
|
"web": "expo start --web"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@react-navigation/bottom-tabs": "^7.14.0",
|
||||||
|
"@react-navigation/native": "^7.1.28",
|
||||||
|
"expo": "~54.0.33",
|
||||||
|
"expo-status-bar": "~3.0.9",
|
||||||
|
"react": "19.1.0",
|
||||||
|
"react-native": "0.81.5",
|
||||||
|
"react-native-gesture-handler": "~2.28.0",
|
||||||
|
"react-native-safe-area-context": "~5.6.0",
|
||||||
|
"react-native-screens": "~4.16.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/react": "~19.1.0",
|
||||||
|
"typescript": "~5.9.2"
|
||||||
|
},
|
||||||
|
"private": true
|
||||||
|
}
|
||||||
34
screens/PostsScreen.tsx
Normal file
34
screens/PostsScreen.tsx
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { View, Text, FlatList, StyleSheet } from 'react-native';
|
||||||
|
import { apiService } from '../services/api';
|
||||||
|
|
||||||
|
export default function PostsScreen({ filter }: { filter: string }) {
|
||||||
|
const [posts, setPosts] = useState([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
apiService.getPosts().then(setPosts);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const filtered = posts.filter((p: any) => p.title.toLowerCase().includes(filter.toLowerCase()));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={styles.container}>
|
||||||
|
<FlatList
|
||||||
|
data={filtered}
|
||||||
|
keyExtractor={(item: any) => item.id.toString()}
|
||||||
|
renderItem={({ item }: any) => (
|
||||||
|
<View style={styles.item}>
|
||||||
|
<Text style={styles.title}>{item.title}</Text>
|
||||||
|
<Text>{item.body}</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: { flex: 1, padding: 16 },
|
||||||
|
item: { padding: 16, borderBottomWidth: 1 },
|
||||||
|
title: { fontWeight: 'bold' },
|
||||||
|
});
|
||||||
32
screens/TodosScreen.tsx
Normal file
32
screens/TodosScreen.tsx
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { View, Text, FlatList, StyleSheet } from 'react-native';
|
||||||
|
import { apiService } from '../services/api';
|
||||||
|
|
||||||
|
export default function TodosScreen({ filter }: { filter: string }) {
|
||||||
|
const [todos, setTodos] = useState([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
apiService.getTodos().then(setTodos);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const filtered = todos.filter((t: any) => t.title.toLowerCase().includes(filter.toLowerCase()));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={styles.container}>
|
||||||
|
<FlatList
|
||||||
|
data={filtered}
|
||||||
|
keyExtractor={(item: any) => item.id.toString()}
|
||||||
|
renderItem={({ item }: any) => (
|
||||||
|
<View style={styles.item}>
|
||||||
|
<Text>{item.completed ? '✅' : '⬜'} {item.title}</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: { flex: 1, padding: 16 },
|
||||||
|
item: { padding: 16, borderBottomWidth: 1 },
|
||||||
|
});
|
||||||
34
screens/UsersScreen.tsx
Normal file
34
screens/UsersScreen.tsx
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { View, Text, FlatList, StyleSheet } from 'react-native';
|
||||||
|
import { apiService } from '../services/api';
|
||||||
|
|
||||||
|
export default function UsersScreen({ filter }: { filter: string }) {
|
||||||
|
const [users, setUsers] = useState([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
apiService.getUsers().then(setUsers);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const filtered = users.filter((u: any) => u.name.toLowerCase().includes(filter.toLowerCase()));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={styles.container}>
|
||||||
|
<FlatList
|
||||||
|
data={filtered}
|
||||||
|
keyExtractor={(item: any) => item.id.toString()}
|
||||||
|
renderItem={({ item }: any) => (
|
||||||
|
<View style={styles.item}>
|
||||||
|
<Text style={styles.name}>{item.name}</Text>
|
||||||
|
<Text>{item.email}</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: { flex: 1, padding: 16 },
|
||||||
|
item: { padding: 16, borderBottomWidth: 1 },
|
||||||
|
name: { fontWeight: 'bold' },
|
||||||
|
});
|
||||||
14
services/api.ts
Normal file
14
services/api.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
export const apiService = {
|
||||||
|
getUsers: async () => {
|
||||||
|
const res = await fetch('https://jsonplaceholder.typicode.com/users');
|
||||||
|
return res.json();
|
||||||
|
},
|
||||||
|
getPosts: async () => {
|
||||||
|
const res = await fetch('https://jsonplaceholder.typicode.com/posts');
|
||||||
|
return res.json();
|
||||||
|
},
|
||||||
|
getTodos: async () => {
|
||||||
|
const res = await fetch('https://jsonplaceholder.typicode.com/todos');
|
||||||
|
return res.json();
|
||||||
|
},
|
||||||
|
};
|
||||||
6
tsconfig.json
Normal file
6
tsconfig.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"extends": "expo/tsconfig.base",
|
||||||
|
"compilerOptions": {
|
||||||
|
"strict": true
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user