From 3d4ff59f40fa802403df3c9df691657148e3814d Mon Sep 17 00:00:00 2001 From: zsviczian Date: Sun, 12 Nov 2023 13:24:13 +0100 Subject: [PATCH] fix: Can't toggle penMode off due to missing typecheck in togglePenMode (#7273) Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com> --- src/components/App.tsx | 2 +- src/components/LayerUI.tsx | 4 ++-- src/components/MobileMenu.tsx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index 56dc795f..8e4ab635 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -2716,7 +2716,7 @@ class App extends React.Component { }); }; - togglePenMode = (force?: boolean) => { + togglePenMode = (force: boolean | null) => { this.setState((prevState) => { return { penMode: force ?? !prevState.penMode, diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsx index 8b909da2..5c092fea 100644 --- a/src/components/LayerUI.tsx +++ b/src/components/LayerUI.tsx @@ -66,7 +66,7 @@ interface LayerUIProps { elements: readonly NonDeletedExcalidrawElement[]; onLockToggle: () => void; onHandToolToggle: () => void; - onPenModeToggle: () => void; + onPenModeToggle: AppClassProperties["togglePenMode"]; showExitZenModeBtn: boolean; langCode: Language["code"]; renderTopRightUI?: ExcalidrawProps["renderTopRightUI"]; @@ -258,7 +258,7 @@ const LayerUI = ({ onPenModeToggle(null)} title={t("toolBar.penMode")} penDetected={appState.penDetected} /> diff --git a/src/components/MobileMenu.tsx b/src/components/MobileMenu.tsx index bb26fe71..4299bf84 100644 --- a/src/components/MobileMenu.tsx +++ b/src/components/MobileMenu.tsx @@ -35,7 +35,7 @@ type MobileMenuProps = { elements: readonly NonDeletedExcalidrawElement[]; onLockToggle: () => void; onHandToolToggle: () => void; - onPenModeToggle: () => void; + onPenModeToggle: AppClassProperties["togglePenMode"]; renderTopRightUI?: ( isMobile: boolean, @@ -94,7 +94,7 @@ export const MobileMenu = ({ )} onPenModeToggle(null)} title={t("toolBar.penMode")} isMobile penDetected={appState.penDetected}