From aca18970fae7fe0ceb7e43493acbe313253de684 Mon Sep 17 00:00:00 2001 From: Korbs Date: Mon, 5 Jun 2023 00:22:47 -0400 Subject: [PATCH] Organize files and add style to tabs --- App.js | 101 +++++++++++++++++------------------------- options/TabOptions.js | 42 ++++++++++++++++++ screens/Tab.js | 0 stylesheets/style.js | 42 ++++++++++++++++++ 4 files changed, 124 insertions(+), 61 deletions(-) create mode 100644 options/TabOptions.js create mode 100644 screens/Tab.js create mode 100644 stylesheets/style.js diff --git a/App.js b/App.js index b3f74c8..d93ac70 100755 --- a/App.js +++ b/App.js @@ -1,25 +1,35 @@ -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 Stuff +/// React Native +import * as React from 'react' +import { Text } from 'react-native' +import { SafeAreaView } from 'react-native-safe-area-context' import { WebView } from 'react-native-webview' -import { StatusBar } from 'expo-status-bar'; -const Tab = createMaterialTopTabNavigator(); +/// React Native Navigation +import { NavigationContainer } from '@react-navigation/native' +import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs' +/// Expo Modules +import * as SystemUI from 'expo-system-ui' +/// Options +import ScreenOptions from './options/TabOptions' + +/// Stylesheets +import Styles from './stylesheets/style' + +// Others +SystemUI.setBackgroundColorAsync("black") +const Tab = createMaterialTopTabNavigator() + +// App export default function App() { - - const [tabs, setTabs] = React.useState([ { name : "tab-1", component : TabScreen, } ]) - - const addNewTab = () => { setTabs(tabs => [ ...tabs, @@ -29,78 +39,47 @@ export default function App() { } ]) } - - - const remove = (route) => { - setTabs(tabs => tabs.filter(tab => tab.name !== route.name)) - } - + 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} + scalesPageToFit={false} // Too big if set to true 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: () => ( -