diff options
author | Jaz <ericvolp12@gmail.com> | 2023-05-17 21:19:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-17 21:19:20 -0700 |
commit | 7f76c2d67e62ba2d10e8b17673a7bbcf7248564f (patch) | |
tree | ece7f72b04ee4bb39d4118b0b520683deddaa972 /src/view/com/util/forms/Button.tsx | |
parent | ac3a95dc7228ad3d1d1cb7c5e7e26968009173bb (diff) | |
parent | 0ca096138a690f036828c49f9e95cf394b1a4339 (diff) | |
download | voidsky-7f76c2d67e62ba2d10e8b17673a7bbcf7248564f.tar.zst |
Merge branch 'main' into inherit_system_theme
Diffstat (limited to 'src/view/com/util/forms/Button.tsx')
-rw-r--r-- | src/view/com/util/forms/Button.tsx | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/view/com/util/forms/Button.tsx b/src/view/com/util/forms/Button.tsx index a8f1f363f..6a5f19f99 100644 --- a/src/view/com/util/forms/Button.tsx +++ b/src/view/com/util/forms/Button.tsx @@ -128,6 +128,7 @@ export function Button({ }, }, ) + const onPressWrapped = React.useCallback( (event: Event) => { event.stopPropagation() @@ -136,9 +137,23 @@ export function Button({ }, [onPress], ) + + const getStyle = React.useCallback( + state => { + const arr = [typeOuterStyle, styles.outer, style] + if (state.pressed) { + arr.push({opacity: 0.6}) + } else if (state.hovered) { + arr.push({opacity: 0.8}) + } + return arr + }, + [typeOuterStyle, style], + ) + return ( <Pressable - style={[typeOuterStyle, styles.outer, style]} + style={getStyle} onPress={onPressWrapped} testID={testID} accessibilityRole="button" |