A customizable button component for React Native with optional icon support.
Ensure you have React Native installed in your project before using this component.
import React from 'react';
import { View, Alert } from 'react-native';
import CustomButton from 'react-native-customReusableButton';
const App = () => {
return (
<View>
<CustomButton
title="Click Me"
onPress={() => Alert.alert('Button Pressed!')}
iconSource={require('./path-to-icon.png')} // Optional icon
/>
</View>
);
};
export default App;
Prop | Type | Description | Default |
---|---|---|---|
title |
string |
The text displayed on the button. | - |
onPress |
() => void |
Function to execute when button is pressed. | - |
isButtonDisabled |
boolean |
Disables the button when true. | false |
iconSource |
ImageSourcePropType |
Optional image/icon to display on the button. | undefined |
style |
StyleProp<ViewStyle> |
Custom style for the button container. | undefined |
textStyle |
StyleProp<TextStyle> |
Custom style for the button text. | undefined |
imageStyle |
StyleProp<ImageStyle> |
Custom style for the button image. | undefined |
activeOpacity |
number |
Opacity effect when button is pressed. | 0.7 |