react-native-gesture-handler#RectButton TypeScript Examples
The following examples show how to use
react-native-gesture-handler#RectButton.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: styles.ts From GoBarber with MIT License | 6 votes |
Container = styled(RectButton)`
width: 100%;
height: 60px;
background: #ff9000;
border-radius: 10px;
margin-top: 8px;
justify-content: center;
align-items: center;
`
Example #2
Source File: index.tsx From nlw2-proffy with MIT License | 6 votes |
function GiveClasses() {
const {goBack} = useNavigation();
function handleNavigateBack() {
goBack();
}
return (
<View style={styles.container}>
<ImageBackground resizeMode="contain" source={giveClassesBgImage} style={styles.content}>
<Text style={styles.title}>
Quer ser um Proffy?
</Text>
<Text style={styles.description}>
Para começar, você precisa se cadastrar como um professor na nossa plataforma web.
</Text>
</ImageBackground>
<RectButton onPress={handleNavigateBack} style={styles.okButton}>
<Text style={styles.okButtonText}>Tudo bem</Text>
</RectButton>
</View>
);
}
Example #3
Source File: styles.ts From safetraceapi with GNU General Public License v3.0 | 6 votes |
OptionButtonContainer = styled(RectButton)<{
lastOption?: boolean;
}>`
background-color: #fdfdfd;
padding-vertical: 15px;
border-width: ${StyleSheet.hairlineWidth};
border-bottom-width: ${props => props.lastOption ? StyleSheet.hairlineWidth : 0}px;
border-color: #ededed;
`
Example #4
Source File: Ripple.tsx From mobile with Apache License 2.0 | 6 votes |
Ripple = ({
children,
disabled = false,
backgroundColor = 'transparent',
borderRadius = 4,
onPress,
...props
}: RippleProps & ViewProps) => {
return (
<RectButton
enabled={!disabled}
style={{
backgroundColor,
borderRadius,
}}
onPress={onPress}
rippleColor="rgb(200,200,200)"
activeOpacity={0.8}
>
<View accessible {...props}>
{children}
</View>
</RectButton>
);
}
Example #5
Source File: styles.ts From NextLevelWeek with MIT License | 6 votes |
CreateOtphanageButton = styled(RectButton)`
width: 56px;
height: 56px;
background: #15C3D6;
border-radius: 20px;
justify-content: center;
align-items: center;
`
Example #6
Source File: index.tsx From nlw-02-omnistack with MIT License | 6 votes |
function GiveClasses() {
const { goBack } = useNavigation();
function handleNavigateBack() {
goBack();
}
return (
<View style={styles.container}>
<ImageBackground
resizeMode="contain"
source={giveClassesBgImage}
style={styles.content}
>
<Text style={styles.title}>Quer ser um Proffy?</Text>
<Text style={styles.description}>
Para começar, você precisa se cadastrar como professor na nossa plataforma web.
</Text>
</ImageBackground>
<RectButton onPress={handleNavigateBack} style={styles.okButton}>
<Text style={styles.okButtonText}>Tudo bem</Text>
</RectButton>
</View>
);
}
Example #7
Source File: styles.ts From ecoleta with MIT License | 6 votes |
Button = styled(RectButton)`
background-color: #34cb79;
height: 60px;
flex-direction: row;
border-radius: 10px;
overflow: hidden;
align-items: center;
margin-top: 8px;
`
Example #8
Source File: styles.ts From gobarber-project with MIT License | 6 votes |
Container = styled(RectButton)`
width: ${Dimensions.get('window').width - 60}px;
height: 60px;
background: #ff9000;
border-radius: 10px;
margin-top: 8px;
justify-content: center;
align-items: center;
`
Example #9
Source File: styles.ts From GoBarber with MIT License | 6 votes |
Hour = styled(RectButton) <HourProps>`
padding: 12px;
background: ${(props) =>
props.selected && props.available ? '#ff9000' : '#3e3b47'};
border-radius: 10px;
margin-right: 8px;
opacity: ${(props) => (props.available ? 1 : 0.3)};
`
Example #10
Source File: App.tsx From react-native-gallery-toolkit with MIT License | 6 votes |
export function RoutesList({
routes,
}: {
routes: React.ComponentProps<typeof Stack.Screen>[];
}) {
const nav = useNavigation();
return (
<ScrollView>
{routes.map((route) => (
<RectButton
key={route.name}
onPress={() => nav.navigate(route.name)}
style={{
height: 64,
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'space-between',
padding: 16,
backgroundColor: 'white',
borderBottomColor: '#ccc',
borderBottomWidth: 1,
}}
>
<Text style={{ fontSize: 18 }}>{route.name}</Text>
<Text style={{ fontSize: 24, color: '#4D4D4D' }}>➡</Text>
</RectButton>
))}
</ScrollView>
);
}
Example #11
Source File: styles.ts From gobarber-mobile with MIT License | 6 votes |
Hour = styled(RectButton)<HourProps>`
padding: 12px;
background: ${({ theme, selected }) =>
selected ? theme.colors.orange : theme.colors.shape};
border-radius: 10px;
margin-right: 8px;
opacity: ${({ available }) => (available ? 1 : 0.3)};
`
Example #12
Source File: styles.ts From GoBarber with MIT License | 6 votes |
ProviderContainer = styled(RectButton) <ProviderContainerProps>`
background: ${(props) => (props.selected ? '#ff9000' : '#3e3b47')};
flex-direction: row;
padding: 8px 12px;
align-items: center;
margin-right: 16px;
border-radius: 10px;
`
Example #13
Source File: styles.ts From gobarber-mobile with MIT License | 6 votes |
Container = styled(RectButton)`
width: 100%;
height: 60px;
background: ${({ theme }) => theme.colors.orange};
border-radius: 10px;
margin-top: 8px;
justify-content: center;
align-items: center;
`
Example #14
Source File: styles.ts From GoBarber with MIT License | 5 votes |
CreateAppointmentButton = styled(RectButton)`
height: 50px;
background: #ff9000;
border-radius: 10px;
align-items: center;
justify-content: center;
margin: 0 24px 24px;
`
Example #15
Source File: index.tsx From nlw-ecoleta with MIT License | 5 votes |
Detail = () => {
const [data, setData] = useState<Data>({} as Data);
const navigation = useNavigation();
const route = useRoute();
const routeParams = route.params as Params;
useEffect(() => {
api.get(`points/${routeParams.point_id}`).then(response => {
setData(response.data);
});
}, []);
function handleNavigateBack() {
navigation.goBack();
}
function handleNavigateComposeMail() {
MailComposer.composeAsync({
subject: 'Interesse na coleta de resíduos',
recipients: [data.point.email],
})
}
function handleWhatsapp() {
Linking.openURL(`whatsapp://send?phone${data.point.whatsapp}$textTEnho interesse sobre coleta de resíduos`)
}
if(!data.point) {
return null;
}
return (
<SafeAreaView style={{ flex: 1 }}>
<View style={styles.container}>
<TouchableOpacity onPress={handleNavigateBack}>
<Icon name="arrow-left" size={20} color="#34cb79" />
</TouchableOpacity>
<Image style={styles.pointImage} source={{ uri: data.point.image_url }} />
<Text style={styles.pointName}>{data.point.name}</Text>
<Text style={styles.pointItems}>{data.items.map(item =>item.title).join(', ')}</Text>
<View style={styles.address}>
<Text style={styles.addressTitle}>Endereço</Text>
<Text style={styles.addressContent}>{data.point.city}, {data.point.uf}</Text>
</View>
</View>
<View style={styles.footer}>
<RectButton style={styles.button} onPress={handleWhatsapp}>
<FontAwesome name="whatsapp" size={20} color="#FFF" />
<Text style={styles.buttonText}>Whatsapp</Text>
</RectButton>
<RectButton style={styles.button} onPress={handleNavigateComposeMail}>
<Icon name="mail" size={20} color="#FFF" />
<Text style={styles.buttonText}>E-mail</Text>
</RectButton>
</View>
</SafeAreaView>
);
}
Example #16
Source File: styles.ts From GoBarber with MIT License | 5 votes |
OkButton = styled(RectButton)`
background: #ff9000;
justify-content: center;
align-items: center;
border-radius: 10px;
margin-top: 24px;
padding: 12px 24px;
`
Example #17
Source File: index.tsx From nlw-01-omnistack with MIT License | 5 votes |
Home = () => {
const [uf, setUf] = useState('');
const [city, setCity] = useState('');
const navigation = useNavigation();
function handleNavigateToPoints() {
navigation.navigate('Points', {
uf,
city,
});
}
return (
<KeyboardAvoidingView
style={{ flex: 1 }}
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
>
<ImageBackground
source={require('../../assets/home-background.png')}
style={styles.container}
imageStyle={{ width: 274, height: 368 }}
>
<View style={styles.main}>
<Image source={require('../../assets/logo.png')} />
<View>
<Text style={styles.title}>Seu marketplace de coleta de resíduos</Text>
<Text style={styles.description}>Ajudamos pessoas a encontrarem pontos de coleta de forma eficiente.</Text>
</View>
</View>
<View style={styles.footer}>
<TextInput
style={styles.input}
placeholder="Digite a UF"
value={uf}
maxLength={2}
autoCapitalize="characters"
autoCorrect={false}
onChangeText={setUf}
/>
<TextInput
style={styles.input}
placeholder="Digite a cidade"
value={city}
autoCorrect={false}
onChangeText={setCity}
/>
<RectButton style={styles.button} onPress={handleNavigateToPoints}>
<View style={styles.buttonIcon}>
<Text>
<Icon name="arrow-right" color="#FFF" size={24} />
</Text>
</View>
<Text style={styles.buttonText}>
Entrar
</Text>
</RectButton>
</View>
</ImageBackground>
</KeyboardAvoidingView>
);
}
Example #18
Source File: App.tsx From react-native-slack-bottom-sheet with MIT License | 5 votes |
function App({ setVisible, setComponentMounted }) {
return (
<View style={[StyleSheet.absoluteFillObject]}>
<ScrollView style={styles.scrollView}>
<RectButton
onPress={() => {
console.warn('X');
setVisible(false);
}}
>
<Text>HIDE</Text>
</RectButton>
<RectButton
onPress={() => {
console.warn('X');
setComponentMounted(false);
}}
>
<Text>UNMOUNT</Text>
</RectButton>
<Header />
<View style={styles.body}>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Step One</Text>
<Text style={styles.sectionDescription}>
Edit <Text style={styles.highlight}>App.js</Text> to change this
screen and then come back to see your edits.
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>See Your Changes</Text>
<Text style={styles.sectionDescription}>
<ReloadInstructions />
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Debug</Text>
<Text style={styles.sectionDescription}>
<DebugInstructions />
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Learn More</Text>
<Text style={styles.sectionDescription}>
Read the docs to discover what to do next:
</Text>
</View>
<LearnMoreLinks />
</View>
</ScrollView>
</View>
);
}
Example #19
Source File: index.tsx From nlw-01-omnistack with MIT License | 5 votes |
Detail = () => {
const [data, setData] = useState<Data>({} as Data);
const navigation = useNavigation();
const route = useRoute();
const routeParams = route.params as Params;
useEffect(() => {
api.get(`points/${routeParams.point_id}`).then(response => {
setData(response.data);
});
}, []);
function handleNavigateBack() {
navigation.goBack();
}
function handleWhatsapp() {
Linking.openURL(`whatsapp://send?phone=${data.point.whatsapp}&text=Tenho interesse sobre coleta de resíduos`);
}
function handleComposeMail() {
MailComposer.composeAsync({
subject: 'Interesse na coleta de resíduos',
recipients: [data.point.email],
})
}
if (!data.point) {
return null;
}
return (
<SafeAreaView style={{ flex: 1 }}>
<View style={styles.container}>
<TouchableOpacity onPress={handleNavigateBack}>
<Icon name="arrow-left" size={20} color="#34cb79" />
</TouchableOpacity>
<Image style={styles.pointImage} source={{ uri: data.point.image_url }} />
<Text style={styles.pointName}>{data.point.name}</Text>
<Text style={styles.pointItems}>
{data.items.map(item => item.title).join(', ')}
</Text>
<View style={styles.address}>
<Text style={styles.addressTitle}>Endereço</Text>
<Text style={styles.addressContent}>{data.point.city}, {data.point.uf}</Text>
</View>
</View>
<View style={styles.footer}>
<RectButton style={styles.button} onPress={handleWhatsapp}>
<FontAwesome name="whatsapp" size={20} color="#FFF" />
<Text style={styles.buttonText}>Whatsapp</Text>
</RectButton>
<RectButton style={styles.button} onPress={handleComposeMail}>
<Icon name="mail" size={20} color="#FFF" />
<Text style={styles.buttonText}>E-mail</Text>
</RectButton>
</View>
</SafeAreaView>
);
}
Example #20
Source File: styles.ts From gobarber-project with MIT License | 5 votes |
OkButton = styled(RectButton)`
align-items: center;
justify-content: center;
background: #ff9000;
border-radius: 10px;
margin-top: 24px;
padding: 12px 24px;
`
Example #21
Source File: index.tsx From nlw-02-omnistack with MIT License | 5 votes |
function Landing() {
const { navigate } = useNavigation();
const [totalConnections, setTotalConnections] = useState(0);
useEffect(() => {
api.get('connections').then(response => {
const { total } = response.data;
setTotalConnections(total);
})
}, []);
function handleNavigateToGiveClassesPage() {
navigate('GiveClasses');
}
function handleNavigateToStudyPages() {
navigate('Study');
}
return (
<View style={styles.container}>
<Image source={landingImg} style={styles.banner} />
<Text style={styles.title}>
Seja bem-vindo, {'\n'}
<Text style={styles.titleBold}>O que deseja fazer?</Text>
</Text>
<View style={styles.buttonsContainer}>
<RectButton
onPress={handleNavigateToStudyPages}
style={[styles.button, styles.buttonPrimary]}
>
<Image source={studyIcon} />
<Text style={styles.buttonText}>Estudar</Text>
</RectButton>
<RectButton
onPress={handleNavigateToGiveClassesPage}
style={[styles.button, styles.buttonSecondary]}
>
<Image source={giveClassesIcon} />
<Text style={styles.buttonText}>Dar aulas</Text>
</RectButton>
</View>
<Text style={styles.totalConnections}>
Total de {totalConnections} conexões já realizadas {' '}
<Image source={heartIcon} />
</Text>
</View>
);
}
Example #22
Source File: SelectMapPosition.tsx From nlw-03-omnistack with MIT License | 5 votes |
export default function SelectMapPosition() {
const navigation = useNavigation();
const [position, setPosition] = useState({ latitude: 0, longitude: 0});
function handleSelectMapPosition(event: MapEvent) {
setPosition(event.nativeEvent.coordinate);
}
function handleNextStep() {
navigation.navigate('OrphanageData', { position });
}
return (
<View style={styles.container}>
<MapView
initialRegion={{
latitude: -27.2092052,
longitude: -49.6401092,
latitudeDelta: 0.008,
longitudeDelta: 0.008,
}}
onPress={handleSelectMapPosition}
style={styles.mapStyle}
>
{ !!position.latitude && (
<Marker
icon={mapMarkerImg}
coordinate={position}
/>
)}
</MapView>
{ !!position.latitude && (
<RectButton style={styles.nextButton} onPress={handleNextStep}>
<Text style={styles.nextButtonText}>Próximo</Text>
</RectButton>
)}
</View>
)
}
Example #23
Source File: index.tsx From ecoleta with MIT License | 5 votes |
Detail = () => {
const [data, setData] = useState<Data>({} as Data);
const navigation = useNavigation();
const route = useRoute();
const routeParams = route.params as Params;
useEffect(() => {
api.get(`/points/${routeParams.point_id}`).then((response) => {
setData(response.data);
});
}, []);
function handleNavigateBack() {
navigation.goBack();
}
function handleWhatsapp() {
Linking.openURL(
`whatsapp://send?phone=${data.point.whatsapp}&text=Tenho interesse em ajudar na coleta de resíduos`
);
}
function handleComposeMail() {
MailComposer.composeAsync({
subject: 'Interesse na coleta de resíduos',
recipients: [data.point.email],
});
}
if (!data.point) {
return null;
}
return (
<SafeAreaView style={{ flex: 1 }}>
<View style={styles.container}>
<TouchableOpacity onPress={handleNavigateBack}>
<Feather name="arrow-left" color="#34CB79" size={24} />
</TouchableOpacity>
<Image
style={styles.pointImage}
source={{
uri: data.point.image_url,
}}
/>
<Text style={styles.pointName}>{data.point.name}</Text>
<Text style={styles.pointItems}>
{data.items.map((item) => item.title).join(', ')}
</Text>
<View style={styles.address}>
<Text style={styles.addressTitle}>Endereço:</Text>
<Text style={styles.addressContent}>
{data.point.city}, {data.point.uf}
</Text>
</View>
</View>
<View style={styles.footer}>
<RectButton style={styles.button} onPress={handleWhatsapp}>
<FontAwesome name="whatsapp" size={20} color="#fff" />
<Text style={styles.buttonText}>Whatsapp</Text>
</RectButton>
<RectButton style={styles.button} onPress={handleComposeMail}>
<Feather name="mail" size={20} color="#fff" />
<Text style={styles.buttonText}>E-mail</Text>
</RectButton>
</View>
</SafeAreaView>
);
}
Example #24
Source File: styles.ts From gobarber-project with MIT License | 5 votes |
CreateAppointmentButton = styled(RectButton)`
height: 50px;
background: #ff9000;
border-radius: 10px;
align-items: center;
justify-content: center;
margin: 0 24px;
`
Example #25
Source File: index.tsx From NLW-1.0 with MIT License | 5 votes |
Detail: React.FC = () => {
const [data, setData] = useState<Data>({} as Data);
const navigation = useNavigation();
const route = useRoute();
const routeParams = route.params as Params;
useEffect(() => {
async function loadPoint() {
const response = await api.get(`/points/${routeParams.point_id}`);
setData(response.data);
}
loadPoint();
}, []);
function handleNavigateBack() {
navigation.goBack();
}
function handleComposeMail() {
MailComposer.composeAsync({
subject: "Interesse na coleta de resíduos",
recipients: [data.point.email],
});
}
function handleWhatsApp() {
Linking.openURL(
`whatsapp://send?phone=${data.point.whatsapp}&text=Tenho interesse na coleta de resíduos`
);
}
if (!data.point) {
return null;
}
return (
<SafeAreaView style={{ flex: 1 }}>
<View style={styles.container}>
<TouchableOpacity onPress={handleNavigateBack}>
<Icon name="arrow-left" size={20} color="#34cb79" />
</TouchableOpacity>
<Image
style={styles.pointImage}
source={{
uri: data.point.image_url,
}}
/>
<Text style={styles.pointName}>{data.point.name}</Text>
<Text style={styles.pointItems}>
{data.items.map((item) => item.title).join(",")}
</Text>
<View style={styles.address}>
<Text style={styles.addressTitle}>Endereço</Text>
<Text style={styles.addressContent}>
{data.point.city}, {data.point.uf}
</Text>
</View>
</View>
<View style={styles.footer}>
<RectButton style={styles.button} onPress={() => handleWhatsApp()}>
<FontAwesome name="whatsapp" size={20} color="#fff" />
<Text style={styles.buttonText}>Whatsapp</Text>
</RectButton>
<RectButton style={styles.button} onPress={() => handleComposeMail()}>
<Icon name="mail" size={20} color="#fff" />
<Text style={styles.buttonText}>E-mail</Text>
</RectButton>
</View>
</SafeAreaView>
);
}
Example #26
Source File: styles.ts From gobarber-mobile with MIT License | 5 votes |
OkButton = styled(RectButton)`
background: ${({ theme }) => theme.colors.orange};
justify-content: center;
align-items: center;
border-radius: 10px;
margin-top: 24px;
padding: 12px 24px;
`
Example #27
Source File: SelectMapPosition.tsx From happy with MIT License | 5 votes |
export default function SelectMapPosition() {
const navigation = useNavigation();
const [position, setPosition] = useState({ latitude: 0, longitude: 0});
function handleNextStep() {
navigation.navigate('OrphanageData', { position });
}
function handleSelectMapPosition(event: MapEvent) {
setPosition(event.nativeEvent.coordinate);
}
return (
<View style={styles.container}>
<MapView
initialRegion={{
latitude: -27.2092052,
longitude: -49.6401092,
latitudeDelta: 0.008,
longitudeDelta: 0.008,
}}
style={styles.mapStyle}
onPress={handleSelectMapPosition}
>
{position.latitude !== 0 && (
<Marker
icon={mapMarkerImg}
coordinate={{ latitude: position.latitude, longitude: position.longitude }}
/>
)}
</MapView>
{position.latitude !== 0 && (
<RectButton style={styles.nextButton} onPress={handleNextStep}>
<Text style={styles.nextButtonText}>Próximo</Text>
</RectButton>
)}
</View>
)
}
Example #28
Source File: styles.ts From NextLevelWeek with MIT License | 5 votes |
NextButton = styled(RectButton)`
background: #15c3d6;
border-radius: 20px;
justify-content: center;
align-items: center;
height: 56px;
margin-top: 32px;
`
Example #29
Source File: index.tsx From selftrace with MIT License | 5 votes |
function TouchableRect({
children,
onPress,
haptic,
style,
containerStyle,
...rest
}: TouchableRectProps): ReactElement {
let onPressFinal = onPress;
if (haptic) {
onPressFinal = async (): Promise<void> => {
let impact = Light;
if (haptic === 'medium') impact = Medium;
if (haptic === 'heavy') impact = Heavy;
await Haptics.impactAsync(impact);
if (onPress) {
onPress(false);
}
};
}
/*
* Wrapping RectButton with View as a temporary workaround since
* RectButton doesn't support borderBottomWidth.
* TODO: Fix this when there is a solution.
*/
return (
<View
style={{
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: Colors.BORDER.toString(),
...containerStyle,
}}>
<RectButton
onPress={onPressFinal}
underlayColor={Colors.TOUCH.toString()}
activeOpacity={1}
style={[baseStyles.touchable, style]}
{...rest}>
{children}
</RectButton>
</View>
);
}