diff options
Diffstat (limited to 'src/view/com/util')
-rw-r--r-- | src/view/com/util/ViewSelector.tsx | 2 | ||||
-rw-r--r-- | src/view/com/util/forms/Button.tsx | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/view/com/util/ViewSelector.tsx b/src/view/com/util/ViewSelector.tsx index 705178a8a..e2f47ba89 100644 --- a/src/view/com/util/ViewSelector.tsx +++ b/src/view/com/util/ViewSelector.tsx @@ -59,7 +59,7 @@ export const ViewSelector = React.forwardRef< // events // = - const keyExtractor = React.useCallback(item => item._reactKey, []) + const keyExtractor = React.useCallback((item: any) => item._reactKey, []) const onPressSelection = React.useCallback( (index: number) => setSelectedIndex(clamp(index, 0, sections.length)), diff --git a/src/view/com/util/forms/Button.tsx b/src/view/com/util/forms/Button.tsx index 6a5f19f99..8049d2243 100644 --- a/src/view/com/util/forms/Button.tsx +++ b/src/view/com/util/forms/Button.tsx @@ -6,6 +6,7 @@ import { TextStyle, Pressable, ViewStyle, + PressableStateCallbackType, } from 'react-native' import {Text} from '../text/Text' import {useTheme} from 'lib/ThemeContext' @@ -26,6 +27,14 @@ export type ButtonType = | 'secondary-light' | 'default-light' +// Augment type for react-native-web (see https://github.com/necolas/react-native-web/issues/1684#issuecomment-766451866) +declare module 'react-native' { + interface PressableStateCallbackType { + hovered?: boolean + focused?: boolean + } +} + // TODO: Enforce that button always has a label export function Button({ type = 'primary', @@ -139,7 +148,7 @@ export function Button({ ) const getStyle = React.useCallback( - state => { + (state: PressableStateCallbackType) => { const arr = [typeOuterStyle, styles.outer, style] if (state.pressed) { arr.push({opacity: 0.6}) |