React Native wrapper for iOS AlertToast.
This library is only for iOS but will not break on Android!
npm install react-native-ios-alert-toast
# Or
yarn add react-native-ios-alert-toast
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',
},
});
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library