auto select first color
parent
b3b3fa75bf
commit
3dd7afec41
7
App.js
7
App.js
|
@ -33,10 +33,7 @@ import {
|
||||||
SettingsAppLanguageModalContent,
|
SettingsAppLanguageModalContent,
|
||||||
} from "./src/Screens/Settings";
|
} from "./src/Screens/Settings";
|
||||||
import { SettingsChangeDeviceDisplayName } from "./src/Screens/Device/settings";
|
import { SettingsChangeDeviceDisplayName } from "./src/Screens/Device/settings";
|
||||||
import {
|
import { EditActionAnimationSelectionModalContent } from "./src/Screens/Device/modals/EditActions";
|
||||||
EditActionAnimationSelectionModalContent,
|
|
||||||
EditActionAnimationsSelectionModalContent,
|
|
||||||
} from "./src/Screens/Device/modals/EditActions";
|
|
||||||
|
|
||||||
const Drawer = createDrawerNavigator();
|
const Drawer = createDrawerNavigator();
|
||||||
const Stack = createStackNavigator();
|
const Stack = createStackNavigator();
|
||||||
|
@ -256,7 +253,7 @@ export function MyApp() {
|
||||||
options({
|
options({
|
||||||
navigation: navigation,
|
navigation: navigation,
|
||||||
pageTitle: t(
|
pageTitle: t(
|
||||||
"screens.device.modalSettingsChangeDeviceDisplayName.pageTitle"
|
"screens.device.settings.modalSettingsChangeDeviceDisplayName.pageTitle"
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
View,
|
View,
|
||||||
Text,
|
Text,
|
||||||
KeyboardAvoidingView,
|
KeyboardAvoidingView,
|
||||||
|
Alert,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import { AppContext } from "../../utils";
|
import { AppContext } from "../../utils";
|
||||||
import SettingsView from "./settings";
|
import SettingsView from "./settings";
|
||||||
|
@ -71,7 +72,10 @@ export default function DeviceScreen({ navigation }) {
|
||||||
selectedViewNumber={1}
|
selectedViewNumber={1}
|
||||||
top={topSecond}
|
top={topSecond}
|
||||||
iconColor={getIconColor(1)}
|
iconColor={getIconColor(1)}
|
||||||
onPress={() => setSelectedView(1)}
|
onPress={() => {
|
||||||
|
console.log("rotate");
|
||||||
|
Alert.alert("Rotate device", "Soon the device will turn 180 degrees");
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<MyDeviceTabButton
|
<MyDeviceTabButton
|
||||||
iconName={"group"}
|
iconName={"group"}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
} from "../../../deviceTabButton";
|
} from "../../../deviceTabButton";
|
||||||
import Card from "../../../../../Components/Card";
|
import Card from "../../../../../Components/Card";
|
||||||
import MyDropdown from "../../../../../Components/Dropdown";
|
import MyDropdown from "../../../../../Components/Dropdown";
|
||||||
import { useContext, useEffect, useRef, useState } from "react";
|
import { useCallback, useContext, useEffect, useRef, useState } from "react";
|
||||||
import { AppContext, AppStyles, ModalContainer } from "../../../../../utils";
|
import { AppContext, AppStyles, ModalContainer } from "../../../../../utils";
|
||||||
import { MyPickerModalListItem } from "../../../../../Components/Modal";
|
import { MyPickerModalListItem } from "../../../../../Components/Modal";
|
||||||
import { MyColorPickerV2 } from "../../../../../Components/ColorPicker";
|
import { MyColorPickerV2 } from "../../../../../Components/ColorPicker";
|
||||||
|
@ -28,6 +28,7 @@ import EditActionAnimationsCardContent, {
|
||||||
EditActionAdjustmentContent,
|
EditActionAdjustmentContent,
|
||||||
} from "..";
|
} from "..";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useFocusEffect } from "@react-navigation/native";
|
||||||
|
|
||||||
function LightModeDefaultColor({
|
function LightModeDefaultColor({
|
||||||
sharedColor,
|
sharedColor,
|
||||||
|
@ -74,7 +75,7 @@ export function LightsEditActionModalContent({ navigation, route }) {
|
||||||
const [lightModeDefaultColors, setLightModeDefaultColors] = useState([]);
|
const [lightModeDefaultColors, setLightModeDefaultColors] = useState([]);
|
||||||
const sharedLightModeDefaultColors = useSharedValue([]);
|
const sharedLightModeDefaultColors = useSharedValue([]);
|
||||||
const [selectedDefaultLightModeColor, setSelectedDefaultLightModeColor] =
|
const [selectedDefaultLightModeColor, setSelectedDefaultLightModeColor] =
|
||||||
useState();
|
useState(0);
|
||||||
const colorPickerRef = useRef(ColorPickerRef);
|
const colorPickerRef = useRef(ColorPickerRef);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
@ -93,11 +94,17 @@ export function LightsEditActionModalContent({ navigation, route }) {
|
||||||
(s) => s.id === selectedSceneActionModeId
|
(s) => s.id === selectedSceneActionModeId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (colorPickerRef.current && selectedLightMode.defaults.length > 0) {
|
||||||
|
colorPickerRef.current.setColor(selectedLightMode.defaults[0]);
|
||||||
|
}
|
||||||
|
}, [lightModeDefaultColors]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (selectedLightMode !== undefined) {
|
if (selectedLightMode !== undefined) {
|
||||||
sharedLightModeDefaultColors.value = selectedLightMode.defaults;
|
sharedLightModeDefaultColors.value = selectedLightMode.defaults;
|
||||||
setLightModeDefaultColors(selectedLightMode.defaults);
|
setLightModeDefaultColors(selectedLightMode.defaults);
|
||||||
setSelectedDefaultLightModeColor();
|
setSelectedDefaultLightModeColor(0);
|
||||||
}
|
}
|
||||||
}, [selectedSceneActionModeId]);
|
}, [selectedSceneActionModeId]);
|
||||||
|
|
||||||
|
@ -169,7 +176,11 @@ export function LightsEditActionModalContent({ navigation, route }) {
|
||||||
<Text
|
<Text
|
||||||
style={[
|
style={[
|
||||||
AppStyles.typography14,
|
AppStyles.typography14,
|
||||||
{ marginTop: 4, marginBottom: 4 },
|
{
|
||||||
|
marginTop: 4,
|
||||||
|
marginBottom: 4,
|
||||||
|
color: appContext.appTheme.text,
|
||||||
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{t(
|
{t(
|
||||||
|
@ -192,7 +203,7 @@ export function LightsEditActionModalContent({ navigation, route }) {
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
key={index}
|
key={index}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
const newSelection =
|
/*const newSelection =
|
||||||
selectedDefaultLightModeColor !== index
|
selectedDefaultLightModeColor !== index
|
||||||
? index
|
? index
|
||||||
: undefined;
|
: undefined;
|
||||||
|
@ -203,7 +214,13 @@ export function LightsEditActionModalContent({ navigation, route }) {
|
||||||
colorPickerRef.current.setColor(
|
colorPickerRef.current.setColor(
|
||||||
sharedLightModeDefaultColors.value[index]
|
sharedLightModeDefaultColors.value[index]
|
||||||
);
|
);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
setSelectedDefaultLightModeColor(index);
|
||||||
|
|
||||||
|
colorPickerRef.current.setColor(
|
||||||
|
sharedLightModeDefaultColors.value[index]
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<LightModeDefaultColor
|
<LightModeDefaultColor
|
||||||
|
|
|
@ -40,7 +40,7 @@ export default function EditActionAnimationsCardContent({
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Card>
|
<Card>
|
||||||
<Text style={[AppStyles.typography14, { fontWeight: "bold" }]}>
|
<Text style={[AppStyles.typography14, { fontWeight: "bold", color: appContext.appTheme.text }]}>
|
||||||
{t(
|
{t(
|
||||||
"screens.device.scenes.editActionAnimationsCardContent.animationsIn"
|
"screens.device.scenes.editActionAnimationsCardContent.animationsIn"
|
||||||
)}
|
)}
|
||||||
|
@ -75,7 +75,7 @@ export default function EditActionAnimationsCardContent({
|
||||||
))}
|
))}
|
||||||
|
|
||||||
<Text
|
<Text
|
||||||
style={[AppStyles.typography14, { fontWeight: "bold", marginTop: 6 }]}
|
style={[AppStyles.typography14, { fontWeight: "bold", marginTop: 6, color: appContext.appTheme.text }]}
|
||||||
>
|
>
|
||||||
{t(
|
{t(
|
||||||
"screens.device.scenes.editActionAnimationsCardContent.animationsOut"
|
"screens.device.scenes.editActionAnimationsCardContent.animationsOut"
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
import { FlatList, Text, TouchableOpacity, View } from "react-native";
|
import { FlatList, Text, TouchableOpacity, View } from "react-native";
|
||||||
import Card from "../../Components/Card";
|
import Card from "../../Components/Card";
|
||||||
import {
|
import { AppContext, Constants, GetDevice } from "../../utils";
|
||||||
AppContext,
|
|
||||||
AppSelectedUserDevice,
|
|
||||||
Constants,
|
|
||||||
GetDevice,
|
|
||||||
GetDeviceScene,
|
|
||||||
GetDeviceScenes,
|
|
||||||
} from "../../utils";
|
|
||||||
import { useCallback, useContext, useState } from "react";
|
import { useCallback, useContext, useState } from "react";
|
||||||
import MyDropdown from "../../Components/Dropdown";
|
import MyDropdown from "../../Components/Dropdown";
|
||||||
import MyIcon from "../../Components/Icon";
|
import MyIcon from "../../Components/Icon";
|
||||||
|
|
|
@ -208,7 +208,7 @@ const devDevicesFirmwareModes = {
|
||||||
de: "Zufällig",
|
de: "Zufällig",
|
||||||
en: "Random",
|
en: "Random",
|
||||||
},
|
},
|
||||||
defaults: ["red", "orange", "blue"],
|
defaults: ["pink", "orange", "blue"],
|
||||||
adjustments: [
|
adjustments: [
|
||||||
{
|
{
|
||||||
type: "slider",
|
type: "slider",
|
||||||
|
|
Loading…
Reference in New Issue