1.1.9 • Published 8 months ago

react-native-custom-alert-modal v1.1.9

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

react-native-custom-alert-modal

A simple and customizable modal for React Native that functions like the default alert but with enhanced styling and functionality.

Installation

Install the package using npm or yarn:

npm install react-native-custom-alert-modal or yarn add react-native-custom-alert-modal

Usage

import AlertModal from 'react-native-custom-alert-modal';

const [modalVisible, setModalVisible] = useState(false);

const buttons: Array<ButtonType> = [
{
  text: 'OK',
  backgroundColor: 'green',
  textColor: '#FFFFFF',
  style: 'default',
  onPress: () => console.log('OK Pressed'),
},
{
  text: 'Cancel',
  backgroundColor: 'silver',
  textColor: '#000000',
  style: 'cancel',
  onPress: () => console.log('Cancel Pressed'),
},

];

return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
        <Button title="Show Modal" onPress={() => setModalVisible(true)} />
        <AlertModal
            visible={modalVisible}
            title="Custom Alert"
            buttonsStyle="column"
            message="This is a customizable alert modal."
            buttons={buttons}
            onClose={() => setModalVisible(false)}
        />
    </View>
);

Props

Props Overview

Button Object Format (ButtonType)

Button Object Format

Android View

Android Overview

Android Overview

Customization

You can style the modal and its components by modifying the StyleSheet in the source code. Buttons can have different styles (default, cancel, destructive) for visual cues.

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

License

This project is licensed under the MIT License. See the LICENSE file for details.

1.1.9

8 months ago

1.1.8

8 months ago

1.1.7

8 months ago

1.1.6

8 months ago

1.1.3

8 months ago

1.1.2

8 months ago

1.1.1

8 months ago

1.1.0

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago