mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
fix(radial): go back to correct more page when going back from sub (#247)
This commit is contained in:
committed by
GitHub
parent
bbc1216a54
commit
d72b7eb00a
@@ -87,9 +87,13 @@ const RadialMenu: React.FC = () => {
|
||||
setMenuItems(items);
|
||||
}, [menu.items, menu.page]);
|
||||
|
||||
useNuiEvent('openRadialMenu', async (data: { items: RadialMenuItem[]; sub?: boolean } | false) => {
|
||||
useNuiEvent('openRadialMenu', async (data: { items: RadialMenuItem[]; sub?: boolean, option?: string } | false) => {
|
||||
if (!data) return setVisible(false);
|
||||
setMenu({ ...data, page: 1 });
|
||||
let initialPage = 1;
|
||||
if (data.option) {
|
||||
data.items.findIndex((item, index) => item.menu == data.option && (initialPage = Math.floor(index / PAGE_ITEMS) + 1));
|
||||
}
|
||||
setMenu({ ...data, page: initialPage });
|
||||
setVisible(true);
|
||||
});
|
||||
|
||||
|
||||
@@ -4,4 +4,5 @@ export interface RadialMenuItem {
|
||||
icon: IconProp;
|
||||
label: string;
|
||||
isMore?: boolean;
|
||||
menu?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user