Skip to content

Instantly share code, notes, and snippets.

@mathias5r
Last active November 23, 2021 23:37
Show Gist options
  • Select an option

  • Save mathias5r/80714c82c73129578e7c5cb0ca73bd69 to your computer and use it in GitHub Desktop.

Select an option

Save mathias5r/80714c82c73129578e7c5cb0ca73bd69 to your computer and use it in GitHub Desktop.
generic-component-usage.tsx
const items = [
{
text: 'item1',
data: {
onPress: () => new Promise.resolve()
},
},
];
const UsingMyList: React.FC = () => (
<MyList<{onPress: (item: MyListItemProps) => Promise<void>}> // declare custom properties
items={items}
onItemSelected={(item: MyListItemProps) => item.data.onPress()} // use custom properties
/>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment