mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 16:53:25 +00:00
improve volume and brightness gestures
This commit is contained in:
@@ -1,19 +1,14 @@
|
||||
import { useMemo, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import { useSharedValue } from "react-native-reanimated";
|
||||
import { useDebounceValue } from "tamagui";
|
||||
|
||||
export const useVolume = () => {
|
||||
const [showVolumeOverlay, setShowVolumeOverlay] = useState(false);
|
||||
|
||||
const volume = useSharedValue(1);
|
||||
|
||||
const currentVolume = useDebounceValue(volume.value, 20);
|
||||
const memoizedVolume = useMemo(() => currentVolume, [currentVolume]);
|
||||
|
||||
return {
|
||||
showVolumeOverlay,
|
||||
setShowVolumeOverlay,
|
||||
volume,
|
||||
currentVolume: memoizedVolume,
|
||||
} as const;
|
||||
};
|
||||
|
Reference in New Issue
Block a user