From 2dcf043787a46e7acf473c686af7b56d37db885a Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 5 Jul 2022 11:06:32 +0100 Subject: [PATCH] Fix the PTT button on mobile We were using createRef() instead of useRef() in the hook, which meant we were always creating a new ref object and never actually getting the ref. This must have been working before the useEventTarget stuff due to some quirk of React / hooks... --- src/room/PTTButton.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/room/PTTButton.tsx b/src/room/PTTButton.tsx index 440b548..53f6f7b 100644 --- a/src/room/PTTButton.tsx +++ b/src/room/PTTButton.tsx @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import React, { useCallback, useState, createRef } from "react"; +import React, { useCallback, useState, useRef } from "react"; import classNames from "classnames"; import { useSpring, animated } from "@react-spring/web"; @@ -54,7 +54,7 @@ export const PTTButton: React.FC = ({ enqueueNetworkWaiting, setNetworkWaiting, }) => { - const buttonRef = createRef(); + const buttonRef = useRef(); const [activeTouchId, setActiveTouchId] = useState(null);