From f8addf2a06173fe9acad325057e7509c5f944acb Mon Sep 17 00:00:00 2001 From: Hamza El Gatia Date: Fri, 9 Feb 2024 18:48:51 +0100 Subject: [PATCH] feat: add process provider --- .../stock/src/screens/loader/LoaderScreen.js | 16 +- .../core/src/app/ContextedApplication.tsx | 2 - packages/core/src/app/ContextsProvider.tsx | 5 +- .../templates/Loader/LoaderContext.tsx | 298 ------------------ .../templates/Loader/LoaderPopup.tsx | 51 +-- .../templates/Loader/LoaderToastNotifier.tsx | 80 ----- .../templates/Loader/ProcessProvider.ts | 194 ++++++++++++ .../src/components/templates/Loader/index.ts | 4 +- .../templates/Loader/loader-helper.ts | 21 ++ .../src/components/templates/Loader/types.ts | 51 +++ .../templates/Loader/use-loader-listener.ts | 113 ++----- 11 files changed, 322 insertions(+), 513 deletions(-) delete mode 100644 packages/core/src/components/templates/Loader/LoaderContext.tsx delete mode 100644 packages/core/src/components/templates/Loader/LoaderToastNotifier.tsx create mode 100644 packages/core/src/components/templates/Loader/ProcessProvider.ts create mode 100644 packages/core/src/components/templates/Loader/loader-helper.ts create mode 100644 packages/core/src/components/templates/Loader/types.ts diff --git a/packages/apps/stock/src/screens/loader/LoaderScreen.js b/packages/apps/stock/src/screens/loader/LoaderScreen.js index 6c1ef2fbb2..a86646c0c3 100644 --- a/packages/apps/stock/src/screens/loader/LoaderScreen.js +++ b/packages/apps/stock/src/screens/loader/LoaderScreen.js @@ -37,11 +37,11 @@ import React, {useState} from 'react'; import {View} from 'react-native'; import {Button, Screen} from '@axelor/aos-mobile-ui'; -import {LoaderPopup, useLoader} from '@axelor/aos-mobile-core'; +import {LoaderPopup} from '@axelor/aos-mobile-core'; // Screen for test Loader functionnalities const LoaderScreen = () => { - const [runProccess, setRunProccess] = useState(false); + const [start, setStart] = useState(false); const process = () => new Promise(resolve => { @@ -51,28 +51,26 @@ const LoaderScreen = () => { }); const handleSuccessAction = () => { - setRunProccess(false); + setStart(false); console.log('Success action executed!'); }; const handleErrorAction = () => { - setRunProccess(false); + setStart(false); console.log('Error action executed!'); }; - const {loading} = useLoader(); - return (