diff --git a/src/Screens/Device/deviceTabButton.js b/src/Screens/Device/deviceTabButton.js index 659acac..4628ecb 100644 --- a/src/Screens/Device/deviceTabButton.js +++ b/src/Screens/Device/deviceTabButton.js @@ -1,17 +1,9 @@ import { useContext } from "react"; -import { AppContext } from "../../utils"; -import { TouchableHighlight, TouchableOpacity } from "react-native"; +import { AppContext, AppStyles } from "../../utils"; +import { TouchableHighlight, TouchableOpacity, View } from "react-native"; import MyIcon from "../../Components/Icon"; -const spaceToSide = 10; // left and right -const top = 35; -const spaceBetweenButtons = 60; - -export const topFirst = top; -export const topSecond = top + spaceBetweenButtons; -export const topThird = top + 2 * spaceBetweenButtons; - -export const MyDeviceTabButton = ({ top, iconName, iconColor, onPress }) => { +export function MyDeviceTabButton({ iconName, iconColor, onPress }) { const appContext = useContext(AppContext); const TouchComponent = @@ -23,15 +15,31 @@ export const MyDeviceTabButton = ({ top, iconName, iconColor, onPress }) => { ); -}; +} + +export function MyDeviceTabButtonContainer({ children }) { + return ( + + {children} + + ); +} diff --git a/src/Screens/Device/index.js b/src/Screens/Device/index.js index 75845a9..10f0cc6 100644 --- a/src/Screens/Device/index.js +++ b/src/Screens/Device/index.js @@ -1,13 +1,11 @@ import { useContext, useState } from "react"; -import { Image, ScrollView, StyleSheet, View, Text, Alert } from "react-native"; -import { AppContext } from "../../utils"; +import { Image, View, Text, Alert } from "react-native"; +import { AppContext, AppStyles } from "../../utils"; import SettingsView from "./settings"; import SceneView from "./scene"; import { MyDeviceTabButton, - topFirst, - topSecond, - topThird, + MyDeviceTabButtonContainer, } from "./deviceTabButton"; export default function DeviceScreen({ navigation }) { @@ -38,44 +36,33 @@ export default function DeviceScreen({ navigation }) { backgroundColor: appContext.appTheme.backgroundColor, }} > - {appContext.isUserDeveloperModeEnabled ? ( - - ) : ( - <> - {selectedView !== 4 && ( - - )} - - )} + - setSelectedView(0)} - /> - { - console.log("rotate"); - Alert.alert("Rotate device", "Soon the device will turn 180 degrees"); - }} - /> - setSelectedView(2)} - /> + + setSelectedView(0)} + /> + + Alert.alert( + "Rotate device", + "Soon the device will turn 180 degrees" + ) + } + /> + setSelectedView(2)} + /> + @@ -84,19 +71,28 @@ export default function DeviceScreen({ navigation }) { ); } -const styles = StyleSheet.create({ - container: { - flex: 1, - alignItems: "center", - justifyContent: "center", - backgroundColor: "#2e2e30", - }, - scrollView: { - width: "100%", - padding: 20, - }, - image: { - width: "100%", - height: 250, - }, -}); +export function DeviceLivePreview() { + const appContext = useContext(AppContext); + + return ( + <> + {appContext.isUserDeveloperModeEnabled ? ( + + ) : ( + + )} + + ); +} diff --git a/src/Screens/Device/modals/EditActions/Lights/index.js b/src/Screens/Device/modals/EditActions/Lights/index.js index d81ceef..3fe321e 100644 --- a/src/Screens/Device/modals/EditActions/Lights/index.js +++ b/src/Screens/Device/modals/EditActions/Lights/index.js @@ -1,6 +1,5 @@ import { FlatList, - Image, ScrollView, Text, TouchableOpacity, @@ -8,18 +7,14 @@ import { } from "react-native"; import { MyDeviceTabButton, + MyDeviceTabButtonContainer, topFirst, topSecond, } from "../../../deviceTabButton"; import Card from "../../../../../Components/Card"; import MyDropdown from "../../../../../Components/Dropdown"; import { useCallback, useContext, useEffect, useRef, useState } from "react"; -import { - AppContext, - AppStyles, - GetUuid, - ModalContainer, -} from "../../../../../utils"; +import { AppContext, AppStyles, ModalContainer } from "../../../../../utils"; import { MyDotsModal, MyPickerModalListItem, @@ -36,6 +31,7 @@ import EditActionAnimationsCardContent, { } from ".."; import { useTranslation } from "react-i18next"; import { useFocusEffect } from "@react-navigation/native"; +import { DeviceLivePreview } from "../../.."; function LightModeDefaultColor({ sharedColor, @@ -180,12 +176,6 @@ export function LightsEditActionModalContent({ navigation, route }) { (a) => a.actionId === selectedSceneAction.actionId ); - console.log( - "foundSceneActionIndex", - foundSceneActionIndex, - newArr[foundSceneActionIndex] - ); - if (foundSceneActionIndex !== -1) { newArr[foundSceneActionIndex].modeAdjustments.colors = sharedLightModeDefaultColors.value; @@ -204,29 +194,18 @@ export function LightsEditActionModalContent({ navigation, route }) { height: "100%", }} > - {appContext.isUserDeveloperModeEnabled ? ( - - ) : ( - - )} + - - + + console.log("pressed")} + /> + console.log("pressed2")} + /> + diff --git a/src/Screens/Device/scene.js b/src/Screens/Device/scene.js index f1b6982..06bc279 100644 --- a/src/Screens/Device/scene.js +++ b/src/Screens/Device/scene.js @@ -113,9 +113,9 @@ export default function SceneView({ navigation }) { (a) => a.sceneId === device.selectedScene ); - const DropdownCard = (style) => { + const DropdownCard = () => { return ( - + @@ -131,7 +131,6 @@ export default function SceneView({ navigation }) { return ( <> - {console.log("actions", appContext.deviceSceneActions)} {device.selectedScene === "" ? ( <> @@ -159,7 +158,11 @@ export default function SceneView({ navigation }) { }) } keyExtractor={(item) => item.actionId} - ListHeaderComponent={} + ListHeaderComponent={ + + + + } ListEmptyComponent={