/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
shared/common-adapters/loading-line.tsx
53 строки
1 KB
chrisnojima
refactor(styles): theme via hooks, no android remount (#29515)
08 авг 2026, 02:24
Не верифицирован
08 авг 2026, 02:24
a41d38e
Код
Авторство
О чём код?
import * as React from 'react' import * as Styles from '@/styles' import {Box2} from './box' import Animated, {withRepeat, useSharedValue, withTiming, useAnimatedStyle, withDelay} from './reanimated' import './loading-line.css' function LoadingLine() { 'use no memo' const styles = useStyles() const theme = Styles.useTheme() const opacity = useSharedValue(1) React.useEffect(() => { if (!isMobile) return opacity.set(withDelay(1000, withRepeat(withTiming(0, {duration: 600}), -1, true))) }, [opacity]) const backgroundColor = Styles.undynamicColor(theme.blue) const animatedStyle = useAnimatedStyle(() => { return { backgroundColor, opacity: opacity.value, } }) if (!isMobile) { return ( <Box2 direction="vertical" fullWidth={true} style={styles.container}> <Box2 direction="vertical" fullWidth={true} className="loading-line" style={styles.line} /> </Box2> ) } return <Animated.View style={[styles.nativeLine, animatedStyle]} /> } const useStyles = Styles.createStyleHook(theme => ({ container: { left: 0, position: 'absolute', top: 0, }, line: { backgroundColor: theme.blue, height: 1, }, nativeLine: { height: 1, position: 'absolute', width: '100%', }, })) export default LoadingLine