Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
tingyuan committed Apr 6, 2024
1 parent 073d70d commit 7e63846
Show file tree
Hide file tree
Showing 14 changed files with 162 additions and 58 deletions.
Binary file added assets/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/player.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/up-detail.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/up-list.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/video-list.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
158 changes: 123 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"devDependencies": {
"@babel/core": "^7.20.0",
"@react-native/eslint-config": "^0.74.0",
"@tingyuan/react-native-tailwindcss": "^0.0.16",
"@tingyuan/react-native-tailwindcss": "^0.0.18",
"@types/he": "^1.2.3",
"@types/react": "~18.2.14",
"@types/spark-md5": "^3.0.4",
Expand All @@ -91,6 +91,8 @@
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-sonarjs": "^0.24.0",
"open": "8.4.2",
"postcss": "^8.4.38",
"postcss-custom-properties": "^13.3.6",
"prettier": "^3.1.1",
"rimraf": "^5.0.5",
"semver": "^7.5.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Image2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function Image2(
>(null)

let style: ImageProps['style'] = React.useMemo(() => {
const imgStyle = StyleSheet.flatten(props.style)
const imgStyle = StyleSheet.flatten(props.style) || {}

if (sourceInfo) {
const aspectRatio =
Expand Down
4 changes: 2 additions & 2 deletions src/components/ImagesView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ function ImagesView() {
initWidth={96}
initHeight={96}
style={{ width: imgWidth, height: imgHeight }}
placeholder={require('../../assets/loading.png')}
placeholder={require('../../assets/loading.gif')}
/>
)
imageView = imageCompCache.current[v.url]
} else {
imageView = (
<Image
source={require('../../assets/loading.png')}
source={require('../../assets/loading.gif')}
className="w-24 h-24"
/>
)
Expand Down
9 changes: 7 additions & 2 deletions src/components/ReplyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ export default function ReplyList() {
isVisible={!!repliesInfo}>
<View className="h-[68vh] bg-neutral-100 dark:bg-neutral-700">
<View className="py-2 px-3 flex-row items-center border-gray-500 justify-between">
<Text className="text-lg font-semibold">
评论详情{typeof allCount === 'number' ? `(${allCount}条)` : ''}
<Text className="text-base font-semibold">
评论详情
{typeof allCount === 'number'
? `(${allCount}条)`
: isLoading
? '...'
: ''}
</Text>
<Icon
name="close"
Expand Down
4 changes: 2 additions & 2 deletions src/routes/Dynamic/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function HeaderLeft(props: { scrollTop: () => void }) {
})
}
}
const level = dynamicUser?.level ? 'ᴸⱽ' + levelList[dynamicUser.level] : ''
const level = dynamicUser?.level ? levelList[dynamicUser.level] : ''
const userName = dynamicUser?.name || '' // ? dynamicUser.name + level : ''
const sex =
dynamicUser?.sex === '男' ? '♂️' : dynamicUser?.sex === '女' ? '♀️' : ''
Expand Down Expand Up @@ -96,7 +96,7 @@ export function HeaderLeft(props: { scrollTop: () => void }) {
props.scrollTop()
}}>
{userName}
<Text className="text-sm">{level + ' '}</Text>
<Text className="text-lg">{level + ' '}</Text>
</Text>
{fans ? (
<Text
Expand Down
29 changes: 14 additions & 15 deletions src/routes/Play/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
useNavigation,
useRoute,
} from '@react-navigation/native'
import { Icon } from '@rneui/themed'
import * as KeepAwake from 'expo-keep-awake'
import React from 'react'
import {
Expand All @@ -19,14 +18,14 @@ import {
import WebView, { type WebViewMessageEvent } from 'react-native-webview'

import { usePlayUrl } from '@/api/play-url'
import Image2 from '@/components/Image2'
import { UA } from '@/constants'
import { colors } from '@/constants/colors.tw'
import { useMarkVideoWatched } from '@/store/actions'
import type { NavigationProps, RootStackParamList } from '@/types'

import { useVideoInfo } from '../../api/video-info'
import { useAppStateChange } from '../../hooks/useAppState'
import useMounted from '../../hooks/useMounted'
import { useStore } from '../../store'
import { parseDuration, parseImgUrl, showToast } from '../../utils'
import { INJECTED_JAVASCRIPT } from './inject-play'
Expand Down Expand Up @@ -95,11 +94,11 @@ function Player(props: { currentPage: number; currentCid?: number }) {
KeepAwake.deactivateKeepAwake('PLAY')
}
})
useMounted(() => {
if (!isWifi) {
showToast('注意流量')
}
})
// useMounted(() => {
// if (!isWifi) {
// showToast('注意流量')
// }
// })
const navigation = useNavigation<NavigationProps['navigation']>()

useFocusEffect(
Expand Down Expand Up @@ -271,16 +270,16 @@ function Player(props: { currentPage: number; currentCid?: number }) {
source={{ uri: parseImgUrl(videoInfo.cover, 500, 312) }}
resizeMode="cover"
className="flex-1 justify-center items-center">
<Icon
name="television-play"
type="material-community"
size={60}
color={'white'}
<Image2
source={require('../../../assets/play.png')}
className="w-20"
/>
<View className="absolute bottom-2 left-2 flex-row gap-2">
<Text className="rounded bg-gray-900/60 py-[2px] px-2 text-white font-bold">
{parseDuration(videoInfo?.duration)}
</Text>
{videoInfo?.duration ? (
<Text className="rounded bg-gray-900/60 py-[2px] px-2 text-white font-bold">
{parseDuration(videoInfo?.duration)}
</Text>
) : null}
<Text className="rounded bg-gray-900/60 py-[2px] px-2 text-white font-bold">
播放将消耗流量
</Text>
Expand Down
10 changes: 10 additions & 0 deletions src/routes/SearchVideos/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useBackHandler } from '@react-native-community/hooks'
import React from 'react'
import type { SearchBarCommands } from 'react-native-screens'

Expand All @@ -11,6 +12,15 @@ function SearchVideos() {
const searchBarRef = React.useRef<SearchBarCommands | null>(null)
const blackColor = tw(colors.black.text).color
const [searchKeyWord, setSearchKeyWord] = React.useState('')
useBackHandler(() => {
if (searchKeyWord) {
searchBarRef.current?.blur()
searchBarRef.current?.setText('')
setSearchKeyWord('')
return true
}
return false
})
useUpdateNavigationOptions(
React.useMemo(() => {
return {
Expand Down

0 comments on commit 7e63846

Please sign in to comment.