Open AlyonaPianykh opened 7 years ago
@OlenaPianykh Thank you for opening this issue. I can see this feature is useful to other users too. I will add this feature. If you are interested, feel free to work on it and submit a PR too 👍
Resurrecting this. I need this feature as well, so I went ahead and created the PR. The payload is coming from google so it just needed to be included in the component state.
I left a comment on the PR and will merge once resolved! Hope you're still interested :)
Hello!
I'm using your component and I need to highlight matching parts of predictions and user's input string. As I know, in predictions set, returned by request, there is property 'matched_substrings' with the set of matches' length and offset. Is it possible to add this property both to autocompleteItems and to formattedSuggestion, so it is possible to access matches through "render" using "autocompleteItem" property?
Or even do like this: const formattedSuggestion = (structured_formatting) => ({ mainText: structured_formatting.main_text, secondaryText: structured_formatting.secondary_text, mainTextMatchedSubstrings: structured_formatting.main_text_matched_substrings, secondaryTextMatchedSubstrings: structured_formatting.secondary_text_matched_substrings });
main_text_matched_substrings and secondary_text_matched_substrings are contained in the structured_formatting of prediction, so it is possible to add it exactly to formatting function