Skip to content

Commit 625ec5e

Browse files
authored
Merge pull request #28 from supersimple33/betterGrid
feat: ensuring there are the right number of separators
2 parents 79597fe + a8a88ed commit 625ec5e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/GooglePlacesTextInput.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,13 @@ const GooglePlacesTextInput = forwardRef<
472472
}, 10);
473473
};
474474

475-
const renderSuggestion = ({ item }: { item: PredictionItem }) => {
475+
const renderSuggestion = ({
476+
item,
477+
index,
478+
}: {
479+
item: PredictionItem;
480+
index: number;
481+
}) => {
476482
const { mainText, secondaryText } = item.placePrediction.structuredFormat;
477483

478484
// Safely extract backgroundColor from style
@@ -495,6 +501,7 @@ const GooglePlacesTextInput = forwardRef<
495501
accessibilityLabel={accessibilityLabel}
496502
accessibilityHint="Double tap to select this place"
497503
style={[
504+
index > 0 ? styles.separatorLine : {},
498505
styles.suggestionItem,
499506
{ backgroundColor },
500507
style.suggestionItem,
@@ -698,8 +705,10 @@ const styles = StyleSheet.create({
698705
},
699706
suggestionItem: {
700707
padding: 10,
701-
borderBottomWidth: StyleSheet.hairlineWidth,
702-
borderBottomColor: '#c8c7cc',
708+
},
709+
separatorLine: {
710+
borderTopWidth: StyleSheet.hairlineWidth,
711+
borderTopColor: '#c8c7cc',
703712
},
704713
mainText: {
705714
fontSize: 16,

0 commit comments

Comments
 (0)