commit 44bfc55a4b7dc871cbedfa0bf8776be0bd0a49a4 Author: a Date: Fri May 31 16:19:51 2024 +0200 first commit diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 0000000..848943b --- /dev/null +++ b/.bundle/config @@ -0,0 +1,2 @@ +BUNDLE_PATH: "vendor/bundle" +BUNDLE_FORCE_RUBY_PLATFORM: 1 diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..187894b --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: '@react-native', +}; diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5ae456 --- /dev/null +++ b/.gitignore @@ -0,0 +1,74 @@ +# OSX +# +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +**/.xcode.env.local + +# Android/IntelliJ +# +build/ +.idea +.gradle +local.properties +*.iml +*.hprof +.cxx/ +*.keystore +!debug.keystore + +# node.js +# +node_modules/ +npm-debug.log +yarn-error.log + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/ + +**/fastlane/report.xml +**/fastlane/Preview.html +**/fastlane/screenshots +**/fastlane/test_output + +# Bundle artifact +*.jsbundle + +# Ruby / CocoaPods +**/Pods/ +/vendor/bundle/ + +# Temporary files created by Metro to check the health of the file watcher +.metro-health-check* + +# testing +/coverage + +# Yarn +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..2b54074 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,7 @@ +module.exports = { + arrowParens: 'avoid', + bracketSameLine: true, + bracketSpacing: false, + singleQuote: true, + trailingComma: 'all', +}; diff --git a/.watchmanconfig b/.watchmanconfig new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.watchmanconfig @@ -0,0 +1 @@ +{} diff --git a/App.js b/App.js new file mode 100644 index 0000000..ff3e580 --- /dev/null +++ b/App.js @@ -0,0 +1,92 @@ +/** + * Sample React Native App + * https://github.com/facebook/react-native + * + * @format + */ + +import React from "react"; +import { + SafeAreaView, + ScrollView, + StatusBar, + StyleSheet, + Text, + useColorScheme, + View, + Button, +} from "react-native"; + +import { useNetInfoInstance } from "@react-native-community/netinfo"; + +import { + useQuery, + useMutation, + useQueryClient, + QueryClient, + QueryClientProvider, +} from "@tanstack/react-query"; +import { PersistQueryClientProvider } from "@tanstack/react-query-persist-client"; +import { createAsyncStoragePersister } from "@tanstack/query-async-storage-persister"; +import AsyncStorage from "@react-native-async-storage/async-storage"; + +const queryClient = new QueryClient({ + defaultOptions: { + queries: { + gcTime: 1000 * 60 * 60 * 24, // 24 hours + }, + }, +}); + +const asyncStoragePersister = createAsyncStoragePersister({ + storage: AsyncStorage, +}); + + +// Define the "addTodo" mutation +queryClient.setMutationDefaults(["addTodo"], { + mutationFn: ({ page }) => { + return makeCall(page); + }, + retry: 3, +}); + + +function makeCall(page) { + return fetch(`http://10.0.2.2:8080/${page}`) + .then(response => { + return response; + }) + .catch(error => { + console.log(error); + console.log(12); + }); +} + +function App() { + return ( + + + + + + + + + ); +} + +const ReqButton = () => { + const mutation = useMutation({ mutationKey: ["addTodo"] }); + return ( +