Skip to content

Commit

Permalink
Adjust Touchable opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
robertying committed Mar 5, 2023
1 parent 0f978f8 commit 8e7d970
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/components/CardWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ const CardWrapper: React.FC<
]}
dragEnabled={!selectionMode && dragEnabled}>
<Touchable
type="highlight"
highlightColorOpacity={0.125}
style={{backgroundColor: theme.colors.surface}}
onPress={
selectionMode
Expand Down
11 changes: 8 additions & 3 deletions src/components/Touchable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import {
import {TouchableRipple, useTheme} from 'react-native-paper';

const Touchable: React.FC<
TouchableHighlightProps & {type?: 'opacity' | 'highlight'}
> = ({type, ...props}) => {
TouchableHighlightProps & {
type?: 'opacity' | 'highlight';
highlightColorOpacity?: number;
}
> = ({type, highlightColorOpacity, ...props}) => {
const theme = useTheme();

return Platform.OS === 'android' ? (
Expand All @@ -19,7 +22,9 @@ const Touchable: React.FC<
<TouchableHighlight
activeOpacity={1}
underlayColor={
theme.dark ? 'rgba(255,255,255,0.125)' : 'rgba(0,0,0,0.125)'
theme.dark
? `rgba(255,255,255,${highlightColorOpacity ?? 0.2})`
: 'rgba(0,0,0,0.125)'
}
{...props}
/>
Expand Down

0 comments on commit 8e7d970

Please sign in to comment.