0.1.0 • Published 1 year ago

react-native-ios-alert-toast v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

0.1.0

1 year ago