### Starting Metro Packager for Example App (sh) Source: https://github.com/seniv/react-native-notifier/blob/main/CONTRIBUTING.md Starts the Metro bundler server for the example application, allowing you to run and test changes made to the library. ```sh yarn example start ``` -------------------------------- ### Running Example App on Web (sh) Source: https://github.com/seniv/react-native-notifier/blob/main/CONTRIBUTING.md Builds and runs the example application in a web browser. Requires the Metro packager to be running. ```sh yarn example web ``` -------------------------------- ### Install react-native-safe-area-context Dependency (Bash) Source: https://github.com/seniv/react-native-notifier/blob/main/MIGRATION.md This snippet shows the command-line instructions for installing the required `react-native-safe-area-context` package using either Yarn or npm. This dependency is now used internally by react-native-notifier v3 for safe area handling. ```bash yarn add react-native-safe-area-context # or npm install --save react-native-safe-area-context ``` -------------------------------- ### Running Example App on iOS (sh) Source: https://github.com/seniv/react-native-notifier/blob/main/CONTRIBUTING.md Builds and runs the example application on a connected iOS device or simulator. Requires the Metro packager to be running. ```sh yarn example ios ``` -------------------------------- ### Running Example App on Android (sh) Source: https://github.com/seniv/react-native-notifier/blob/main/CONTRIBUTING.md Builds and runs the example application on a connected Android device or emulator. Requires the Metro packager to be running. ```sh yarn example android ``` -------------------------------- ### Installing Dependencies with Yarn Workspaces (sh) Source: https://github.com/seniv/react-native-notifier/blob/main/CONTRIBUTING.md Installs all required dependencies for the monorepo packages using Yarn workspaces from the root directory. This is the first step to set up the project for development. ```sh yarn ``` -------------------------------- ### Install react-native-notifier Package Source: https://github.com/seniv/react-native-notifier/blob/main/README.md Instructions for adding the react-native-notifier library to your project using either Yarn or npm package managers. ```sh yarn add react-native-notifier ``` ```sh npm install --save react-native-notifier ``` -------------------------------- ### Wrap App Root with SafeAreaProvider (React/TS) Source: https://github.com/seniv/react-native-notifier/blob/main/MIGRATION.md This React/TypeScript snippet demonstrates how to wrap the root component of your application or the `NotifierWrapper` with the `` component from `react-native-safe-area-context`. This is required for the notifier library to correctly handle safe areas in v3. ```ts import { SafeAreaProvider } from 'react-native-safe-area-context'; const App = () => ( {/* ... your app code ... */} ); ``` -------------------------------- ### Configure Notification Show Animation (React Native Notifier/TS) Source: https://github.com/seniv/react-native-notifier/blob/main/MIGRATION.md This TypeScript snippet illustrates the change in how notification animations are configured in react-native-notifier v3. It shows how to replace the deprecated `showAnimationDuration` and `showEasing` parameters with the new `showAnimationConfig` object, which allows specifying the animation method and its configuration. ```ts Notifier.showNotification({ // Old: showAnimationDuration: 800, showEasing: Easing.bounce, // New: showAnimationConfig: { method: 'timing', config: { duration: 800, easing: Easing.bounce, }, }, // ... }); ``` -------------------------------- ### Creating Custom Notification Component for react-native-notifier (JS) Source: https://github.com/seniv/react-native-notifier/blob/main/README.md Illustrates how to create a custom React Native component to be used as a notification with react-native-notifier. The custom component receives 'title' and 'description' props, allowing full control over the notification's appearance and layout. This example defines a simple component with custom styling. ```javascript import React from 'react'; import { StyleSheet, View, Text, SafeAreaView } from 'react-native'; const styles = StyleSheet.create({ safeArea: { backgroundColor: 'orange', }, container: { padding: 20, }, title: { color: 'white', fontWeight: 'bold' }, description: { color: 'white' }, }); const CustomComponent = ({ title, description }) => ( {title} {description} ); // ... // Then show notification with the component Notifier.showNotification({ title: 'Custom', description: 'Example of custom component', Component: CustomComponent, }); ``` -------------------------------- ### Implement Custom Notification Animation Function (React Native Notifier/TS) Source: https://github.com/seniv/react-native-notifier/blob/main/MIGRATION.md This TypeScript snippet demonstrates the structure of the new `animationFunction` parameter used for implementing custom notification animations in react-native-notifier v3. It shows how to use the provided `animationState`, `shakingTranslationX`, and `shakingTranslationY` parameters to control the style properties like opacity and transform. ```ts animationFunction: ({ animationState, shakingTranslationX, shakingTranslationY, }: AnimationFunctionParams) => { return { opacity: animationState, transform: [ { translateX: shakingTranslationX, }, { translateY: shakingTranslationY, }, ], }; }, ``` -------------------------------- ### Showing a Basic Notification using NotifierComponents.Notification (JavaScript) Source: https://github.com/seniv/react-native-notifier/blob/main/README.md This snippet demonstrates how to display a simple notification using the default `NotifierComponents.Notification` component. It shows importing the necessary modules and calling `Notifier.showNotification` with basic title, description, component, and component-specific props like `imageSource`. ```js import { Notifier, NotifierComponents } from 'react-native-notifier'; Notifier.showNotification({ title: 'Check this image!', description: 'Cool, right?', Component: NotifierComponents.Notification, componentProps: { imageSource: require('./react.jpg'), }, }); ``` -------------------------------- ### Publishing New Version with release-it (sh) Source: https://github.com/seniv/react-native-notifier/blob/main/CONTRIBUTING.md Uses the release-it tool to automate the process of publishing a new version of the library to npm, including bumping the version, creating tags, and releases. ```sh yarn release ``` -------------------------------- ### Show Notification Using NotifierRoot Ref Source: https://github.com/seniv/react-native-notifier/blob/main/README.md Shows an alternative approach using NotifierRoot and React's useRef hook to control notifications via a component reference, useful when global methods are disabled or for fine-grained control. ```js import { NotifierRoot } from 'react-native-notifier'; function App() { const notifierRef = useRef(); return ( <>