40 lines
914 B
TypeScript
40 lines
914 B
TypeScript
import Ionicons from '@expo/vector-icons/Ionicons';
|
|
import React from 'react';
|
|
import {
|
|
StyleProp,
|
|
StyleSheet,
|
|
TouchableOpacity,
|
|
TouchableOpacityProps,
|
|
ViewStyle,
|
|
} from 'react-native';
|
|
|
|
type BackButtonProps = {
|
|
onPress: () => void;
|
|
style?: StyleProp<ViewStyle>;
|
|
} & Omit<TouchableOpacityProps, 'style' | 'onPress'>;
|
|
|
|
export function BackButton({ onPress, style, accessibilityLabel = 'Go back', ...rest }: BackButtonProps) {
|
|
return (
|
|
<TouchableOpacity
|
|
{...rest}
|
|
accessibilityRole="button"
|
|
accessibilityLabel={accessibilityLabel}
|
|
onPress={onPress}
|
|
style={[styles.shell, style]}
|
|
>
|
|
<Ionicons name="chevron-back" size={22} color="#FFFFFF" />
|
|
</TouchableOpacity>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
shell: {
|
|
width: 48,
|
|
height: 48,
|
|
borderRadius: 18,
|
|
borderWidth: 1,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
},
|
|
});
|