Overview
The apsl-react-native-button is a customizable React Native button component that renders a TouchableOpacity under iOS and a TouchableNativeFeedback under Android. It provides various props for customization, including styling options and event handling functions.
Features
- Customizable Styling: Customize the button’s style using style props.
- Cross-Platform Compatibility: Renders as a
TouchableOpacityfor iOS andTouchableNativeFeedbackfor Android. - Event Handling: Execute functions for onPress, onPressIn, onPressOut, onLongPress events.
- Text Customization: Customize the inner text styling using the
textStyleprop. - Loading State: Disable the button and show a spinner with the
isLoadingprop. - Child Elements: Use multiple child elements for nested content inside the button.
- Accessibility: Control button transparency, activity indicator color, and disabled style.
Installation
To install the apsl-react-native-button package, ensure you have the correct React Native version:
- For versions >=2.6.0, require React Native 0.28 or higher.
- For versions >=2.5.0, require React Native 0.25 or higher.
- For versions <=2.4.2, require React Native 0.16 or higher.
Install the package:
npm install apsl-react-native-button
Import the Button component:
import Button from 'apsl-react-native-button';
Summary
The apsl-react-native-button is a versatile button component for React Native applications that offers customization options for styling, event handling, and text customization. It supports cross-platform rendering for iOS and Android, making it a suitable choice for building interactive and visually appealing buttons in mobile apps.