mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 18:13:25 +00:00
improve volume and brightness gestures
This commit is contained in:
@@ -1,19 +1,12 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useSharedValue } from "react-native-reanimated";
|
||||
import * as Brightness from "expo-brightness";
|
||||
import { useDebounceValue } from "tamagui";
|
||||
|
||||
export const useBrightness = () => {
|
||||
const [showBrightnessOverlay, setShowBrightnessOverlay] = useState(false);
|
||||
|
||||
const brightness = useSharedValue(0.5);
|
||||
|
||||
const currentBrightness = useDebounceValue(brightness.value, 20);
|
||||
const memoizedBrightness = useMemo(
|
||||
() => currentBrightness,
|
||||
[currentBrightness],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
async function init() {
|
||||
try {
|
||||
@@ -42,7 +35,6 @@ export const useBrightness = () => {
|
||||
showBrightnessOverlay,
|
||||
setShowBrightnessOverlay,
|
||||
brightness,
|
||||
currentBrightness: memoizedBrightness,
|
||||
handleBrightnessChange,
|
||||
} as const;
|
||||
};
|
||||
|
Reference in New Issue
Block a user