{"id":13452035,"url":"https://github.com/slorber/react-native-alert-async","last_synced_at":"2025-04-15T11:50:37.492Z","repository":{"id":57335081,"uuid":"158263566","full_name":"slorber/react-native-alert-async","owner":"slorber","description":"An Alert.alert that you can await ","archived":false,"fork":false,"pushed_at":"2020-01-03T15:19:58.000Z","size":8,"stargazers_count":50,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T19:44:47.499Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://sebastienlorber.com","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/slorber.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":"2018-11-19T17:16:45.000Z","updated_at":"2024-12-07T01:10:58.000Z","dependencies_parsed_at":"2022-09-01T14:01:46.240Z","dependency_job_id":null,"html_url":"https://github.com/slorber/react-native-alert-async","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slorber%2Freact-native-alert-async","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slorber%2Freact-native-alert-async/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slorber%2Freact-native-alert-async/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slorber%2Freact-native-alert-async/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slorber","download_url":"https://codeload.github.com/slorber/react-native-alert-async/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249067153,"owners_count":21207392,"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":[],"created_at":"2024-07-31T07:01:10.823Z","updated_at":"2025-04-15T11:50:37.472Z","avatar_url":"https://github.com/slorber.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# react-native-alert-async\n\nAn Alert.alert() that you can await \n\n```jsx\nimport AlertAsync from \"react-native-alert-async\";\n\nconst myAction = async () =\u003e {\n\n  const choice = await AlertAsync(\n    'Title',\n    'Message',\n    [\n      {text: 'Yes', onPress: () =\u003e 'yes'},\n      {text: 'No', onPress: () =\u003e Promise.resolve('no')},\n    ],\n    {\n      cancelable: true,\n      onDismiss: () =\u003e 'no',\n    },\n  );\n\n  if (choice === 'yes') {\n    await doSomething();\n  }\n  else {\n    await doSomethingElse();\n  }\n}\n```\n\nIt always returns a promise, and that promise is guaranteed to resolve after the user made his choice.\n\nIt's just a wrapper around the original RN API so it's very tiny and does not require native code/linking, and is compatible with Expo.\n\n\nThere is an existing [RN PR](https://github.com/facebook/react-native/pull/20312) waiting to be merged with this feature. In the meantime you can use this package.\nI use this in production for a long time and it's reliable.\n\n# Hire a freelance expert\n\nLooking for a React/ReactNative freelance expert with more than 5 years production experience?\nContact me from my [website](https://sebastienlorber.com/) or with [Twitter](https://twitter.com/sebastienlorber).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslorber%2Freact-native-alert-async","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslorber%2Freact-native-alert-async","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslorber%2Freact-native-alert-async/lists"}