Skip to content

Commit 1db539d

Browse files
committed
remove clear button margin
1 parent 51eafb9 commit 1db539d

5 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/components/Search/SearchAutocompleteInput.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,10 @@ type SearchAutocompleteInputProps = {
5858

5959
/** Any additional styles to apply to text input along with FormHelperMessage */
6060
outerWrapperStyle?: StyleProp<ViewStyle>;
61-
6261
inputStyle?: StyleProp<TextStyle>;
63-
6462
inputContainerStyle?: StyleProp<ViewStyle>;
65-
6663
touchableInputWrapperStyle?: StyleProp<ViewStyle>;
64+
clearButtonStyle?: StyleProp<ViewStyle>;
6765

6866
/** Whether the search reports API call is running */
6967
isSearchingForReports?: boolean;
@@ -96,6 +94,7 @@ function SearchAutocompleteInput({
9694
inputStyle,
9795
inputContainerStyle,
9896
touchableInputWrapperStyle,
97+
clearButtonStyle,
9998
isSearchingForReports,
10099
selection,
101100
substitutionMap,
@@ -222,6 +221,7 @@ function SearchAutocompleteInput({
222221
textInputContainerStyles={[styles.borderNone, styles.pb0, styles.ph3, inputContainerStyle]}
223222
inputStyle={[inputWidth, styles.lineHeightUndefined, inputStyle]}
224223
touchableInputWrapperStyle={touchableInputWrapperStyle}
224+
clearButtonStyle={clearButtonStyle}
225225
placeholderTextColor={theme.textSupporting}
226226
loadingSpinnerStyle={[styles.mt0, styles.mr1, styles.justifyContentCenter]}
227227
onFocus={() => {

src/components/Search/SearchPageHeader/SearchPageInputWide.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ function SearchPageInputWide({queryJSON, handleSearch}: SearchPageInputWideProps
7474
inputStyle={isAutocompleteListVisible ? undefined : styles.fontSizeLabel}
7575
inputContainerStyle={isAutocompleteListVisible ? undefined : styles.ph2}
7676
touchableInputWrapperStyle={isAutocompleteListVisible ? undefined : styles.searchPageInputWideTouchableWrapper}
77+
clearButtonStyle={isAutocompleteListVisible ? undefined : styles.mh0}
7778
onSubmit={() => {
7879
const focusedOption = listRef.current?.getFocusedOption();
7980
if (focusedOption) {

src/components/TextInput/BaseTextInput/implementation/index.native.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ function BaseTextInput({
8080
placeholderTextColor,
8181
onClearInput,
8282
iconContainerStyle,
83+
clearButtonStyle,
8384
shouldUseDefaultLineHeightForPrefix = true,
8485
ref,
8586
sentryLabel,
@@ -452,7 +453,7 @@ function BaseTextInput({
452453
setValue('');
453454
onClearInput?.();
454455
}}
455-
style={[StyleUtils.getTextInputIconContainerStyles(hasLabel, false, verticalPaddingDiff)]}
456+
style={[StyleUtils.getTextInputIconContainerStyles(hasLabel, false, verticalPaddingDiff), clearButtonStyle]}
456457
/>
457458
)}
458459
{!!inputProps.isLoading && !shouldShowClearButton && (

src/components/TextInput/BaseTextInput/implementation/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function BaseTextInput({
8282
placeholderTextColor,
8383
onClearInput,
8484
iconContainerStyle,
85+
clearButtonStyle,
8586
shouldUseDefaultLineHeightForPrefix = true,
8687
ref,
8788
sentryLabel,
@@ -528,7 +529,7 @@ function BaseTextInput({
528529
setValue('');
529530
onClearInput?.();
530531
}}
531-
style={[StyleUtils.getTextInputIconContainerStyles(hasLabel, false, verticalPaddingDiff)]}
532+
style={[StyleUtils.getTextInputIconContainerStyles(hasLabel, false, verticalPaddingDiff), clearButtonStyle]}
532533
sentryLabel={sentryLabel ? `${sentryLabel}-ClearButton` : undefined}
533534
/>
534535
</View>

src/components/TextInput/BaseTextInput/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ type CustomBaseTextInputProps = ForwardedFSClassProps &
165165
/** Style for the icon container */
166166
iconContainerStyle?: StyleProp<ViewStyle>;
167167

168+
/** Style for the clear button */
169+
clearButtonStyle?: StyleProp<ViewStyle>;
170+
168171
/** The width of inner content */
169172
contentWidth?: number;
170173

0 commit comments

Comments
 (0)