diff options
Diffstat (limited to 'src/view/com/util')
-rw-r--r-- | src/view/com/util/EmptyState.tsx | 10 | ||||
-rw-r--r-- | src/view/com/util/LoadingPlaceholder.tsx | 2 | ||||
-rw-r--r-- | src/view/com/util/PostCtrls.tsx | 18 | ||||
-rw-r--r-- | src/view/com/util/ViewHeader.tsx | 11 | ||||
-rw-r--r-- | src/view/com/util/error/ErrorMessage.tsx | 11 | ||||
-rw-r--r-- | src/view/com/util/error/ErrorScreen.tsx | 11 | ||||
-rw-r--r-- | src/view/com/util/forms/DropdownButton.tsx | 2 | ||||
-rw-r--r-- | src/view/com/util/images/AutoSizedImage.tsx | 3 | ||||
-rw-r--r-- | src/view/com/util/images/ImageLayoutGrid.tsx | 22 |
9 files changed, 64 insertions, 26 deletions
diff --git a/src/view/com/util/EmptyState.tsx b/src/view/com/util/EmptyState.tsx index 6218027d2..6c5c3f342 100644 --- a/src/view/com/util/EmptyState.tsx +++ b/src/view/com/util/EmptyState.tsx @@ -1,7 +1,10 @@ import React from 'react' import {StyleProp, StyleSheet, View, ViewStyle} from 'react-native' import {IconProp} from '@fortawesome/fontawesome-svg-core' -import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import { + FontAwesomeIcon, + FontAwesomeIconStyle, +} from '@fortawesome/react-native-fontawesome' import {Text} from './text/Text' import {UserGroupIcon} from '../../lib/icons' import {usePalette} from '../../lib/hooks/usePalette' @@ -25,7 +28,10 @@ export function EmptyState({ <FontAwesomeIcon icon={icon} size={64} - style={[styles.icon, {color: pal.colors.emptyStateIcon}]} + style={[ + styles.icon, + {color: pal.colors.emptyStateIcon} as FontAwesomeIconStyle, + ]} /> )} </View> diff --git a/src/view/com/util/LoadingPlaceholder.tsx b/src/view/com/util/LoadingPlaceholder.tsx index 9828058e8..9bb200d50 100644 --- a/src/view/com/util/LoadingPlaceholder.tsx +++ b/src/view/com/util/LoadingPlaceholder.tsx @@ -63,7 +63,7 @@ export function PostLoadingPlaceholder({ </View> <View style={s.flex1}> <HeartIcon - style={{color: theme.palette.default.icon}} + style={{color: theme.palette.default.icon} as ViewStyle} size={17} strokeWidth={1.7} /> diff --git a/src/view/com/util/PostCtrls.tsx b/src/view/com/util/PostCtrls.tsx index bde44abab..fca70b687 100644 --- a/src/view/com/util/PostCtrls.tsx +++ b/src/view/com/util/PostCtrls.tsx @@ -7,7 +7,10 @@ import { View, ViewStyle, } from 'react-native' -import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import { + FontAwesomeIcon, + FontAwesomeIconStyle, +} from '@fortawesome/react-native-fontawesome' import ReactNativeHapticFeedback from 'react-native-haptic-feedback' import {Text} from './text/Text' import {PostDropdownBtn} from './forms/DropdownButton' @@ -147,7 +150,9 @@ export function PostCtrls(opts: PostCtrlsOpts) { <Animated.View style={anim1Style}> <RepostIcon style={ - opts.isReposted ? styles.ctrlIconReposted : defaultCtrlColor + (opts.isReposted + ? styles.ctrlIconReposted + : defaultCtrlColor) as ViewStyle } strokeWidth={2.4} size={opts.big ? 24 : 20} @@ -173,12 +178,15 @@ export function PostCtrls(opts: PostCtrlsOpts) { <Animated.View style={anim2Style}> {opts.isUpvoted ? ( <HeartIconSolid - style={[styles.ctrlIconUpvoted]} + style={styles.ctrlIconUpvoted as ViewStyle} size={opts.big ? 22 : 16} /> ) : ( <HeartIcon - style={[defaultCtrlColor, opts.big ? styles.mt1 : undefined]} + style={[ + defaultCtrlColor as ViewStyle, + opts.big ? styles.mt1 : undefined, + ]} strokeWidth={3} size={opts.big ? 20 : 16} /> @@ -214,7 +222,7 @@ export function PostCtrls(opts: PostCtrlsOpts) { { color: theme.colorScheme === 'light' ? colors.gray4 : colors.gray5, - }, + } as FontAwesomeIconStyle, ]} /> </PostDropdownBtn> diff --git a/src/view/com/util/ViewHeader.tsx b/src/view/com/util/ViewHeader.tsx index c8b1b2d97..472db7ee0 100644 --- a/src/view/com/util/ViewHeader.tsx +++ b/src/view/com/util/ViewHeader.tsx @@ -6,7 +6,10 @@ import { TouchableOpacity, View, } from 'react-native' -import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import { + FontAwesomeIcon, + FontAwesomeIconStyle, +} from '@fortawesome/react-native-fontawesome' import {UserAvatar} from './UserAvatar' import {Text} from './text/Text' import {MagnifyingGlassIcon} from '../../lib/icons' @@ -92,7 +95,11 @@ export const ViewHeader = observer(function ViewHeader({ <ActivityIndicator /> ) : ( <> - <FontAwesomeIcon icon="signal" style={pal.text} size={16} /> + <FontAwesomeIcon + icon="signal" + style={pal.text as FontAwesomeIconStyle} + size={16} + /> <FontAwesomeIcon icon="x" style={[ diff --git a/src/view/com/util/error/ErrorMessage.tsx b/src/view/com/util/error/ErrorMessage.tsx index 684e93fca..a6d77326e 100644 --- a/src/view/com/util/error/ErrorMessage.tsx +++ b/src/view/com/util/error/ErrorMessage.tsx @@ -6,7 +6,10 @@ import { View, ViewStyle, } from 'react-native' -import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import { + FontAwesomeIcon, + FontAwesomeIconStyle, +} from '@fortawesome/react-native-fontawesome' import {Text} from '../text/Text' import {useTheme} from '../../../lib/ThemeContext' import {usePalette} from '../../../lib/hooks/usePalette' @@ -28,7 +31,11 @@ export function ErrorMessage({ <View testID="errorMessageView" style={[styles.outer, pal.view, style]}> <View style={[styles.errorIcon, {backgroundColor: theme.palette.error.icon}]}> - <FontAwesomeIcon icon="exclamation" style={pal.text} size={16} /> + <FontAwesomeIcon + icon="exclamation" + style={pal.text as FontAwesomeIconStyle} + size={16} + /> </View> <Text type="sm" diff --git a/src/view/com/util/error/ErrorScreen.tsx b/src/view/com/util/error/ErrorScreen.tsx index 0500b206d..f316dbcc6 100644 --- a/src/view/com/util/error/ErrorScreen.tsx +++ b/src/view/com/util/error/ErrorScreen.tsx @@ -1,6 +1,9 @@ import React from 'react' import {StyleSheet, TouchableOpacity, View} from 'react-native' -import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import { + FontAwesomeIcon, + FontAwesomeIconStyle, +} from '@fortawesome/react-native-fontawesome' import {Text} from '../text/Text' import {colors} from '../../../lib/styles' import {useTheme} from '../../../lib/ThemeContext' @@ -58,7 +61,11 @@ export function ErrorScreen({ testID="errorScreenTryAgainButton" style={[styles.btn, {backgroundColor: theme.palette.error.icon}]} onPress={onPressTryAgain}> - <FontAwesomeIcon icon="arrows-rotate" style={pal.text} size={16} /> + <FontAwesomeIcon + icon="arrows-rotate" + style={pal.text as FontAwesomeIconStyle} + size={16} + /> <Text type="button" style={[styles.btnText, pal.text]}> Try again </Text> diff --git a/src/view/com/util/forms/DropdownButton.tsx b/src/view/com/util/forms/DropdownButton.tsx index 33387f894..1fa03f4c7 100644 --- a/src/view/com/util/forms/DropdownButton.tsx +++ b/src/view/com/util/forms/DropdownButton.tsx @@ -37,7 +37,7 @@ export function DropdownButton({ menuWidth, children, }: { - type: DropdownButtonType + type?: DropdownButtonType style?: StyleProp<ViewStyle> items: DropdownItem[] label?: string diff --git a/src/view/com/util/images/AutoSizedImage.tsx b/src/view/com/util/images/AutoSizedImage.tsx index cedd3bc90..cdefc7123 100644 --- a/src/view/com/util/images/AutoSizedImage.tsx +++ b/src/view/com/util/images/AutoSizedImage.tsx @@ -30,6 +30,7 @@ export function AutoSizedImage({ }: { uri: string onPress?: () => void + onLongPress?: () => void style?: StyleProp<ImageStyle> containerStyle?: StyleProp<ViewStyle> }) { @@ -68,7 +69,7 @@ export function AutoSizedImage({ }) } - let calculatedStyle: StyleProp<ViewStyle> | undefined + let calculatedStyle: StyleProp<ImageStyle> | undefined if (imgInfo && containerInfo) { // imgInfo.height / imgInfo.width = x / containerInfo.width // x = imgInfo.height / imgInfo.width * containerInfo.width diff --git a/src/view/com/util/images/ImageLayoutGrid.tsx b/src/view/com/util/images/ImageLayoutGrid.tsx index dd0ea3775..97ad9d700 100644 --- a/src/view/com/util/images/ImageLayoutGrid.tsx +++ b/src/view/com/util/images/ImageLayoutGrid.tsx @@ -13,7 +13,7 @@ import {DELAY_PRESS_IN} from './constants' interface Dim { width: number - height: numberPressIn + height: number } export type ImageLayoutGridType = 'two' | 'three' | 'four' @@ -28,6 +28,7 @@ export function ImageLayoutGrid({ type: ImageLayoutGridType uris: string[] onPress?: (index: number) => void + onLongPress?: (index: number) => void style?: StyleProp<ViewStyle> }) { const [containerInfo, setContainerInfo] = React.useState<Dim | undefined>() @@ -64,6 +65,7 @@ function ImageLayoutGridInner({ type: ImageLayoutGridType uris: string[] onPress?: (index: number) => void + onLongPress?: (index: number) => void containerInfo: Dim }) { const size1 = React.useMemo<ImageStyle>(() => { @@ -91,14 +93,14 @@ function ImageLayoutGridInner({ <TouchableOpacity delayPressIn={DELAY_PRESS_IN} onPress={() => onPress?.(0)} - onLongPress={() => onLongPress(0)}> + onLongPress={() => onLongPress?.(0)}> <Image source={{uri: uris[0]}} style={size1} /> </TouchableOpacity> <View style={styles.wSpace} /> <TouchableOpacity delayPressIn={DELAY_PRESS_IN} onPress={() => onPress?.(1)} - onLongPress={() => onLongPress(1)}> + onLongPress={() => onLongPress?.(1)}> <Image source={{uri: uris[1]}} style={size1} /> </TouchableOpacity> </View> @@ -110,7 +112,7 @@ function ImageLayoutGridInner({ <TouchableOpacity delayPressIn={DELAY_PRESS_IN} onPress={() => onPress?.(0)} - onLongPress={() => onLongPress(0)}> + onLongPress={() => onLongPress?.(0)}> <Image source={{uri: uris[0]}} style={size2} /> </TouchableOpacity> <View style={styles.wSpace} /> @@ -118,14 +120,14 @@ function ImageLayoutGridInner({ <TouchableOpacity delayPressIn={DELAY_PRESS_IN} onPress={() => onPress?.(1)} - onLongPress={() => onLongPress(1)}> + onLongPress={() => onLongPress?.(1)}> <Image source={{uri: uris[1]}} style={size1} /> </TouchableOpacity> <View style={styles.hSpace} /> <TouchableOpacity delayPressIn={DELAY_PRESS_IN} onPress={() => onPress?.(2)} - onLongPress={() => onLongPress(2)}> + onLongPress={() => onLongPress?.(2)}> <Image source={{uri: uris[2]}} style={size1} /> </TouchableOpacity> </View> @@ -139,14 +141,14 @@ function ImageLayoutGridInner({ <TouchableOpacity delayPressIn={DELAY_PRESS_IN} onPress={() => onPress?.(0)} - onLongPress={() => onLongPress(0)}> + onLongPress={() => onLongPress?.(0)}> <Image source={{uri: uris[0]}} style={size1} /> </TouchableOpacity> <View style={styles.hSpace} /> <TouchableOpacity delayPressIn={DELAY_PRESS_IN} onPress={() => onPress?.(1)} - onLongPress={() => onLongPress(1)}> + onLongPress={() => onLongPress?.(1)}> <Image source={{uri: uris[1]}} style={size1} /> </TouchableOpacity> </View> @@ -155,14 +157,14 @@ function ImageLayoutGridInner({ <TouchableOpacity delayPressIn={DELAY_PRESS_IN} onPress={() => onPress?.(2)} - onLongPress={() => onLongPress(2)}> + onLongPress={() => onLongPress?.(2)}> <Image source={{uri: uris[2]}} style={size1} /> </TouchableOpacity> <View style={styles.hSpace} /> <TouchableOpacity delayPressIn={DELAY_PRESS_IN} onPress={() => onPress?.(3)} - onLongPress={() => onLongPress(3)}> + onLongPress={() => onLongPress?.(3)}> <Image source={{uri: uris[3]}} style={size1} /> </TouchableOpacity> </View> |