From 9c8da8d8ed2cca04419090a3af2eda9ab5be66f7 Mon Sep 17 00:00:00 2001 From: Korbs Date: Wed, 7 Jun 2023 20:26:41 -0400 Subject: [PATCH] Add settings (Not functional yet) --- App.js | 73 ++++++++++++++++++++++++++++++++++++++++---- LICENSE | 0 stylesheets/style.js | 54 ++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 6 deletions(-) mode change 100644 => 100755 LICENSE mode change 100644 => 100755 stylesheets/style.js diff --git a/App.js b/App.js index d93ac70..0ccccfe 100755 --- a/App.js +++ b/App.js @@ -1,9 +1,11 @@ // Import Stuff /// React Native import * as React from 'react' -import { Text } from 'react-native' +import { useState } from "react"; +import { Alert, AsyncStorage, Text, TextInput, UseState, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' import { WebView } from 'react-native-webview' +import Modal from "react-native-modal"; /// React Native Navigation import { NavigationContainer } from '@react-navigation/native' @@ -22,11 +24,41 @@ import Styles from './stylesheets/style' SystemUI.setBackgroundColorAsync("black") const Tab = createMaterialTopTabNavigator() +let InstanceURL = 'https://design.penpot.app/' + +_storeData = async () => { + try { + await AsyncStorage.setItem( + 'I like to save it.', + ); + } catch (error) { + // Error saving data + } +}; + +_retrieveData = async () => { + try { + const value = await AsyncStorage.getItem('TASKS'); + if (value !== null) { + // We have data!! + console.log(value); + } + } catch (error) { + // Error retrieving data + } +}; + // App export default function App() { + const [isModalVisible, setModalVisible] = useState(false); + + const ToggleSettingModal = () => { + setModalVisible(!isModalVisible); + }; + const [tabs, setTabs] = React.useState([ { - name : "tab-1", + name : "1", component : TabScreen, } ]) @@ -34,7 +66,7 @@ export default function App() { setTabs(tabs => [ ...tabs, { - name : "tab-" + (parseInt(tabs.pop().name.replace("tab-", "")) + 1), + name : "" + (parseInt(tabs.pop().name.replace("", "")) + 1), component : TabScreen, } ]) @@ -45,12 +77,13 @@ export default function App() { 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' }} + onError={() => Alert.alert("Something went wrong", "The page you are trying to load has either crashed or there is no connection. Please check your Instance setting to make sure the URL is correct.", [{text: 'OK'}])} + source={{ uri: InstanceURL }} javaScriptEnabled={true} javaScriptEnabledAndroid={true} - scalesPageToFit={false} // Too big if set to true + scalesPageToFit={false} allowsBackForwardNavigationGestures + style={{backgroundColor: '#202020'}} /> ) @@ -80,6 +113,34 @@ export default function App() { style={Styles.AddButton} onPress={addNewTab} >+ + Settings + + + + Instance + SetInstance(e.target.value)} + placeholder="https://design.penpot.app/" + aria-label="InstanceURL" + /> + + Cancel + + + + + ) } diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/stylesheets/style.js b/stylesheets/style.js old mode 100644 new mode 100755 index 3242c03..f03a87a --- a/stylesheets/style.js +++ b/stylesheets/style.js @@ -35,6 +35,60 @@ export default StyleSheet.create({ marginTop: 4, marginRight: 80 }, + SettingButton: { + position: 'absolute', + color: 'white', + backgroundColor: '#202020', + right: 42, + height: 36, + width: 92, + fontSize: 14, + display: 'flex', + textAlign: 'center', + textAlignVertical: "center", + borderRadius: 50, + marginTop: 6, + marginRight: 12 + }, + Settings: { + position: 'absolute', + backgroundColor: 'white', + top: 0, + right: 0, + height: 140, + width: 350, + fontSize: 14, + display: 'flex', + borderRadius: 10, + padding: 12 + }, + InstanceForm: { + backgroundColor: 'lightgray', + color: 'black', + borderRadius: 4, + paddingHorizontal: 12, + paddingVertical: 6, + marginTop: 6 + }, + InstanceCancel: { + backgroundColor: '#EEE', + color: 'black', + borderRadius: 4, + marginTop: 12, + marginRight: 12, + paddingHorizontal: 24, + paddingVertical: 10, + alignSelf: 'flex-end' + }, + InstanceSubmit: { + backgroundColor: '#31efb8', + color: 'black', + borderRadius: 4, + marginTop: 12, + paddingHorizontal: 24, + paddingVertical: 6, + alignSelf: 'flex-end' + }, Tab: { display: 'flex', backgroundColor: 'black'