react-native-ios-alert-toast
v0.1.0
Published
iOS alert toast
Downloads
4
Readme
react-native-ios-alert-toast
React Native wrapper for iOS AlertToast.
This library is only for iOS but will not break on Android!
Installation
npm install react-native-ios-alert-toast
# Or
yarn add react-native-ios-alert-toast
Usage
import * as React from 'react';
import { StyleSheet, Button, SafeAreaView } from 'react-native';
import {
IosAlertToastView,
type IosAlertToastOptions,
} from 'react-native-ios-alert-toast';
export default function App() {
const [toast, setToast] = React.useState<IosAlertToastOptions | null>(null);
return (
<SafeAreaView style={styles.container}>
<Button
title="Show Alert Toast"
onPress={() => {
setToast({
mode: 'alert',
type: 'regular',
title: 'Alert Toast',
});
setTimeout(() => setToast(null), 2000);
}}
/>
<IosAlertToastView toast={toast} />
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'space-around',
},
});
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Credits
Made with create-react-native-library