diff --git a/packages/apps/stock/src/index.ts b/packages/apps/stock/src/index.ts index 1ffbc1070f..3ba043258f 100644 --- a/packages/apps/stock/src/index.ts +++ b/packages/apps/stock/src/index.ts @@ -20,6 +20,7 @@ import {Module} from '@axelor/aos-mobile-core'; import CustomerDeliveryScreens from './screens/customerDeliveries'; import InternalMovesScreens from './screens/internalMoves'; import InventoriesScreens from './screens/inventories'; +import LoaderScreens from './screens/loader'; import ProductsScreens from './screens/products'; import StockCorrectionScreens from './screens/stockCorrections'; import SupplierArrivalsScreens from './screens/supplierArrivals'; @@ -40,6 +41,11 @@ export const StockModule: Module = { downToVersion: '7.1.0', }, menus: { + loader_test_screen: { + title: 'Loader', + icon: 'bug-fill', + screen: 'LoaderScreen', + }, stock_menu_product: { title: 'Stock_Product', icon: 'cart-fill', @@ -75,6 +81,7 @@ export const StockModule: Module = { ...CustomerDeliveryScreens, ...InternalMovesScreens, ...InventoriesScreens, + ...LoaderScreens, ...ProductsScreens, ...StockCorrectionScreens, ...SupplierArrivalsScreens, @@ -108,6 +115,7 @@ export * from './screens/auth/UserScreen'; export * from './screens/customerDeliveries'; export * from './screens/internalMoves'; export * from './screens/inventories'; +export * from './screens/loader'; export * from './screens/products'; export * from './screens/stockCorrections'; export * from './screens/supplierArrivals'; diff --git a/packages/apps/stock/src/screens/loader/LoaderScreen.js b/packages/apps/stock/src/screens/loader/LoaderScreen.js new file mode 100644 index 0000000000..f187147e8b --- /dev/null +++ b/packages/apps/stock/src/screens/loader/LoaderScreen.js @@ -0,0 +1,70 @@ +/* + * Axelor Business Solutions + * + * Copyright (C) 2024 Axelor (). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +/* + * Axelor Business Solutions + * + * Copyright (C) 2024 Axelor (). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import React from 'react'; +import {Button, View} from 'react-native'; +import {Screen} from '@axelor/aos-mobile-ui'; +import {useLoaderListner} from '@axelor/aos-mobile-core'; + +// Screen for test Loader functionnalities +const LoaderScreen = () => { + const process = () => + new Promise(resolve => { + setTimeout(() => { + resolve('Process finished'); + }, 10000); + }); + + const handleCustomAction = () => { + console.log('Custom action executed!'); + }; + + const {loading, listener} = useLoaderListner({ + process, + onSuccess: handleCustomAction, + onError: () => console.warn('An error has occurred!'), + }); + + return ( + + +