From 0d318f0869aa16eb3ed3a3b311100f450b85d86f Mon Sep 17 00:00:00 2001 From: Cyril Moreau Date: Sat, 16 May 2026 10:49:30 +0100 Subject: [PATCH] feat: add testID prop for E2E testing Adds an optional `testID` prop to GooglePlacesTextInput that is propagated as a suffix to all internal components (container, input wrapper, text input, clear button, loading indicator, suggestions container, suggestions list, and individual suggestion items), enabling reliable selection in E2E tests such as Maestro and Detox. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/ClearButtonAndSpinner.tsx | 4 ++++ src/GooglePlacesTextInput.tsx | 31 ++++++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/ClearButtonAndSpinner.tsx b/src/ClearButtonAndSpinner.tsx index 81e3327..cfe8509 100644 --- a/src/ClearButtonAndSpinner.tsx +++ b/src/ClearButtonAndSpinner.tsx @@ -21,6 +21,7 @@ interface ClearButtonAndSpinnerProps isInputEmpty: boolean; isLoading: boolean; onPress: () => void; + testIDSuffix?: string; } const ClearButtonAndSpinner: React.FC = ({ @@ -32,6 +33,7 @@ const ClearButtonAndSpinner: React.FC = ({ isInputEmpty, onPress, clearElement, + testIDSuffix = '', }) => { // Loading indicator if (isLoading) { @@ -39,6 +41,7 @@ const ClearButtonAndSpinner: React.FC = ({ return ( = ({ // Clear button return ( ([]); const [loading, setLoading] = useState(false); const [inputText, setInputText] = useState(value || ''); @@ -527,6 +536,7 @@ const GooglePlacesTextInput = forwardRef< return ( {secondaryText && ( - + + {/* Render Button and Loader here if is forced RTL */} {isRTL !== isDeviceRTL && ( )} )} {/* Suggestions */} {showSuggestions && predictions.length > 0 && ( - + item.placePrediction.placeId}