tangled
alpha
login
or
join now
stream.place
/
streamplace
Live video on the AT Protocol
74
fork
atom
overview
issues
1
pulls
pipelines
replace touch-to-show-ui with hover-to-show-ui
Natalie B.
6 months ago
1db88e5c
88fcc5eb
+10
-12
1 changed file
expand all
collapse all
unified
split
js
app
components
mobile
desktop-ui.tsx
+10
-12
js/app/components/mobile/desktop-ui.tsx
···
6
6
Toast,
7
7
useAvatars,
8
8
useCameraToggle,
9
9
-
useKeyboardSlide,
10
9
useLivestreamInfo,
11
10
usePlayerDimensions,
12
11
usePlayerStore,
···
23
22
VolumeX,
24
23
} from "lucide-react-native";
25
24
import { useCallback, useEffect, useRef, useState } from "react";
26
26
-
import {
27
27
-
Image,
28
28
-
Platform,
29
29
-
Pressable,
30
30
-
TouchableWithoutFeedback,
31
31
-
} from "react-native";
25
25
+
import { Image, Platform, Pressable } from "react-native";
26
26
+
import { Gesture, GestureDetector } from "react-native-gesture-handler";
32
27
import Animated, {
28
28
+
runOnJS,
33
29
useAnimatedStyle,
34
30
useSharedValue,
35
31
withTiming,
···
147
143
const { width, height } = usePlayerDimensions();
148
144
const { doSetIngestCamera } = useCameraToggle();
149
145
const avatars = useAvatars(profile?.did ? [profile?.did] : []);
150
150
-
const { slideKeyboard } = useKeyboardSlide();
151
146
const { safeAreaInsets, shouldShowFloatingMetrics } = useResponsiveLayout();
152
147
153
148
const fullscreen = usePlayerStore((state) => state.fullscreen);
···
157
152
const [isChatOpen, setIsChatOpen] = useState(false);
158
153
const fadeOpacity = useSharedValue(1);
159
154
const fadeTimeout = useRef<NodeJS.Timeout | null>(null);
160
160
-
const FADE_OUT_DELAY = 4000;
155
155
+
const FADE_OUT_DELAY = 2500;
161
156
162
157
const isSelfAndNotLive = ingest === "new";
163
158
const isActivelyLive = ingest !== null && ingest !== "new";
···
173
168
}, FADE_OUT_DELAY);
174
169
}, [fadeOpacity]);
175
170
176
176
-
const onPressPlayer = useCallback(() => {
171
171
+
const onPlayerHover = useCallback(() => {
172
172
+
console.log("player hovered");
177
173
resetFadeTimer();
178
174
}, [resetFadeTimer]);
179
175
···
196
192
opacity: shouldShowFloatingMetrics ? 1 : fadeOpacity.value,
197
193
}));
198
194
195
195
+
const hover = Gesture.Hover().onStart((_) => runOnJS(onPlayerHover)());
196
196
+
199
197
return (
200
200
-
<TouchableWithoutFeedback onPress={onPressPlayer}>
198
198
+
<GestureDetector gesture={hover}>
201
199
<View style={[layout.position.absolute, h.percent[100], w.percent[100]]}>
202
200
<Animated.View
203
201
style={[
···
378
376
duration={5}
379
377
/>
380
378
</View>
381
381
-
</TouchableWithoutFeedback>
379
379
+
</GestureDetector>
382
380
);
383
381
}