{"id":17957512,"url":"https://github.com/itinance/redux-saga-rn-alert","last_synced_at":"2025-07-27T03:10:39.456Z","repository":{"id":57351462,"uuid":"91833063","full_name":"itinance/redux-saga-rn-alert","owner":"itinance","description":"Alert.alert()-Support for side effects with redux-saga in react-native-apps","archived":false,"fork":false,"pushed_at":"2021-12-28T10:54:43.000Z","size":20,"stargazers_count":24,"open_issues_count":1,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-21T09:49:00.231Z","etag":null,"topics":["react-native","react-redux","redux-saga"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/itinance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-19T18:10:52.000Z","updated_at":"2023-10-21T03:47:47.000Z","dependencies_parsed_at":"2022-08-31T03:53:20.127Z","dependency_job_id":null,"html_url":"https://github.com/itinance/redux-saga-rn-alert","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/itinance/redux-saga-rn-alert","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itinance%2Fredux-saga-rn-alert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itinance%2Fredux-saga-rn-alert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itinance%2Fredux-saga-rn-alert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itinance%2Fredux-saga-rn-alert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itinance","download_url":"https://codeload.github.com/itinance/redux-saga-rn-alert/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itinance%2Fredux-saga-rn-alert/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266929883,"owners_count":24008180,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["react-native","react-redux","redux-saga"],"created_at":"2024-10-29T10:55:26.734Z","updated_at":"2025-07-27T03:10:39.439Z","avatar_url":"https://github.com/itinance.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redux-saga-rn-alert\n\nEver wanted to use Alert.alert() with callbacks within a side-effect or generator function? This library help along!\n\nIt allows us to show a typical alert-modal while we can pass callbacks\nfor the user-action the redux-saga-way with `yield put()` or `yield call()`.\nOther side-effects like `fork` or `spawn` aren't implemented yet. Feel\nfree to contribute if you need it!\n\n\n# Changelog\n\n**V 1.2.6**\n\nNested alerts will be prevented from now on, as soon as one re-enables them calling `preventNestedAlerts(false)`.\n\nLet's say in your code gets another alert() called while the first one is still open. This could result in unwanted and strage effects.\nSince 1.2.6 we will prevent that a subsequent call to alert() will be appear if another alert is still open.\n\n\n# Installation\n\n```bash\nyarn add redux-saga-rn-alert\n```\nor\n```bash\nnpm install redux-saga-rn-alert --save\n```\n\n# Setup\n\nIn the root reducer add the alert-reducer. For instance:\n\n**reducer.js:**\n\n```javascript\nimport { alertReducer } from 'redux-saga-rn-alert';\n\nconst appReducer = combineReducers({\n  appStates,\n  routes,\n  ...\n  alertReducer\n});\n```\n\nIn the root saga spawn the channel watcher:\n\n**saga.js**\n\n```javascript\n\nimport { watchAlertChannel } from 'redux-saga-rn-alert';\n\nexport default function * rootSaga() {\n  yield [\n    // ... all your sagas here\n    spawn(watchAlertChannel),\n  ];\n}\n```\n\n# Usage\n\nThe alert-function has the same signature as the official [alert-method](https://facebook.github.io/react-native/docs/alert.html#alert)\nof react-native.\n\n```javascript\nstatic alert(title, message?, buttons?, options?) {}\n```\n\n## Example 1\n\nShow an alert with 2 Buttons and put some actions:\n\n```javascript\n  const buttons = [\n      {text: 'Cancel', style:'cancel', put: {type: ACTIONS.S_CANCEL_EDIT}},\n      {text: 'OK', style:'default',call: RouterActions.pop},\n  ]\n\n  yield call(alert, 'Error', 'Foobar message', buttons)\n```\n\nIn this example an alert-box will be shown with two buttons \"Cancel\"\nand \"ok\". If the user taps on \"cancel\", a `yield put()` will be\nexecuted with a user-defined action, while \"ok\" raises a `yield call`\nto the pop-method of the Router from [react-native-router-flux](https://github.com/itinance/react-native-router-flux).\n\nInstead of executing a \"plain\" function like `pop()` without any arguments, you can also call a method passing arguments:\n\n## Example 2\n\n```javascript\n  const buttons = [\n      {text: 'Cancel', style:'cancel', put: {type: ACTIONS.S_CANCEL_EDIT}},\n      {text: 'OK', style:'default', call: {method: myMethod, args: {name: '', street: ''}},\n  ]\n\n  yield call(alert, 'Error', 'Happy to call alert with callbacks within a generator function', buttons)\n```\n\n## Example 3\n\nIt is also allowed to pass an array of several side effects:\n\n```javascript\n  const buttons = [\n      {text: 'Cancel', style:'cancel', actions:\n        [\n            {put: {type: ACTIONS.S_CANCEL_EDIT}},\n            {call: RouterActions.pop},\n        ],\n      },\n      {text: 'OK', style:'default', call: RouterActions.pop},\n  ]\n\n  yield call(alert, 'Error', 'Foobar message', buttons)\n```\n\nIn this example, the callback-function of the Cancel-button will\nfirst \"yield put\" an action to our reducers and then call the pop()-method\nof the router.\n\nIOS Style Support:\n\n**iOS**\n\nOn iOS you can specify any number of buttons. Each button can optionally specify a style, which is one of\n* default\n* cancel\n* destructive\n\n## Contribution:\n\nContributors are welcome! Feel free to submit pull requests or open [discussions](https://github.com/itinance/redux-saga-rn-alert/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitinance%2Fredux-saga-rn-alert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitinance%2Fredux-saga-rn-alert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitinance%2Fredux-saga-rn-alert/lists"}