{"id":14974380,"url":"https://github.com/avrcoelho/react-native-hook-notification","last_synced_at":"2025-10-27T08:31:21.784Z","repository":{"id":57677600,"uuid":"454586383","full_name":"avrcoelho/react-native-hook-notification","owner":"avrcoelho","description":"Add notifications in your React Native app. Types: success, error, warning, info, default or custom","archived":false,"fork":false,"pushed_at":"2022-10-17T16:15:15.000Z","size":740,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-01T04:31:35.791Z","etag":null,"topics":["javascript","javascript-library","library","notification","notifications","react","react-native","react-native-app","reactnative","toast","toast-notifications","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-native-hook-notification","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avrcoelho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"avrcoelho"}},"created_at":"2022-02-01T23:34:51.000Z","updated_at":"2024-05-18T11:14:59.000Z","dependencies_parsed_at":"2022-09-10T18:21:53.475Z","dependency_job_id":null,"html_url":"https://github.com/avrcoelho/react-native-hook-notification","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avrcoelho%2Freact-native-hook-notification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avrcoelho%2Freact-native-hook-notification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avrcoelho%2Freact-native-hook-notification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avrcoelho%2Freact-native-hook-notification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avrcoelho","download_url":"https://codeload.github.com/avrcoelho/react-native-hook-notification/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238463789,"owners_count":19476774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","javascript-library","library","notification","notifications","react","react-native","react-native-app","reactnative","toast","toast-notifications","typescript"],"created_at":"2024-09-24T13:50:29.006Z","updated_at":"2025-10-27T08:31:21.217Z","avatar_url":"https://github.com/avrcoelho.png","language":"TypeScript","funding_links":["https://github.com/sponsors/avrcoelho"],"categories":[],"sub_categories":[],"readme":"# React Native Hook Notification\n\nAdd notifications in your React Native app. Types: success, error, warning, info, default or custom.\n\n\u003cimg src=\"demo.jpg\" alt=\"Demo\" width=\"350\" /\u003e\n\n- Compatible with `Reanimated v2`.\n- Compatible with `Expo`.\n- Written in `TypeScript`.\n\n## Install\n\n```shell\nnpm install react-native-hook-notification\n```\n\nor\n\n```shell\nyarn add react-native-hook-notification\n```\n\n#### Dependencies​\n\nThis library needs these dependencies to be installed in your project before you can use it:\n\n```shell\nnpm install react-native-reanimated react-native-gesture-handler\n```\n\nor\n\n```shell\nyarn add react-native-reanimated react-native-gesture-handler\n```\n\n\u003cbr /\u003e\n\n\u003e **ℹ️ INFO**\n\u003e\n\u003e **React Native Gesture Handler** needs extra steps to finalize its installation, please follow their [installation instructions](https://github.com/software-mansion/react-native-gesture-handler).\n\u003e\n\u003e **React Native Reanimated v2** needs extra steps to finalize its installation, please follow their [installation instructions](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/).\n\n## Usage\n\n- In the application index file:\n\n```js\nimport React from 'react';\nimport { NotificationContainer } from 'react-native-hook-notification';\n\nimport { Component } from './component/Component';\n\nexport default function App() {\n  return (\n    \u003c\u003e\n      \u003cComponent /\u003e\n      \u003cNotificationContainer /\u003e\n    \u003c/\u003e\n  );\n}\n```\n\n- In the component:\n\n```js\nimport React from 'react';\nimport { TouchableOpacity, Text } from 'react-native';\nimport { useNotification } from 'react-native-hook-notification';\n\nexport default function Component() {\n  const notification = useNotification();\n\n  return (\n    \u003cTouchableOpacity\n      onPress={() =\u003e\n        notification.success({\n          text: 'Notification test',\n        })\n      }\n    \u003e\n      \u003cText\u003eDispatch\u003c/Text\u003e\n    \u003c/TouchableOpacity\u003e\n  );\n}\n```\n\n### Props\n\n| Property        | Type                                                                                                                                                                                            | Required | Default   | Description                                                |\n| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------- | ---------------------------------------------------------- |\n| text            | string                                                                                                                                                                                          | yes      |           | Notification text                                          |\n| title           | string                                                                                                                                                                                          | no       |           | Notification title                                         |\n| position        | top-right \\| top-center \\| top-left \\| bottom-right \\| bottom-center \\| bottom-left                                                                                                             | no       | top-right | Notification position                                      |\n| theme           | colored \\| light \\| dark                                                                                                                                                                        | no       | colored   | Notification theme                                         |\n| transition      | bounce \\| flip \\| fade \\| slide \\| zoom                                                                                                                                                         | no       | bounce    | Notification transition                                    |\n| delay           | number                                                                                                                                                                                          | no       | 5000      | Notification delay in milliseconds                         |\n| showButtonClose | boolean                                                                                                                                                                                         | no       | false     | Show or hide close button                                  |\n| autoClose       | boolean                                                                                                                                                                                         | no       | true      | Automatic closing of the notification after the delay ends |\n| pauseOnPress    | boolean                                                                                                                                                                                         | no       | true      | Auto close pause on hover                                  |\n| closeOnPress    | boolean                                                                                                                                                                                         | no       | false     | Close on press                                             |\n| onPress         | `() =\u003e void`                                                                                                                                                                                    | no       |           | Called on Notification press                               |\n| draggable       | boolean                                                                                                                                                                                         | no       | true      | Enable or disable drag                                     |\n| dragDirection   | x \\| y                                                                                                                                                                                          | no       | y         | Drag direction                                             |\n| icon            | React.FunctionComponentElement                                                                                                                                                                  | no       |           | Render icon on left side. Obs.: Dimensions: 24x24          |\n| titleMaxLines   | number                                                                                                                                                                                          | no       | 1         | Maximum number of lines for title                          |\n| textMaxLines    | number                                                                                                                                                                                          | no       | 2         | Maximum number of lines for text                           |\n| xOffset         | number                                                                                                                                                                                          | no       | 16        | Offset from the X axis of the screen (in px)               |\n| customStyle     | `{ container?: StyleProp\u003cViewStyle\u003e; title?: StyleProp\u003cTextStyle\u003e; text?: StyleProp\u003cTextStyle\u003e; icon?: StyleProp\u003cViewStyle\u003e; button?: StyleProp\u003cViewStyle\u003e;buttonText?: StyleProp\u003cTextStyle\u003e;}` | no       |           | Styles for custom notificaion type                         |\n\n## License\n\n[![License](https://img.shields.io/badge/License-MIT-yellow?style=flat\u0026logoColor=f00\u0026link=https://opensource.org/licenses/MIT)](https://opensource.org/licenses/MIT)\n\nDeveloped by: [André Coelho](https://andrecoelho.dev)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favrcoelho%2Freact-native-hook-notification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favrcoelho%2Freact-native-hook-notification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favrcoelho%2Freact-native-hook-notification/lists"}