You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. The component fetches place details immediately when a user selects a place suggestion
278
+
2. The details are attached to the place object passed to your `onPlaceSelect` callback in the `details` property
279
+
3. Use the `detailsFields` prop to specify which fields to include in the response, reducing API costs
280
+
281
+
For a complete list of available fields, see the [Place Details API documentation](https://developers.google.com/maps/documentation/places/web-service/place-details#fieldmask).
282
+
283
+
## Session Tokens and Billing
218
284
219
-
- A session token is automatically generated when the component mounts
220
-
- The same token is used for all autocomplete requests in a session
221
-
- When a place is selected, the token is passed to your `onPlaceSelect` callback
222
-
- Session tokens are automatically reset:
223
-
- After a place is selected
224
-
- When the input is manually cleared using the clear button
225
-
- When the `clear()` method is called programmatically
285
+
This component automatically manages session tokens to optimize your Google Places API billing:
226
286
227
-
**How this reduces costs:**
228
-
When you make a series of autocomplete requests followed by a place details request using the same session token, Google Places API charges you only once for the entire session rather than for each individual request.
287
+
- A session token is generated when the component mounts
288
+
- The same token is automatically used for all autocomplete requests and place details requests
289
+
- The component automatically resets tokens after place selection, input clearing, or calling `clear()`
229
290
230
-
To benefit from this billing optimization:
231
-
1. Use the session token passed to your `onPlaceSelect` handler when making subsequent place details requests
232
-
2. No configuration is required - the feature works automatically
291
+
**Note:** This automatic session token management ensures Google treats your autocomplete and details requests as part of the same session, reducing your billing costs with no additional configuration needed.
233
292
234
293
## Methods
235
294
@@ -283,4 +342,4 @@ MIT
283
342
284
343
Written by Amit Palomo
285
344
286
-
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
345
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
0 commit comments