No visual feedback on FAB to reduce jank

zio/stable
Paul Frazee 2022-09-29 09:04:49 -05:00
parent cb5a575bc8
commit 16fbefc354
1 changed files with 22 additions and 15 deletions

View File

@ -1,5 +1,10 @@
import React from 'react' import React from 'react'
import {GestureResponderEvent, StyleSheet, TouchableOpacity} from 'react-native' import {
GestureResponderEvent,
StyleSheet,
TouchableWithoutFeedback,
View,
} from 'react-native'
import LinearGradient from 'react-native-linear-gradient' import LinearGradient from 'react-native-linear-gradient'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {IconProp} from '@fortawesome/fontawesome-svg-core' import {IconProp} from '@fortawesome/fontawesome-svg-core'
@ -9,20 +14,22 @@ import * as zIndex from '../../lib/z-index'
type OnPress = ((event: GestureResponderEvent) => void) | undefined type OnPress = ((event: GestureResponderEvent) => void) | undefined
export function FAB({icon, onPress}: {icon: IconProp; onPress: OnPress}) { export function FAB({icon, onPress}: {icon: IconProp; onPress: OnPress}) {
return ( return (
<TouchableOpacity style={styles.outer} onPress={onPress}> <TouchableWithoutFeedback onPress={onPress}>
<LinearGradient <View style={styles.outer}>
colors={[gradients.primary.start, gradients.primary.end]} <LinearGradient
start={{x: 0, y: 0}} colors={[gradients.primary.start, gradients.primary.end]}
end={{x: 1, y: 1}} start={{x: 0, y: 0}}
style={styles.inner}> end={{x: 1, y: 1}}
<FontAwesomeIcon style={styles.inner}>
size={24} <FontAwesomeIcon
icon={icon} size={24}
color={colors.white} icon={icon}
style={styles.icon} color={colors.white}
/> style={styles.icon}
</LinearGradient> />
</TouchableOpacity> </LinearGradient>
</View>
</TouchableWithoutFeedback>
) )
} }