android nav bar fixes + lower update speed
This commit is contained in:
@@ -3,7 +3,6 @@ import {
|
|||||||
LayoutAnimation,
|
LayoutAnimation,
|
||||||
ListRenderItem,
|
ListRenderItem,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
useWindowDimensions,
|
|
||||||
View,
|
View,
|
||||||
ViewToken,
|
ViewToken,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
@@ -21,7 +20,11 @@ import Animated, {
|
|||||||
useSharedValue,
|
useSharedValue,
|
||||||
withTiming,
|
withTiming,
|
||||||
} from 'react-native-reanimated'
|
} from 'react-native-reanimated'
|
||||||
import {SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context'
|
import {
|
||||||
|
SafeAreaView,
|
||||||
|
useSafeAreaFrame,
|
||||||
|
useSafeAreaInsets,
|
||||||
|
} from 'react-native-safe-area-context'
|
||||||
import {useEvent, useEventListener} from 'expo'
|
import {useEvent, useEventListener} from 'expo'
|
||||||
import {Image, ImageStyle} from 'expo-image'
|
import {Image, ImageStyle} from 'expo-image'
|
||||||
import {LinearGradient} from 'expo-linear-gradient'
|
import {LinearGradient} from 'expo-linear-gradient'
|
||||||
@@ -64,7 +67,8 @@ import {PostCtrls} from '#/view/com/util/post-ctrls/PostCtrls'
|
|||||||
import {formatTime} from '#/view/com/util/post-embeds/VideoEmbedInner/web-controls/utils'
|
import {formatTime} from '#/view/com/util/post-embeds/VideoEmbedInner/web-controls/utils'
|
||||||
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
||||||
import {Header} from '#/screens/VideoFeed/Header'
|
import {Header} from '#/screens/VideoFeed/Header'
|
||||||
import {atoms as a, ThemeProvider, tokens, useTheme} from '#/alf'
|
import {atoms as a, platform, ThemeProvider, tokens, useTheme} from '#/alf'
|
||||||
|
import {setNavigationBar} from '#/alf/util/navigationBar'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import * as Layout from '#/components/Layout'
|
import * as Layout from '#/components/Layout'
|
||||||
import {Link} from '#/components/Link'
|
import {Link} from '#/components/Link'
|
||||||
@@ -75,15 +79,21 @@ import {Text} from '#/components/Typography'
|
|||||||
function createThreeVideoPlayers(
|
function createThreeVideoPlayers(
|
||||||
sources?: [string, string, string],
|
sources?: [string, string, string],
|
||||||
): [VideoPlayer, VideoPlayer, VideoPlayer] {
|
): [VideoPlayer, VideoPlayer, VideoPlayer] {
|
||||||
|
// android is typically slower and can't keep up with a 0.1 interval
|
||||||
|
const eventInterval = platform({
|
||||||
|
ios: 0.2,
|
||||||
|
android: 0.5,
|
||||||
|
default: 0,
|
||||||
|
})
|
||||||
const p1 = createVideoPlayer(sources?.[0] ?? '')
|
const p1 = createVideoPlayer(sources?.[0] ?? '')
|
||||||
p1.loop = true
|
p1.loop = true
|
||||||
p1.timeUpdateEventInterval = 0.25
|
p1.timeUpdateEventInterval = eventInterval
|
||||||
const p2 = createVideoPlayer(sources?.[1] ?? '')
|
const p2 = createVideoPlayer(sources?.[1] ?? '')
|
||||||
p2.loop = true
|
p2.loop = true
|
||||||
p2.timeUpdateEventInterval = 0.25
|
p2.timeUpdateEventInterval = eventInterval
|
||||||
const p3 = createVideoPlayer(sources?.[2] ?? '')
|
const p3 = createVideoPlayer(sources?.[2] ?? '')
|
||||||
p3.loop = true
|
p3.loop = true
|
||||||
p3.timeUpdateEventInterval = 0.25
|
p3.timeUpdateEventInterval = eventInterval
|
||||||
return [p1, p2, p3]
|
return [p1, p2, p3]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,14 +104,17 @@ export function VideoFeed({}: NativeStackScreenProps<
|
|||||||
const {top} = useSafeAreaInsets()
|
const {top} = useSafeAreaInsets()
|
||||||
const {params} = useRoute<RouteProp<CommonNavigatorParams, 'VideoFeed'>>()
|
const {params} = useRoute<RouteProp<CommonNavigatorParams, 'VideoFeed'>>()
|
||||||
|
|
||||||
|
const t = useTheme()
|
||||||
const setMinShellMode = useSetMinimalShellMode()
|
const setMinShellMode = useSetMinimalShellMode()
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
setMinShellMode(true)
|
setMinShellMode(true)
|
||||||
|
setNavigationBar('lightbox', t)
|
||||||
return () => {
|
return () => {
|
||||||
setMinShellMode(false)
|
setMinShellMode(false)
|
||||||
|
setNavigationBar('theme', t)
|
||||||
}
|
}
|
||||||
}, [setMinShellMode]),
|
}, [setMinShellMode, t]),
|
||||||
)
|
)
|
||||||
|
|
||||||
useSetLightStatusBar(true)
|
useSetLightStatusBar(true)
|
||||||
@@ -366,7 +379,7 @@ function VideoItem({
|
|||||||
scrollGesture: NativeGesture
|
scrollGesture: NativeGesture
|
||||||
}) {
|
}) {
|
||||||
const postShadow = usePostShadow(post)
|
const postShadow = usePostShadow(post)
|
||||||
const {height, width} = useWindowDimensions()
|
const {width, height} = useSafeAreaFrame()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[a.relative, {height, width}]}>
|
<View style={[a.relative, {height, width}]}>
|
||||||
@@ -593,7 +606,7 @@ function ScrubberPlaceholder() {
|
|||||||
a.w_full,
|
a.w_full,
|
||||||
{
|
{
|
||||||
// same as Scrubber
|
// same as Scrubber
|
||||||
height: bottom + tokens.space.md + tokens.space.md + tokens.space.lg,
|
height: bottom + tokens.space.xl,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
@@ -607,7 +620,7 @@ function Scrubber({
|
|||||||
player: VideoPlayer
|
player: VideoPlayer
|
||||||
seekingAnimationSV: SharedValue<number>
|
seekingAnimationSV: SharedValue<number>
|
||||||
}) {
|
}) {
|
||||||
const {width: screenWidth} = useWindowDimensions()
|
const {width: screenWidth} = useSafeAreaFrame()
|
||||||
const insets = useSafeAreaInsets()
|
const insets = useSafeAreaInsets()
|
||||||
const currentTimeSV = useSharedValue(0)
|
const currentTimeSV = useSharedValue(0)
|
||||||
const durationSV = useSharedValue(0)
|
const durationSV = useSharedValue(0)
|
||||||
@@ -743,18 +756,14 @@ function Scrubber({
|
|||||||
style={[
|
style={[
|
||||||
a.relative,
|
a.relative,
|
||||||
a.w_full,
|
a.w_full,
|
||||||
a.pt_lg,
|
|
||||||
a.justify_end,
|
a.justify_end,
|
||||||
{
|
{
|
||||||
paddingBottom: insets.bottom + tokens.space.md,
|
paddingBottom: insets.bottom,
|
||||||
height:
|
height:
|
||||||
// bottom padding
|
// bottom padding
|
||||||
insets.bottom +
|
insets.bottom +
|
||||||
tokens.space.md +
|
|
||||||
// actual height
|
// actual height
|
||||||
tokens.space.md +
|
tokens.space.xl,
|
||||||
// top padding
|
|
||||||
tokens.space.lg,
|
|
||||||
},
|
},
|
||||||
a.z_10,
|
a.z_10,
|
||||||
]}>
|
]}>
|
||||||
@@ -772,7 +781,7 @@ function ExpandableRichTextView({
|
|||||||
value: RichTextAPI
|
value: RichTextAPI
|
||||||
authorHandle?: string
|
authorHandle?: string
|
||||||
}) {
|
}) {
|
||||||
const {height: screenHeight} = useWindowDimensions()
|
const {height: screenHeight} = useSafeAreaFrame()
|
||||||
const [expanded, setExpanded] = useState(false)
|
const [expanded, setExpanded] = useState(false)
|
||||||
const [constrained, setConstrained] = useState(false)
|
const [constrained, setConstrained] = useState(false)
|
||||||
const [contentHeight, setContentHeight] = useState(0)
|
const [contentHeight, setContentHeight] = useState(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user