### Install rn-custom-alert-prompt Library Source: https://github.com/ferriv3ra/rn-custom-alert-prompt/blob/main/README.md Instructions to install the `rn-custom-alert-prompt` library using either npm or yarn package managers. ```bash npm i rn-custom-alert-prompt ``` ```bash yarn add rn-custom-alert-prompt ``` -------------------------------- ### Basic Usage of Alert.prompt in React Native Source: https://github.com/ferriv3ra/rn-custom-alert-prompt/blob/main/README.md Demonstrates the simplest way to use the 'Alert.prompt' function from 'rn-custom-alert-prompt' to get user input. It shows how to call the prompt with a title and description, and how to handle the returned string or undefined value. ```js import {Text, TouchableOpacity, View} from 'react-native'; import {Alert} from 'rn-custom-alert-prompt'; const MyComponent = () => { const handlePress = () => { const response = await Alert.prompt('Email', 'Please enter your email'); console.log(response) // string | undefined } return ( Open Prompt ) ``` -------------------------------- ### API Documentation for Prompt Props Source: https://github.com/ferriv3ra/rn-custom-alert-prompt/blob/main/README.md Details the available properties that can be passed to the 'Alert.prompt' function when using the object-based configuration. Each prop's type, description, and requirement status are listed, providing a comprehensive reference for customization. ```APIDOC Prompt Props: - title: string (Required) - Title for your alert. - cancelColorText: string (Optional) - Cancel button text color. - cancelText: string (Optional) - Cancel button text. - confirmColorText: string (Optional) - Confirm button text color. - confirmText: string (Optional) - Confirm button text. - label: string (Optional) - Label for input -Android only-. - placeholder: string (Optional) - Input placeholder. Default: title value. ``` -------------------------------- ### Basic Usage of Alert Component Source: https://github.com/ferriv3ra/rn-custom-alert-prompt/blob/main/README.md Illustrates how to use the Alert component to display a customizable system alert, demonstrating a simple button press to trigger an alert with a title and description. ```js import {Text, TouchableOpacity, View} from 'react-native'; import {Alert} from 'rn-custom-alert-prompt'; const MyComponent = () => { const handlePress = () => { Alert.alert('Title', 'Description') } return ( Open Alert ) } ``` -------------------------------- ### React Native Alert Usage with Props Source: https://github.com/ferriv3ra/rn-custom-alert-prompt/blob/main/README.md Demonstrates how to use the `Alert.alert` method from `rn-custom-alert-prompt` to display a customizable alert. It shows how to pass `title`, `description`, and `showCancelButton` props, and how the method returns a boolean response indicating user action. ```javascript import {Text, TouchableOpacity, View} from 'react-native'; import {Alert} from 'rn-custom-alert-prompt'; const MyComponent = () => { const handlePress = async () => { const response = await Alert.alert({ title: 'Alert', description: 'Would you like to continue learning how to use React Native alerts?', showCancelButton: true, }) console.log(response) // true or false } return ( Open Alert ) ``` -------------------------------- ### PersonalTheme Properties for Alert Customization Source: https://github.com/ferriv3ra/rn-custom-alert-prompt/blob/main/README.md Detailed documentation for the properties available within the PersonalTheme object, allowing granular customization of alert colors and styles. ```APIDOC PersonalTheme Properties: backgroundColor: Description: Background color around your alert. Type: rgba color Default iOS: rgba(0,0,0,0.4) Default Android: rgba(0,0,0,0.4) backgroundInputColor: Description: Background color of the text input in the prompt. Type: string Default iOS: Light: '#1C1C1E' | Dark: '#FFFFFF' Default Android: Light: 'transparent' | Dark: 'transparent' cardBackgroundColor: Description: Alert color. Type: string Default iOS: Light: '#EEEEEE' | Dark: '#222222' Default Android: Light: '#282F2C'| Dark: '#FFFFFF' descriptionColor: Description: Color of your alert description. Type: string Default iOS: Light: '#000000' | Dark: '#FFFFFF' Default Android: Light: '#000000'| Dark: '#FFFFFF' inputBorderColor: Description: Border color for your prompt input. Type: string Default iOS: Light: '#C3C3C3' | Dark: '#616161' Default Android: Light: '#00D982'| Dark: '#00D982' inputColor: Description: Color of the text input in the prompt. Type: string Default iOS: Light: '#000000' | Dark: '#FFFFFF' Default Android: Light: '#000000' | Dark: '#FFFFFF' lineColor: Description: Color of the line border to separate buttons -iOS Only-. Type: string Default iOS: Light: '#C3C3C3' | Dark: '#616161' Default Android: N/A placeholderColor: Description: Color of the placeholder in the prompt. Type: string Default iOS: Light: '#C3C3C3' | Dark: '#666666' Default Android: Light: '#C3C3C3' | Dark: '#666666' textButtonColor: Description: Color of the text on the buttons. Type: string Default iOS: Light: '#4F87FF' | Dark: '#4F87FF' Default Android: Light: '#00D982' | Dark: '#00D982' titleColor: Description: Color of your alert title. Type: string Default iOS: Light: '#000000' | Dark: '#FFFFFF' Default Android: Light: '#000000' | Dark: '#FFFFFF' ``` -------------------------------- ### Configure Alert.prompt with Props in React Native Source: https://github.com/ferriv3ra/rn-custom-alert-prompt/blob/main/README.md Illustrates how to customize the 'Alert.prompt' behavior by passing an object of configuration props. This allows setting a custom title, description, input label, and placeholder for the prompt, offering more control over the prompt's appearance and functionality. ```js import {Text, TouchableOpacity, View} from 'react-native'; import {Alert} from 'rn-custom-alert-prompt'; const MyComponent = () => { const handlePress = async () => { const response = await Alert.prompt({ title: 'Prompt', description: 'Enter your email to continue learning how to use React Native alerts!', label: 'Email', placeholder: 'example@example.com', }) console.log(response) // string | undefined } return ( Open Prompt ) ``` -------------------------------- ### Alert Component Props Reference Source: https://github.com/ferriv3ra/rn-custom-alert-prompt/blob/main/README.md Defines the configurable properties for the `Alert.alert` method, allowing customization of its appearance and behavior, including text, buttons, icons, and colors. ```APIDOC Prop: title Description: Title for your alert. Type: string Required: Yes Prop: buttons Description: Personalized buttons for your alert. Type: Button[] Required: No Prop: cancelColorText Description: Cancel button text color. Type: string Required: No Prop: cancelText Description: Cancel button text. Type: string Required: No Prop: confirmColorText Description: Confirm button text color. Type: string Required: No Prop: confirmText Description: Confirm button text. Type: string Required: No Prop: icon Description: Alert icon. Type: 'error' | 'info' | 'success' | 'question' Required: No Prop: iconColor Description: Icon color. Type: string Required: No Prop: showCancelButton Description: Shows the cancel button. Type: boolean Required: No ``` -------------------------------- ### Import and Integrate AlertContainer Component Source: https://github.com/ferriv3ra/rn-custom-alert-prompt/blob/main/README.md Demonstrates how to import the AlertContainer component and integrate it into your main React Native application file, such as App.js or App.tsx, to enable custom alerts. ```js import {AlertContainer} from 'rn-custom-alert-prompt'; export const App = () => { return ( {/* Rest of your app code */} ); }; ``` -------------------------------- ### Button Component Props Reference Source: https://github.com/ferriv3ra/rn-custom-alert-prompt/blob/main/README.md Defines the properties for individual buttons that can be passed to the `Alert.alert` method via the `buttons` prop, allowing customization of button text, style, and press action. ```APIDOC Prop: text Description: Button text. Type: string Required: Yes Prop: textStyle Description: Personalized styles for your text button. Type: StyleProp Required: No Prop: onPress Description: Function that is executed when the button is pressed. Type: function Required: No ``` -------------------------------- ### AlertContainer Component Properties Source: https://github.com/ferriv3ra/rn-custom-alert-prompt/blob/main/README.md Documentation for the optional properties that can be passed to the AlertContainer component to customize its appearance and behavior. ```APIDOC AlertContainer Properties: animationType: Description: Choose the animation with which your alert will appear. Type: 'none' | 'fade' | 'slide' Default: 'none' appearance: Description: Choose between light and dark appearance for your alert. Type: 'light' | 'dark' Default: Device appearance personalTheme: Description: Completely customize how your alert will appear. Type: PersonalTheme Default: PersonalTheme defaults theme: Description: Choose the theme between iOS and Android for your alert. Type: 'ios' | 'android' Default: Auto detect OS ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.