{"id":23508640,"url":"https://github.com/landeed/react-native-google-places-sdk","last_synced_at":"2025-04-16T14:39:37.980Z","repository":{"id":199111037,"uuid":"593601344","full_name":"Landeed/react-native-google-places-sdk","owner":"Landeed","description":"Google Places SDK for React Native. Places SDK allows you to build location aware apps that responds contextutally to the local businesses and other places near the user's device.","archived":false,"fork":false,"pushed_at":"2025-01-30T18:53:44.000Z","size":481,"stargazers_count":15,"open_issues_count":1,"forks_count":6,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-23T23:15:23.093Z","etag":null,"topics":["android","google-places-sdk","ios","react-native","typescript"],"latest_commit_sha":null,"homepage":"","language":"Java","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/Landeed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-26T12:21:35.000Z","updated_at":"2025-03-16T00:48:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"d6db101a-d596-451a-bb0c-e87e25d48aaa","html_url":"https://github.com/Landeed/react-native-google-places-sdk","commit_stats":null,"previous_names":["landeed/react-native-google-places-sdk"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Landeed%2Freact-native-google-places-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Landeed%2Freact-native-google-places-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Landeed%2Freact-native-google-places-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Landeed%2Freact-native-google-places-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Landeed","download_url":"https://codeload.github.com/Landeed/react-native-google-places-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249250939,"owners_count":21237965,"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":["android","google-places-sdk","ios","react-native","typescript"],"created_at":"2024-12-25T11:25:23.109Z","updated_at":"2025-04-16T14:39:37.945Z","avatar_url":"https://github.com/Landeed.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![image (9)](https://github.com/user-attachments/assets/8e6e7b15-ee07-46fd-be01-1aee7393b7a7)](https://www.ycombinator.com/companies/landeed/jobs/1RGlF1W-founding-fullstack-engineer-react-react-native-any-backend-india)\n\n\n\n# Google Places SDK for React Native\n\nGoogle Places SDK for React Native. Places SDK allows you to build location aware apps that responds contextutally to the local businesses and other places near the user's device.\n\n[![CI](https://github.com/Kroniac/react-native-google-places-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/Kroniac/react-native-google-places-sdk/actions/workflows/ci.yml)\n[![Licence](https://img.shields.io/github/license/Kroniac/react-native-google-places-sdk)](https://opensource.org/licenses/MIT)\n\n## Table of contents\n\n- [Requirements](#requirements)\n  - [Minimum Platform Version](#minimum-platform-version)\n  - [Google Places API Key](#google-places-api-key)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Initialize SDK](#initialize-sdk)\n    - [Initialize SDK](#initialize-sdk)\n  - [Fetch Predictions](#fetch-predictions)\n    - [Sample Implementation](#sample-implementation)\n  - [Fetch Place By ID](#fetch-place-by-id)\n    - [Sample Implementation](#sample-implementation-1)\n- [Contributing](#contributing)\n- [Licence](#license)\n\n## Requirements\n\n### Minimum Platform Version\n\n- Android: 21\n- iOS: 13\n\n### Google Places API Key\n\n- [Get Android API Key](https://developers.google.com/maps/documentation/places/android-sdk/get-api-key)\n- [Get iOS API Key](https://developers.google.com/maps/documentation/places/ios-sdk/get-api-key)\n\n## Installation\n\n```sh\nnpm install react-native-google-places-sdk\n#OR\nyarn add react-native-google-places-sdk\n```\n\n## Usage\n\n### Initialize SDK\n\n#### initialize(apiKey: string): void\n\nSDK needs to be initialize only once per App start before using any other functions. Preferably in the root file, e.g., App.tsx.\n\n```ts\nimport GooglePlacesSDK from 'react-native-google-places-sdk';\n\nconst GOOGLE_PLACES_API_KEY = \"\"; // add your Places API key\nGooglePlacesSDK.initialize(GOOGLE_PLACES_API_KEY);\n```\n\n### Fetch Predictions\n\n#### fetchPredictions(query: string, filters?: PredictionFiltersParam): Promise\u003cPlacePrediction[]\u003e\n\n#### PredictionFiltersParams\n\n```ts\ntype PredictionFiltersParam = {\n  types?: string[];\n  countries?: string[];\n  locationBias?: LocationBounds;\n  locationRestriction?: LocationBounds;\n  origin?: LatLng;\n};\n```\n\n#### PlacePrediction\n\n```ts\ntype PlacePrediction = {\n  description: string;\n  placeID: string;\n  primaryText: string;\n  secondaryText: string;\n  types: string[];\n  distanceMeters: number;\n}\n```\n\n#### Sample Output\n\n```json\n{\n  \"description\": \"Mumbai, Maharashtra, India\",\n  \"distanceMeters\": null,\n  \"placeID\": \"ChIJwe1EZjDG5zsRaYxkjY_tpF0\",\n  \"primaryText\": \"Mumbai\",\n  \"secondaryText\": \"Maharashtra, India\",\n  \"types\": [\n    \"locality\",\n    \"political\",\n    \"geocode\"\n  ]\n}\n```\n\n#### Sample Implementation\n\n```ts\nimport GooglePlacesSDK, { PLACE_FIELDS } from 'react-native-google-places-sdk';\n\nGooglePlacesSDK.fetchPredictions(\n  \"Mumbai\", // query\n  { countries: [\"in\", \"us\"] } // filters\n)\n  .then((predictions) =\u003e console.log(predictions));\n  .catch((error) =\u003e console.log(error));\n\n// ...\n```\n\n### Fetch Place By ID\n\n#### fetchPlaceByID(placeID: string, fields?: FieldsParam): Promise\\\u003cPlace\\\u003e\n\n#### FieldsParam\n\n- Allowed Fields: Refer PLACE_FIELDS in 'react-native-google-sdk'\n\n- If no fields or empty array is passed, then all fields will be fetched for given the place ID.\n\n```ts\n// type\nstring[]\n\n// Example\nimport { PLACE_FIELDS } from 'react-native-google-places-sdk';\n\nconst fields = [PLACE_FIELDS.NAME, PLACE_FIELDS.PLACE_ID, PLACE_FIELDS.ADDRESS_COMPONENTS]\n```\n\n#### Place\n\n```ts\ntype Place = {\n  name: string | null;\n  placeID: string | null;\n  plusCode: string | null;\n  coordinate: LatLng | null;\n  openingHours: string | null;\n  phoneNumber: string | null;\n  types: string[] | null;\n  priceLevel: number | null;\n  website: string | null;\n  viewport: (LocationBounds \u0026 { valid: boolean }) | null;\n  formattedAddress: string | null;\n  addressComponents:\n    | {\n        types: string[];\n        name: string;\n        shortName: string;\n      }[]\n    | null;\n  attributions: string | null;\n  rating: number;\n  userRatingsTotal: number;\n  utcOffsetMinutes: number | null;\n  iconImageURL: string | null;\n  businessStatus: BusinessStatus;\n  dineIn: AtmosphereCategoryStatus;\n  takeout: AtmosphereCategoryStatus;\n  delivery: AtmosphereCategoryStatus;\n  curbsidePickup: AtmosphereCategoryStatus;\n  photos: {\n    attributions: {\n      url: string;\n      name: string;\n    };\n    reference: string;\n    width: number;\n    height: number;\n  }[];\n};\n```\n\n#### Sample Implementation\n\n```ts\nimport GooglePlacesSDK, { PLACE_FIELDS } from 'react-native-google-places-sdk';\n\nGooglePlacesSDK.fetchPlaceByID(\n  placeID = \"ChIJwe1EZjDG5zsRaYxkjY_tpF0\",\n  fields = [PLACE_FIELDS.NAME, PLACE_FIELDS.TYPES]\n)\n  .then((place) =\u003e console.log(place));\n  .catch((error) =\u003e console.log(error));\n// ...\n```\n\n## Example Project\n\n\n## Contributing\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flandeed%2Freact-native-google-places-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flandeed%2Freact-native-google-places-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flandeed%2Freact-native-google-places-sdk/lists"}