From 41f829ef3f25289cbb4e904d119744f5cfc7e6c1 Mon Sep 17 00:00:00 2001 From: Korbs Date: Sun, 4 Jun 2023 20:40:57 -0400 Subject: [PATCH] Init --- .gitignore | 3 ++ App.js | 106 +++++++++++++++++++++++++++++++++++++++ README.md | 14 ++++++ app.json | 42 ++++++++++++++++ assets/adaptive-icon.png | Bin 0 -> 32476 bytes assets/favicon.png | Bin 0 -> 956 bytes assets/icon.png | Bin 0 -> 32476 bytes assets/splash.png | Bin 0 -> 33525 bytes babel.config.js | 6 +++ eas.json | 18 +++++++ package.json | 28 +++++++++++ 11 files changed, 217 insertions(+) create mode 100644 .gitignore create mode 100755 App.js create mode 100755 app.json create mode 100644 assets/adaptive-icon.png create mode 100644 assets/favicon.png create mode 100644 assets/icon.png create mode 100644 assets/splash.png create mode 100755 babel.config.js create mode 100644 eas.json create mode 100755 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cf8765e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +yarn.lock +node_modules/ \ No newline at end of file diff --git a/App.js b/App.js new file mode 100755 index 0000000..b3f74c8 --- /dev/null +++ b/App.js @@ -0,0 +1,106 @@ +import * as React from 'react'; +import { Button, StyleSheet, Text, View } from 'react-native'; +import { NavigationContainer } from '@react-navigation/native'; +import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs'; +import { SafeAreaView } from 'react-native-safe-area-context'; +import { WebView } from 'react-native-webview' +import { StatusBar } from 'expo-status-bar'; + +const Tab = createMaterialTopTabNavigator(); + + +export default function App() { + + + const [tabs, setTabs] = React.useState([ + { + name : "tab-1", + component : TabScreen, + } + ]) + + + const addNewTab = () => { + setTabs(tabs => [ + ...tabs, + { + name : "tab-" + (parseInt(tabs.pop().name.replace("tab-", "")) + 1), + component : TabScreen, + } + ]) + } + + + const remove = (route) => { + setTabs(tabs => tabs.filter(tab => tab.name !== route.name)) + } + + + function TabScreen({route}) { + return ( + + Alert.alert("Page failed to load", "The page you're trying to view has failed to load. Either caused by a connection error or the a server-side issue.", [{text: 'OK'}])} + source={{ uri: 'https://design.penpot.app' }} + javaScriptEnabled={true} + javaScriptEnabledAndroid={true} + onMessage={(event) => {}} + scalesPageToFit={false} + allowsBackForwardNavigationGestures + /> + + { + route.name !== "tab-1" && remove(route)}>close me + } + + ); + } + + const S = StyleSheet.create({ + container: { + flex: 1, + position: 'relative' + }, + AddButton: { + position: 'absolute', + bottom: 0, + right: 0, + left: 0, + height: 100, + borderWidth: 2, + borderColor: 'blue', + backgroundColor: 'white', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + } + }) + + return ( + + + { + tabs.map(tab => , + headerRight: () => ( +