diff --git a/locales/de.json b/locales/de.json index bd26c04..857c065 100644 --- a/locales/de.json +++ b/locales/de.json @@ -17,6 +17,8 @@ "settingsTitle": "Einstellungen", "wifiStandByTitle": "WLAN im Standby", "wifiStandByDescription": "Die WLAN-Verbindung bleibt bestehen, auch wenn das Gerät ausgeschaltet ist. Bitte beachten Sie, dass dies zu einem erhöhten Stromverbrauch führen kann.", + "deviceAutoBrightnessTitle": "Automatische Helligkeit", + "deviceAutoBrightnessDescription": "Die Helligkeit des Geräts wird automatisch an die Umgebung angepasst.", "deviceInformationText": "Geräteinformationen", "deviceNameText": "Gerätename", "deviceModelText": "Gerätemodell", diff --git a/locales/en.json b/locales/en.json index 815cdb9..114c2a8 100644 --- a/locales/en.json +++ b/locales/en.json @@ -17,6 +17,8 @@ "settingsTitle": "Settings", "wifiStandByTitle": "WLAN in standby", "wifiStandByDescription": "The WLAN connection remains established even if the device is switched off. Please note that this can lead to increased power consumption.", + "deviceAutoBrightnessTitle": "Automatic brightness", + "deviceAutoBrightnessDescription": "The brightness of the device is automatically adjusted to the ambient light.", "deviceInformationText": "Device information", "deviceNameText": "Device name", "deviceModelText": "Device model", diff --git a/src/Components/Slider/index.js b/src/Components/Slider/index.js index ed4e23b..b576b02 100644 --- a/src/Components/Slider/index.js +++ b/src/Components/Slider/index.js @@ -1,8 +1,9 @@ //import Slider from "@react-native-community/slider"; -import { useContext } from "react"; +import { Children, cloneElement, useContext, useState } from "react"; import { AppContext } from "../../utils"; import { Slider } from "@miblanchard/react-native-slider"; -import { View } from "react-native"; +import { Text, View } from "react-native"; +import MyIcon from "../Icon"; export default function MySlider({ style, @@ -55,3 +56,76 @@ export default function MySlider({ ); } + +export function MyTwoThumbsSlider({ + sliderValue, + appContext, + unitOfMeasurement, + iconName, +}) { + const [value, setValue] = useState(sliderValue); + + const children = ( + + ); + + const renderChildren = () => { + return Children.map(children, (child) => { + if (!!child && child.type === Slider) { + return cloneElement(child, { + onValueChange: setValue, + //renderTrackMarkComponent, + //trackMarks, + value, + }); + } + + return child; + }); + }; + + return ( + + + + {renderChildren()} + + + + {Array.isArray(value) ? value.join(" - ") : value} + {unitOfMeasurement} + + + + + ); +} + +/* +const trackMarkStyles = StyleSheet.create({ + activeMark: { + borderColor: "red", + borderWidth, + left: -borderWidth / 2, + }, + inactiveMark: { + borderColor: "grey", + borderWidth, + left: -borderWidth / 2, + }, +}); +*/ diff --git a/src/Screens/Device/settings.js b/src/Screens/Device/settings.js index 5007312..f491cc6 100644 --- a/src/Screens/Device/settings.js +++ b/src/Screens/Device/settings.js @@ -14,6 +14,12 @@ import { useTranslation } from "react-i18next"; import MySwitch from "../../Components/Switch"; import MyButton, { MyIconButton } from "../../Components/Button"; import { MyBottomSheetModal } from "../../Components/Modal"; +import { Slider } from "@miblanchard/react-native-slider"; +import { + MySliderContainer, + MyTwoThumbsSlider, + SliderContainer, +} from "../../Components/Slider"; export default function SettingsView({ navigation }) { const appContext = useContext(AppContext); @@ -111,6 +117,22 @@ export default function SettingsView({ navigation }) { onValueChange={(e) => setSwitchState(e)} /> + + + + + +