Simplistic approach to displaying image within the touchable. This component is just a simple combination of the Zero Component’s Touchable and React Native’s Image within

Usage

import React from 'react';
import { View } from 'react-native';
import { ImageButton } from 'react-native-zero-components';
import styles from './styles';
import icons from '../assets/icons';

const ImageButtonShowcase = () => (
  <View style={styles.root}>
    <ImageButton
      source={icons.bigIcon}
      onPress={() => null}
    />
    <ImageButton
      mode="highlight"
      source={icons.bigIcon}
      onPress={() => console.log('I have cool highlight')}
    />
    <ImageButton
      mode="opacity"
      source={icons.bigIcon}
      onPress={() => console.log('You can see right through me')}
    />
  </View>
);

Props

Reference

onPress

The same functionality as the one in Touchable component, but here it’s not an optional property.

Type Required
function yes

source

Image that is displayed within the button.

Type Required
ImageSourcePropType yes

imageStyle

Styling prop for the Image component within the button that displays the source

Type Required Default
style No null

resizeMode

Determines the way image will be resized within the component.

Type Required Default
enum(‘cover’, ‘contain’, ‘stretch’, ‘repeat’, ‘center’) No "contain"

raised

Determines if the button will have default shadow or not. If true, shadow will be displayed. Otherwise shadow will not be displayed unless you put it manually in style prop

Type Required Default
boolean No false