Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Commit d603e1a

Browse files
committed
Fix state update when editing a track
1 parent 69e61b5 commit d603e1a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

example/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const App = () => {
2121
renderItem={itemInfo => (
2222
<TrackListItem
2323
uri={itemInfo.item.uri}
24-
onSubmitEditing={text => {
24+
onEndEditing={text => {
2525
tracks[itemInfo.index].uri = text;
2626
}}
2727
onDelete={() => {

example/src/TrackListItem.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import { Button, StyleSheet, TextInput, View } from 'react-native';
33

44
interface Props {
55
uri: string;
6-
onSubmitEditing: (text: string) => void;
6+
onEndEditing: (text: string) => void;
77
onDelete: () => void;
88
}
99

10-
export const TrackListItem = ({ uri, onSubmitEditing, onDelete }: Props) => {
10+
export const TrackListItem = ({ uri, onEndEditing, onDelete }: Props) => {
1111
return (
1212
<View style={styles.container}>
1313
<TextInput
1414
style={styles.input}
1515
defaultValue={uri}
16-
onSubmitEditing={e => onSubmitEditing(e.nativeEvent.text)}
16+
onEndEditing={e => onEndEditing(e.nativeEvent.text)}
1717
autoCapitalize='none'
1818
/>
1919
<Button title='Delete' onPress={onDelete} />

0 commit comments

Comments
 (0)