Skip to content

Commit c3afaf0

Browse files
committed
update js example
1 parent 0f79940 commit c3afaf0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/rn-tester/js/examples/DragAndDrop/DragAndDropExample.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function DragDropView(): React.Node {
2929
// $FlowFixMe[missing-empty-array-annot]
3030
const [log, setLog] = React.useState([]);
3131
const appendLog = (line: string) => {
32-
const limit = 3;
32+
const limit = 6;
3333
let newLog = log.slice(0, limit - 1);
3434
newLog.unshift(line);
3535
setLog(newLog);
@@ -55,7 +55,13 @@ function DragDropView(): React.Node {
5555
appendLog('onDrop');
5656
setIsDraggingOver(false);
5757
if (e.nativeEvent.dataTransfer.files && e.nativeEvent.dataTransfer.files[0]) {
58-
setImageUri(e.nativeEvent.dataTransfer.files[0].uri);
58+
const file = e.nativeEvent.dataTransfer.files[0];
59+
if (file.type.startsWith('image/')) {
60+
appendLog('Dropped image file: ' + file.name);
61+
} else {
62+
appendLog('Dropped file: ' + file.name);
63+
}
64+
setImageUri(file.uri);
5965
}
6066
}}
6167
style={{

0 commit comments

Comments
 (0)