react-native-ios-alert-toast
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

react-native-ios-alert-toast

React Native iOS Swift TypeScript

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

Package Sidebar

Install

npm i react-native-ios-alert-toast

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

19 kB

Total Files

14

Last publish

Collaborators

  • eduhds