ButtonComponent.js 879 Bytes
Newer Older
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
1 2 3
import React from 'react';
import { Image, StyleSheet, TouchableOpacity, View } from 'react-native';
import AppText from './AppText';
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
export default function ButtonComponent({
  text,
  style,
  textStyle,
  iconSource,
  styleIcon,
  onPress,
  rightIcon,
  leftIcon,
  badge,
  badgeStyle,
  disable,
}) {
  return (
    <TouchableOpacity style={style} disabled={disable} onPress={onPress}>
      {leftIcon && <Image source={leftIcon} style={styleIcon} />}
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
20
      {text && <AppText style={textStyle}>{text}</AppText>}
21 22 23 24
      {iconSource && <Image source={iconSource} style={styleIcon} />}
      {rightIcon && <Image source={rightIcon} style={styleIcon} />}
      {badge && (
        <View style={badgeStyle}>
quynhquang400@gmail.com's avatar
quynhquang400@gmail.com committed
25
          <AppText style={{color: 'white', fontSize: 12}}>{badge}</AppText>
26 27 28 29 30 31
        </View>
      )}
    </TouchableOpacity>
  );
}
const styles = StyleSheet.create({});