Skip to content

Instantly share code, notes, and snippets.

@tbxark
Created January 4, 2025 15:38
Show Gist options
  • Select an option

  • Save tbxark/72ca37472c989fa2b1888f822aedb20d to your computer and use it in GitHub Desktop.

Select an option

Save tbxark/72ca37472c989fa2b1888f822aedb20d to your computer and use it in GitHub Desktop.
Define the properties of a custom button
import type { ComponentProps } from 'react';
interface CustomButtonProps {
onPress: ComponentProps<typeof TouchableOpacity>["onPress"];
title: string;
}
const CustomButton = ({ onPress, title }: CustomButtonProps) => (
<TouchableOpacity
onPress={onPress}
style={{
backgroundColor: '#009688',
padding: 10,
borderRadius: 10,
elevation: 1,
}}>
<Text style={{
color: '#ffffff',
fontSize: 18,
textAlign: 'center',
}}>
{title}
</Text>
</TouchableOpacity>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment