aakash2310

Untitled

Mar 31st, 2023 (edited)
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. //import liraries
  2. import React, { Component } from 'react';
  3. import { View, Text, StyleSheet, TouchableOpacity, ActivityIndicator } from 'react-native';
  4.  
  5. // create a component
  6. const ButtonWithLoader = ({
  7. isLoading,
  8. text,
  9. onPress
  10. }) => {
  11. return (
  12. <TouchableOpacity onPress={onPress} style={styles.btnStyle}>
  13.  
  14. {!!isLoading ? <ActivityIndicator size="large" color="white" />
  15. : <Text style={styles.textStyle}>{text}</Text>
  16. }
  17. </TouchableOpacity>
  18. );
  19. };
  20.  
  21. // define your styles
  22. const styles = StyleSheet.create({
  23. btnStyle: {
  24. height: 48,
  25. backgroundColor: 'blue',
  26. alignItems: 'center',
  27. justifyContent: 'center',
  28. borderRadius: 10,
  29. paddingHorizontal: 16,
  30. fontFamily:'TiltNeon-Regular'
  31. },
  32. textStyle: {
  33. fontSize: 16,
  34. textTransform: 'uppercase',
  35. fontWeight: 'bold',
  36. color: 'white',
  37. fontFamily:'TiltNeon-Regular'
  38. }
  39. });
  40.  
  41. //make this component available to the app
  42. export default ButtonWithLoader;
  43.  
Advertisement
Add Comment
Please, Sign In to add comment