({ id })
| 55 | |
| 56 | // A single todo component, either 'not done' or 'done': press to toggle. |
| 57 | const Todo = ({ id }) => { |
| 58 | const { text, done } = useRow(TODO_TABLE, id); |
| 59 | const handlePress = useSetCellCallback( |
| 60 | TODO_TABLE, |
| 61 | id, |
| 62 | DONE_CELL, |
| 63 | () => (done) => !done |
| 64 | ); |
| 65 | return ( |
| 66 | <TouchableOpacity |
| 67 | key={id} |
| 68 | onPress={handlePress} |
| 69 | style={[styles.todo, done ? styles.done : null]} |
| 70 | > |
| 71 | <Text style={styles.todoText}> |
| 72 | {done ? DONE_ICON : NOT_DONE_ICON} {text} |
| 73 | </Text> |
| 74 | </TouchableOpacity> |
| 75 | ); |
| 76 | }; |
| 77 | |
| 78 | // A list component to show all the todos. |
| 79 | const Todos = () => { |
nothing calls this directly
no outgoing calls
no test coverage detected