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 example
  • Loading branch information
Saadnajmi committed Oct 4, 2025
commit 174c387fba58b28bebcc128d98dda94adbe9e0fc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ function DragDropView(): React.Node {
onDrop={e => {
appendLog('onDrop');
setIsDraggingOver(false);
if (e.nativeEvent.dataTransfer.files && e.nativeEvent.dataTransfer.files[0]) {
const file = e.nativeEvent.dataTransfer.files[0];
const file = e.nativeEvent.dataTransfer?.files?.[0];
if (file) {
if (file.type.startsWith('image/')) {
appendLog('Dropped image file: ' + file.name);
} else {
Expand Down Expand Up @@ -164,7 +164,10 @@ function OnPaste(): React.Node {
style={styles.multiline}
onPaste={(e: PasteEvent) => {
appendLog(JSON.stringify(e.nativeEvent.dataTransfer.types));
setImageUri(e.nativeEvent.dataTransfer.files[0].uri);
const file = e.nativeEvent.dataTransfer?.files?.[0];
if (file) {
setImageUri(file.uri);
}
}}
pastedTypes={['string']}
placeholder="MULTI LINE with onPaste() text from clipboard"
Expand All @@ -174,7 +177,10 @@ function OnPaste(): React.Node {
style={styles.multiline}
onPaste={(e: PasteEvent) => {
appendLog(JSON.stringify(e.nativeEvent.dataTransfer.types));
setImageUri(e.nativeEvent.dataTransfer.files[0].uri);
const file = e.nativeEvent.dataTransfer?.files?.[0];
if (file) {
setImageUri(file.uri);
}
}}
pastedTypes={['fileUrl', 'image', 'string']}
placeholder="MULTI LINE with onPaste() for PNG/TIFF images from clipboard or fileUrl (via Finder) and text from clipboard"
Expand Down
Loading