Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
fix(templates): wrap React InstantSearch Hooks native hit attributes …
Browse files Browse the repository at this point in the history
…in `Fragment` (#578)
  • Loading branch information
dhayab authored Aug 23, 2022
1 parent 01e760b commit da7b811
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
14 changes: 8 additions & 6 deletions e2e/__snapshots__/templates.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6235,12 +6235,14 @@ type HitProps = {
function Hit({ hit }: HitProps) {
return (
<Text>
<Highlight hit={hit} attribute=\\"attribute1\\" />
</Text>
<Text>
<Highlight hit={hit} attribute=\\"attribute2\\" />
</Text>
<>
<Text>
<Highlight hit={hit} attribute=\\"attribute1\\" />
</Text>
<Text>
<Highlight hit={hit} attribute=\\"attribute2\\" />
</Text>
</>
);
}
Expand Down
30 changes: 16 additions & 14 deletions src/templates/React InstantSearch Hooks Native/App.tsx.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,22 @@ type HitProps = {

function Hit({ hit }: HitProps) {
return (
{{#if attributesToDisplay}}
<Text>
<Highlight hit={hit} attribute="{{attributesToDisplay.[0]}}" />
</Text>
{{#each attributesToDisplay}}
{{#unless @first}}
<Text>
<Highlight hit={hit} attribute="{{this}}" />
</Text>
{{/unless}}
{{/each}}
{{else}}
<Text>{JSON.stringify(hit).slice(0, 100)}</Text>
{{/if}}
<>
{{#if attributesToDisplay}}
<Text>
<Highlight hit={hit} attribute="{{attributesToDisplay.[0]}}" />
</Text>
{{#each attributesToDisplay}}
{{#unless @first}}
<Text>
<Highlight hit={hit} attribute="{{this}}" />
</Text>
{{/unless}}
{{/each}}
{{else}}
<Text>{JSON.stringify(hit).slice(0, 100)}</Text>
{{/if}}
</>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@babel/core": "^7.12.9",
"@types/react": "~17.0.21",
"@types/react-native": "~0.64.12",
"expo-cli": "5.1.1",
"expo-cli": "5.5.1",
"typescript": "~4.3.5"
}
}

0 comments on commit da7b811

Please sign in to comment.