Button component that renders a button with icon and supports normal images, .svg
images using react-native-vector-image
and MaterialCommunityIcons
using react-native-vector-icons
for icons.
If you intend using .svg
images for component then make sure to add react-native-vector-image
to your project and follow the installation steps as well.
import React from 'react';
import { View } from 'react-native';
import { Button } from 'roqay-react-native-common-components';
const MyComponent = () => {
return (
<View>
<Button text="Simple Button" />
<Button
startImage={require('./information.png')}
text="Button With Image"
/>
<Button
startVector={require('./information.svg')}
text="Button With Vector"
/>
<Button startIconName="information" text="Button With Icon" />
</View>
);
};
Type: string
The text to display in the button.
Type: number
- opaque type returned by something like require('./image.jpg')
The image to display before text. Used for any supported image formats by React Native.
Type: number
- opaque type returned by something like require('./image.svg')
The image to display before text. Used for .svg
images.
Type: string
- one of the names available in MaterialCommunityIcons
The image to display before text. Used for MaterialCommunityIcons
.
Type: number
- opaque type returned by something like require('./image.jpg')
The image to display after text. Used for any supported image formats by React Native.
Type: number
- opaque type returned by something like require('./image.svg')
The image to display after text. Used for .svg
images.
Type: string
- one of the names available in MaterialCommunityIcons
The image to display after text. Used for MaterialCommunityIcons
.
Type: () => void
Callback that is called when the user press the button.
Type: boolean
Default value: false
Determines whether button is disabled.
Type: number
Default value: 24
Determines the icon size.
Type: boolean
Default value: false
If true
then the text color will not be applied as tint and no tint will be added to the icon.
Type: Text props
The props to add to the Text
component used to render button text.