Skip to content

Commit

Permalink
Trim before searching. Fixes danish1658#124
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavberi committed Sep 4, 2024
1 parent f4f01ab commit 2e4f6dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions components/MultipleSelectList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ const MultipleSelectList: React.FC<MultipleSelectListProps> = ({

<TextInput
placeholder={searchPlaceholder}
onChangeText={(val) => {
let result = data.filter((item: L1Keys) => {
val.toLowerCase();
let row = item.value.toLowerCase()
return row.search(val.toLowerCase()) > -1;
onChangeText={(val: String) => {
let result = data.filter((item: L1Keys) => {
let valLower = val.toLowerCase().trim();
let row = item.value.toLowerCase().trim();
return row.includes(valLower);
});
setFilteredData(result)
}}
Expand Down
12 changes: 6 additions & 6 deletions components/SelectList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ const SelectList: React.FC<SelectListProps> = ({

<TextInput
placeholder={searchPlaceholder}
onChangeText={(val) => {
let result = data.filter((item: L1Keys) => {
val.toLowerCase();
let row = item.value.toLowerCase()
return row.search(val.toLowerCase()) > -1;
onChangeText={(val: String) => {
let result = data.filter((item: L1Keys) => {
let valLower = val.toLowerCase().trim();
let row = item.value.toLowerCase().trim();
return row.includes(valLower);
});
setFilteredData(result)
setFilteredData(result);
}}
style={[{padding:0,height:20,flex:1,fontFamily},inputStyles]}
/>
Expand Down

0 comments on commit 2e4f6dc

Please sign in to comment.