Last active
November 23, 2021 23:37
-
-
Save mathias5r/80714c82c73129578e7c5cb0ca73bd69 to your computer and use it in GitHub Desktop.
generic-component-usage.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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