From 78db05c92c08d9d3202efc1d4de6bdc88765b5c0 Mon Sep 17 00:00:00 2001 From: desperado1802 Date: Wed, 18 Oct 2023 18:50:19 +0300 Subject: [PATCH] disabled the input so users can't change active task when timer is running --- .../TimerScreen/components/TimerTaskSection.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/mobile/app/screens/Authenticated/TimerScreen/components/TimerTaskSection.tsx b/apps/mobile/app/screens/Authenticated/TimerScreen/components/TimerTaskSection.tsx index 53dd96c09..0046281d3 100644 --- a/apps/mobile/app/screens/Authenticated/TimerScreen/components/TimerTaskSection.tsx +++ b/apps/mobile/app/screens/Authenticated/TimerScreen/components/TimerTaskSection.tsx @@ -27,6 +27,7 @@ import TaskSize from "../../../../components/TaskSize" import { RTuseTaskInput } from "../../../../services/hooks/features/useTaskInput" import TaskLabels from "../../../../components/TaskLabels" import IssuesModal from "../../../../components/IssuesModal" +import { useStores } from "../../../../models" const TimerTaskSection = observer( ({ taskInput, outsideClick }: { taskInput: RTuseTaskInput; outsideClick: () => unknown }) => { @@ -44,6 +45,9 @@ const TimerTaskSection = observer( const [combxShow, setCombxShow] = useState(false) const inputRef = useRef(null) + const { + TimerStore: { localTimerStatus }, + } = useStores() const closeCombox = useCallback(() => { setCombxShow(false) @@ -88,14 +92,19 @@ const TimerTaskSection = observer( placeholderTextColor={colors.tertiary} style={[ styles.textInput, - { backgroundColor: colors.background, color: colors.primary, width: "80%" }, + { + backgroundColor: colors.background, + color: colors.primary, + width: "80%", + opacity: localTimerStatus.running ? 0.5 : 1, + }, ]} placeholder={translate("myWorkScreen.taskFieldPlaceholder")} defaultValue={activeTask ? activeTask.title : ""} autoFocus={false} autoCapitalize="none" autoCorrect={false} - editable={true} + editable={!localTimerStatus.running} onFocus={() => setEditMode(true)} // onBlur={() => setEditMode(false)} onChangeText={(newText) => setQuery(newText)}