Skip to content

onBlur time out & onPressIn handler #37

@jeroenvlek

Description

@jeroenvlek

Before submitting

  • I tested using the latest version
  • I checked for duplicate issues
  • I have enabled enableDebug={true} prop and included console logs below

Platform

Android

Versions

0.9.1

Bug summary

I can't select any suggestions on my Android emulator or phone. My suspicion is that that the onBlur timeout happens too fast (10 ms). This is the component:

<GooglePlacesTextInput
                                    proxyUrl={serviceUrls.placesService}
                                    placeHolderText="Course name or location"
                                    apiKey="Will be replaced in the proxy"
                                    types={['golf_course']}
                                    value={localQuery}
                                    onPlaceSelect={handlePlaceSelect}
                                    onTextChange={handleTextChange}
                                    style={googlePlacesStyles}
                                    minCharsToFetch={2}
                                    debounceDelay={300}
                                    autoCapitalize="none"
                                    autoCorrect={false}
                                    hideOnKeyboardDismiss={false}
                                    enableDebug={true}
                                    scrollEnabled={false}
                                    nestedScrollEnabled={false}
                                />

const googlePlacesStyles: GooglePlacesTextInputStyles = {
        container: {
            marginBottom: 16,
            zIndex: 10,
        },
        input: {
            flex: 0,
            borderRadius: 10,
            backgroundColor: colors.cardBackground,
            color: colors.text,
            borderWidth: 0,
            fontSize: 16
        },
        placeholder: {
            color: colors.textSecondary,
        },
        suggestionsContainer: {
            backgroundColor: colors.modalBackground,
            borderRadius: 10,
            marginTop: 4,
            maxHeight: 250,
            borderWidth: 1,
            borderColor: colors.borderTertiary,
            zIndex: 10,
        },
        suggestionItem: {
            backgroundColor: colors.modalBackground,
            padding: 12,
            borderTopWidth: StyleSheet.hairlineWidth,
            borderTopColor: colors.borderTertiary,
            zIndex: 11,
        },
        suggestionText: {
            main: {color: colors.textPrimary},
            secondary: {color: colors.textSecondary},
        },
    };

I see that there is already a fix for web with onMouseDown. I was able to properly select suggestions locally be increasing the timeout to 1000 ms and by adding this to renderSuggestion:

onPressIn: () => {
        suggestionPressing.current = true;
      },

A 1 sec timeout is probably too much, but 10 ms is definitely too slow. Unless I'm missing something else, of course. Happy to provide this fix, but is it the right direction?

Debug logs (with enableDebug={true})

LOG  [GooglePlacesTextInput:INIT] 2025-11-18T10:05:27.341Z - Component initialized with props
 LOG  [GooglePlacesTextInput:INIT] Data: {"apiKey": "[PROVIDED]", "debounceDelay": 300, "detailsFields": [], "detailsProxyUrl": null, "fetchDetails": false, "minCharsToFetch": 2, "platform": "android"}
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:36.184Z - Starting fetch for text: "a"
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:36.185Z - Request params
 LOG  [GooglePlacesTextInput:PREDICTIONS] Data: {"apiKey": "[PROVIDED]", "includedRegionCodes": undefined, "languageCode": undefined, "locationBias": undefined, "locationRestriction": undefined, "minCharsToFetch": 2, "proxyHeaders": null, "proxyUrl": "https://places.dev.teeup.club/v1/places:autocomplete", "sessionToken": "0bb27413-f2bf-4c8a-bdac-added9ce7fc7", "text": "a", "types": ["golf_course"]}
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:36.186Z - Text too short (1 < 2)
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:36.567Z - Starting fetch for text: "ams"
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:36.567Z - Request params
 LOG  [GooglePlacesTextInput:PREDICTIONS] Data: {"apiKey": "[PROVIDED]", "includedRegionCodes": undefined, "languageCode": undefined, "locationBias": undefined, "locationRestriction": undefined, "minCharsToFetch": 2, "proxyHeaders": null, "proxyUrl": "https://places.dev.teeup.club/v1/places:autocomplete", "sessionToken": "0bb27413-f2bf-4c8a-bdac-added9ce7fc7", "text": "ams", "types": ["golf_course"]}
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:36.785Z - Success: 5 predictions received
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:36.785Z - Predictions data
 LOG  [GooglePlacesTextInput:PREDICTIONS] Data: [{"placePrediction": {"place": "places/ChIJYcyLUDFg3okRgaLAHeBwXpo", "placeId": "ChIJYcyLUDFg3okRgaLAHeBwXpo", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJJ2TDtb8KxkcRCfiQanlriDQ", "placeId": "ChIJJ2TDtb8KxkcRCfiQanlriDQ", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJUf2PpFEtuEwRo3LrUxjcggI", "placeId": "ChIJUf2PpFEtuEwRo3LrUxjcggI", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJfU4RnZIIxkcRnUxJ55948wM", "placeId": "ChIJfU4RnZIIxkcRnUxJ55948wM", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJfU4RnZIIxkcRxA4oftXeBFY", "placeId": "ChIJfU4RnZIIxkcRxA4oftXeBFY", "structuredFormat": [Object], "text": [Object], "types": [Array]}}]
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:40.520Z - Starting fetch for text: "ams"
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:40.520Z - Request params
 LOG  [GooglePlacesTextInput:PREDICTIONS] Data: {"apiKey": "[PROVIDED]", "includedRegionCodes": undefined, "languageCode": undefined, "locationBias": undefined, "locationRestriction": undefined, "minCharsToFetch": 2, "proxyHeaders": null, "proxyUrl": "https://places.dev.teeup.club/v1/places:autocomplete", "sessionToken": "0bb27413-f2bf-4c8a-bdac-added9ce7fc7", "text": "ams", "types": ["golf_course"]}
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:40.601Z - Success: 5 predictions received
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:40.601Z - Predictions data
 LOG  [GooglePlacesTextInput:PREDICTIONS] Data: [{"placePrediction": {"place": "places/ChIJYcyLUDFg3okRgaLAHeBwXpo", "placeId": "ChIJYcyLUDFg3okRgaLAHeBwXpo", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJJ2TDtb8KxkcRCfiQanlriDQ", "placeId": "ChIJJ2TDtb8KxkcRCfiQanlriDQ", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJUf2PpFEtuEwRo3LrUxjcggI", "placeId": "ChIJUf2PpFEtuEwRo3LrUxjcggI", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJfU4RnZIIxkcRnUxJ55948wM", "placeId": "ChIJfU4RnZIIxkcRnUxJ55948wM", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJfU4RnZIIxkcRxA4oftXeBFY", "placeId": "ChIJfU4RnZIIxkcRxA4oftXeBFY", "structuredFormat": [Object], "text": [Object], "types": [Array]}}]
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:42.851Z - Starting fetch for text: "ams"
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:42.851Z - Request params
 LOG  [GooglePlacesTextInput:PREDICTIONS] Data: {"apiKey": "[PROVIDED]", "includedRegionCodes": undefined, "languageCode": undefined, "locationBias": undefined, "locationRestriction": undefined, "minCharsToFetch": 2, "proxyHeaders": null, "proxyUrl": "https://places.dev.teeup.club/v1/places:autocomplete", "sessionToken": "0bb27413-f2bf-4c8a-bdac-added9ce7fc7", "text": "ams", "types": ["golf_course"]}
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:43.001Z - Success: 5 predictions received
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:43.001Z - Predictions data
 LOG  [GooglePlacesTextInput:PREDICTIONS] Data: [{"placePrediction": {"place": "places/ChIJYcyLUDFg3okRgaLAHeBwXpo", "placeId": "ChIJYcyLUDFg3okRgaLAHeBwXpo", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJJ2TDtb8KxkcRCfiQanlriDQ", "placeId": "ChIJJ2TDtb8KxkcRCfiQanlriDQ", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJUf2PpFEtuEwRo3LrUxjcggI", "placeId": "ChIJUf2PpFEtuEwRo3LrUxjcggI", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJfU4RnZIIxkcRnUxJ55948wM", "placeId": "ChIJfU4RnZIIxkcRnUxJ55948wM", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJfU4RnZIIxkcRxA4oftXeBFY", "placeId": "ChIJfU4RnZIIxkcRxA4oftXeBFY", "structuredFormat": [Object], "text": [Object], "types": [Array]}}]
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:45.317Z - Starting fetch for text: "ams"
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:45.318Z - Request params
 LOG  [GooglePlacesTextInput:PREDICTIONS] Data: {"apiKey": "[PROVIDED]", "includedRegionCodes": undefined, "languageCode": undefined, "locationBias": undefined, "locationRestriction": undefined, "minCharsToFetch": 2, "proxyHeaders": null, "proxyUrl": "https://places.dev.teeup.club/v1/places:autocomplete", "sessionToken": "0bb27413-f2bf-4c8a-bdac-added9ce7fc7", "text": "ams", "types": ["golf_course"]}
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:45.501Z - Success: 5 predictions received
 LOG  [GooglePlacesTextInput:PREDICTIONS] 2025-11-18T10:05:45.501Z - Predictions data
 LOG  [GooglePlacesTextInput:PREDICTIONS] Data: [{"placePrediction": {"place": "places/ChIJYcyLUDFg3okRgaLAHeBwXpo", "placeId": "ChIJYcyLUDFg3okRgaLAHeBwXpo", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJJ2TDtb8KxkcRCfiQanlriDQ", "placeId": "ChIJJ2TDtb8KxkcRCfiQanlriDQ", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJUf2PpFEtuEwRo3LrUxjcggI", "placeId": "ChIJUf2PpFEtuEwRo3LrUxjcggI", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJfU4RnZIIxkcRnUxJ55948wM", "placeId": "ChIJfU4RnZIIxkcRnUxJ55948wM", "structuredFormat": [Object], "text": [Object], "types": [Array]}}, {"placePrediction": {"place": "places/ChIJfU4RnZIIxkcRxA4oftXeBFY", "placeId": "ChIJfU4RnZIIxkcRxA4oftXeBFY", "structuredFormat": [Object], "text": [Object], "types": [Array]}}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions