Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //import liraries
- import React, { Component } from 'react';
- import { View, Text, StyleSheet, TouchableOpacity, ActivityIndicator } from 'react-native';
- // create a component
- const ButtonWithLoader = ({
- isLoading,
- text,
- onPress
- }) => {
- return (
- <TouchableOpacity onPress={onPress} style={styles.btnStyle}>
- {!!isLoading ? <ActivityIndicator size="large" color="white" />
- : <Text style={styles.textStyle}>{text}</Text>
- }
- </TouchableOpacity>
- );
- };
- // define your styles
- const styles = StyleSheet.create({
- btnStyle: {
- height: 48,
- backgroundColor: 'blue',
- alignItems: 'center',
- justifyContent: 'center',
- borderRadius: 10,
- paddingHorizontal: 16,
- fontFamily:'TiltNeon-Regular'
- },
- textStyle: {
- fontSize: 16,
- textTransform: 'uppercase',
- fontWeight: 'bold',
- color: 'white',
- fontFamily:'TiltNeon-Regular'
- }
- });
- //make this component available to the app
- export default ButtonWithLoader;
Advertisement
Add Comment
Please, Sign In to add comment