Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update js example
  • Loading branch information
Saadnajmi committed Oct 3, 2025
commit c3afaf04ea8c56c963f57bb557568d5d66d813be
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function DragDropView(): React.Node {
// $FlowFixMe[missing-empty-array-annot]
const [log, setLog] = React.useState([]);
const appendLog = (line: string) => {
const limit = 3;
const limit = 6;
let newLog = log.slice(0, limit - 1);
newLog.unshift(line);
setLog(newLog);
Expand All @@ -55,7 +55,13 @@ function DragDropView(): React.Node {
appendLog('onDrop');
setIsDraggingOver(false);
if (e.nativeEvent.dataTransfer.files && e.nativeEvent.dataTransfer.files[0]) {
setImageUri(e.nativeEvent.dataTransfer.files[0].uri);
const file = e.nativeEvent.dataTransfer.files[0];
if (file.type.startsWith('image/')) {
appendLog('Dropped image file: ' + file.name);
} else {
appendLog('Dropped file: ' + file.name);
}
setImageUri(file.uri);
}
}}
style={{
Expand Down
Loading