Skip to content

Commit 7bacbb5

Browse files
committed
wip - working version of context menu
1 parent 7d12d59 commit 7bacbb5

File tree

97 files changed

+32176
-99
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+32176
-99
lines changed

apps/sandbox/app.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"backgroundColor": "#ffffff"
1414
},
1515
"ios": {
16-
"supportsTablet": true
16+
"supportsTablet": true,
17+
"bundleIdentifier": "com.uwalk.sandbox"
1718
},
1819
"android": {
1920
"adaptiveIcon": {

apps/sandbox/app/preview/context-menu.tsx

Lines changed: 193 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
11
import { Stack } from "expo-router";
22
import { View, Text } from "@native-ui-org/primitives";
3+
// Test direct import
4+
try {
5+
const contextMenuModule = require("@native-ui-org/context-menu");
6+
console.log('PREVIEW: ContextMenu module loaded:', Object.keys(contextMenuModule));
7+
} catch (error) {
8+
console.error('PREVIEW: Error loading ContextMenu module:', error);
9+
}
10+
311
import {
412
ContextMenu,
513
ContextMenuTrigger,
614
ContextMenuContent,
715
ContextMenuItem,
816
ContextMenuSeparator
9-
} from "@native-ui-org/primitives";
17+
} from "@native-ui-org/context-menu";
1018
import { StyleSheet, Platform, ScrollView, Alert } from "react-native";
1119
import React from "react";
1220

1321
export default function ContextMenuPreview() {
22+
// Debug platform
23+
React.useEffect(() => {
24+
console.log('PREVIEW: Platform.OS =', Platform.OS);
25+
console.log('PREVIEW: typeof window =', typeof window);
26+
console.log('PREVIEW: typeof document =', typeof document);
27+
console.log('PREVIEW: navigator.userAgent =', typeof navigator !== 'undefined' ? navigator.userAgent : 'no navigator');
28+
}, []);
29+
1430
const handleShare = () => {
1531
console.log("Share clicked!");
1632
Alert.alert("Share", "Chat shared!");
@@ -79,20 +95,46 @@ export default function ContextMenuPreview() {
7995
</ContextMenuTrigger>
8096

8197
<ContextMenuContent>
82-
<ContextMenuItem onPress={handleShare}>
83-
<Text>Share</Text>
98+
<ContextMenuItem
99+
onPress={handleShare}
100+
iosIcon="square.and.arrow.up"
101+
androidIcon="share"
102+
icon="📤"
103+
>
104+
<Text>Share chat</Text>
84105
</ContextMenuItem>
85-
<ContextMenuItem onPress={handleRename}>
106+
<ContextMenuItem
107+
onPress={handleRename}
108+
iosIcon="pencil"
109+
androidIcon="edit"
110+
icon="✏️"
111+
>
86112
<Text>Rename</Text>
87113
</ContextMenuItem>
88-
<ContextMenuItem onPress={handleArchive}>
114+
<ContextMenuItem
115+
onPress={handleArchive}
116+
iosIcon="archivebox"
117+
androidIcon="archive"
118+
icon="📦"
119+
>
89120
<Text>Archive</Text>
90121
</ContextMenuItem>
91-
<ContextMenuItem onPress={handleExport}>
122+
<ContextMenuItem
123+
onPress={handleExport}
124+
iosIcon="square.and.arrow.down"
125+
androidIcon="download"
126+
icon="💾"
127+
>
92128
<Text>Export</Text>
93129
</ContextMenuItem>
94130
<ContextMenuSeparator />
95-
<ContextMenuItem onPress={handleDelete} destructive>
131+
<ContextMenuItem
132+
onPress={handleDelete}
133+
destructive
134+
iosIcon="trash"
135+
androidIcon="delete"
136+
icon="🗑️"
137+
>
96138
<Text>Delete</Text>
97139
</ContextMenuItem>
98140
</ContextMenuContent>
@@ -112,20 +154,46 @@ export default function ContextMenuPreview() {
112154
</ContextMenuTrigger>
113155

114156
<ContextMenuContent>
115-
<ContextMenuItem onPress={handleShare}>
116-
<Text>Share</Text>
157+
<ContextMenuItem
158+
onPress={handleShare}
159+
iosIcon="square.and.arrow.up"
160+
androidIcon="share"
161+
icon="📤"
162+
>
163+
<Text>Share chat</Text>
117164
</ContextMenuItem>
118-
<ContextMenuItem onPress={handleRename}>
165+
<ContextMenuItem
166+
onPress={handleRename}
167+
iosIcon="pencil"
168+
androidIcon="edit"
169+
icon="✏️"
170+
>
119171
<Text>Rename</Text>
120172
</ContextMenuItem>
121-
<ContextMenuItem onPress={handleArchive}>
173+
<ContextMenuItem
174+
onPress={handleArchive}
175+
iosIcon="archivebox"
176+
androidIcon="archive"
177+
icon="📦"
178+
>
122179
<Text>Archive</Text>
123180
</ContextMenuItem>
124-
<ContextMenuItem onPress={handleExport}>
181+
<ContextMenuItem
182+
onPress={handleExport}
183+
iosIcon="square.and.arrow.down"
184+
androidIcon="download"
185+
icon="💾"
186+
>
125187
<Text>Export</Text>
126188
</ContextMenuItem>
127189
<ContextMenuSeparator />
128-
<ContextMenuItem onPress={handleDelete} destructive>
190+
<ContextMenuItem
191+
onPress={handleDelete}
192+
destructive
193+
iosIcon="trash"
194+
androidIcon="delete"
195+
icon="🗑️"
196+
>
129197
<Text>Delete</Text>
130198
</ContextMenuItem>
131199
</ContextMenuContent>
@@ -145,20 +213,46 @@ export default function ContextMenuPreview() {
145213
</ContextMenuTrigger>
146214

147215
<ContextMenuContent>
148-
<ContextMenuItem onPress={handleShare}>
149-
<Text>Share</Text>
216+
<ContextMenuItem
217+
onPress={handleShare}
218+
iosIcon="square.and.arrow.up"
219+
androidIcon="share"
220+
icon="📤"
221+
>
222+
<Text>Share chat</Text>
150223
</ContextMenuItem>
151-
<ContextMenuItem onPress={handleRename}>
224+
<ContextMenuItem
225+
onPress={handleRename}
226+
iosIcon="pencil"
227+
androidIcon="edit"
228+
icon="✏️"
229+
>
152230
<Text>Rename</Text>
153231
</ContextMenuItem>
154-
<ContextMenuItem onPress={handleArchive}>
232+
<ContextMenuItem
233+
onPress={handleArchive}
234+
iosIcon="archivebox"
235+
androidIcon="archive"
236+
icon="📦"
237+
>
155238
<Text>Archive</Text>
156239
</ContextMenuItem>
157-
<ContextMenuItem onPress={handleExport}>
240+
<ContextMenuItem
241+
onPress={handleExport}
242+
iosIcon="square.and.arrow.down"
243+
androidIcon="download"
244+
icon="💾"
245+
>
158246
<Text>Export</Text>
159247
</ContextMenuItem>
160248
<ContextMenuSeparator />
161-
<ContextMenuItem onPress={handleDelete} destructive>
249+
<ContextMenuItem
250+
onPress={handleDelete}
251+
destructive
252+
iosIcon="trash"
253+
androidIcon="delete"
254+
icon="🗑️"
255+
>
162256
<Text>Delete</Text>
163257
</ContextMenuItem>
164258
</ContextMenuContent>
@@ -182,24 +276,55 @@ export default function ContextMenuPreview() {
182276
</ContextMenuTrigger>
183277

184278
<ContextMenuContent>
185-
<ContextMenuItem onPress={() => Alert.alert("Open", "Opening document.pdf")}>
279+
<ContextMenuItem
280+
onPress={() => Alert.alert("Open", "Opening document.pdf")}
281+
iosIcon="doc"
282+
androidIcon="document"
283+
icon="📄"
284+
>
186285
<Text>Open</Text>
187286
</ContextMenuItem>
188-
<ContextMenuItem onPress={() => Alert.alert("Download", "Downloading document.pdf")}>
287+
<ContextMenuItem
288+
onPress={() => Alert.alert("Download", "Downloading document.pdf")}
289+
iosIcon="square.and.arrow.down"
290+
androidIcon="download"
291+
icon="⬇️"
292+
>
189293
<Text>Download</Text>
190294
</ContextMenuItem>
191-
<ContextMenuItem onPress={() => Alert.alert("Copy", "Copied document.pdf")}>
295+
<ContextMenuItem
296+
onPress={() => Alert.alert("Copy", "Copied document.pdf")}
297+
iosIcon="doc.on.doc"
298+
androidIcon="copy"
299+
icon="📋"
300+
>
192301
<Text>Copy</Text>
193302
</ContextMenuItem>
194303
<ContextMenuSeparator />
195-
<ContextMenuItem onPress={() => Alert.alert("Rename", "Renaming document.pdf")}>
304+
<ContextMenuItem
305+
onPress={() => Alert.alert("Rename", "Renaming document.pdf")}
306+
iosIcon="pencil"
307+
androidIcon="edit"
308+
icon="✏️"
309+
>
196310
<Text>Rename</Text>
197311
</ContextMenuItem>
198-
<ContextMenuItem onPress={() => Alert.alert("Move", "Moving document.pdf")}>
312+
<ContextMenuItem
313+
onPress={() => Alert.alert("Move", "Moving document.pdf")}
314+
iosIcon="arrow.up.arrow.down"
315+
androidIcon="move"
316+
icon="📁"
317+
>
199318
<Text>Move</Text>
200319
</ContextMenuItem>
201320
<ContextMenuSeparator />
202-
<ContextMenuItem onPress={() => Alert.alert("Delete", "Deleting document.pdf")} destructive>
321+
<ContextMenuItem
322+
onPress={() => Alert.alert("Delete", "Deleting document.pdf")}
323+
destructive
324+
iosIcon="trash"
325+
androidIcon="delete"
326+
icon="🗑️"
327+
>
203328
<Text>Delete</Text>
204329
</ContextMenuItem>
205330
</ContextMenuContent>
@@ -214,24 +339,55 @@ export default function ContextMenuPreview() {
214339
</ContextMenuTrigger>
215340

216341
<ContextMenuContent>
217-
<ContextMenuItem onPress={() => Alert.alert("Open", "Opening Projects folder")}>
342+
<ContextMenuItem
343+
onPress={() => Alert.alert("Open", "Opening Projects folder")}
344+
iosIcon="folder"
345+
androidIcon="folder"
346+
icon="📁"
347+
>
218348
<Text>Open</Text>
219349
</ContextMenuItem>
220-
<ContextMenuItem onPress={() => Alert.alert("New File", "Creating new file in Projects")}>
350+
<ContextMenuItem
351+
onPress={() => Alert.alert("New File", "Creating new file in Projects")}
352+
iosIcon="doc.badge.plus"
353+
androidIcon="document"
354+
icon="📄"
355+
>
221356
<Text>New File</Text>
222357
</ContextMenuItem>
223-
<ContextMenuItem onPress={() => Alert.alert("New Folder", "Creating new folder in Projects")}>
358+
<ContextMenuItem
359+
onPress={() => Alert.alert("New Folder", "Creating new folder in Projects")}
360+
iosIcon="folder.badge.plus"
361+
androidIcon="folder"
362+
icon="📁"
363+
>
224364
<Text>New Folder</Text>
225365
</ContextMenuItem>
226366
<ContextMenuSeparator />
227-
<ContextMenuItem onPress={() => Alert.alert("Rename", "Renaming Projects folder")}>
367+
<ContextMenuItem
368+
onPress={() => Alert.alert("Rename", "Renaming Projects folder")}
369+
iosIcon="pencil"
370+
androidIcon="edit"
371+
icon="✏️"
372+
>
228373
<Text>Rename</Text>
229374
</ContextMenuItem>
230-
<ContextMenuItem onPress={() => Alert.alert("Move", "Moving Projects folder")}>
375+
<ContextMenuItem
376+
onPress={() => Alert.alert("Move", "Moving Projects folder")}
377+
iosIcon="arrow.up.arrow.down"
378+
androidIcon="move"
379+
icon="📁"
380+
>
231381
<Text>Move</Text>
232382
</ContextMenuItem>
233383
<ContextMenuSeparator />
234-
<ContextMenuItem onPress={() => Alert.alert("Delete", "Deleting Projects folder")} destructive>
384+
<ContextMenuItem
385+
onPress={() => Alert.alert("Delete", "Deleting Projects folder")}
386+
destructive
387+
iosIcon="trash"
388+
androidIcon="delete"
389+
icon="🗑️"
390+
>
235391
<Text>Delete</Text>
236392
</ContextMenuItem>
237393
</ContextMenuContent>
@@ -259,7 +415,12 @@ export default function ContextMenuPreview() {
259415
</ContextMenuTrigger>
260416

261417
<ContextMenuContent>
262-
<ContextMenuItem onPress={handleShare}>
418+
<ContextMenuItem
419+
onPress={handleShare}
420+
iosIcon="square.and.arrow.up"
421+
androidIcon="share"
422+
icon="📤"
423+
>
263424
<Text>Share</Text>
264425
</ContextMenuItem>
265426
</ContextMenuContent>

apps/sandbox/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
"main": "expo-router/entry",
55
"scripts": {
66
"dev": "expo start",
7-
"android": "expo start --android",
8-
"ios": "expo start --ios",
7+
"android": "expo run:android",
8+
"ios": "expo run:ios",
99
"web": "expo start --web"
1010
},
1111
"dependencies": {
12+
"@native-ui-org/context-menu": "workspace:*",
1213
"@native-ui-org/primitives": "workspace:*",
1314
"expo": "~54.0.13",
1415
"expo-router": "^6.0.12",
@@ -19,4 +20,4 @@
1920
"react-native-screens": "^4.16.0"
2021
},
2122
"private": true
22-
}
23+
}

packages/context-menu/.eslintrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['universe/native', 'universe/web'],
4+
ignorePatterns: ['build'],
5+
};

0 commit comments

Comments
 (0)