From f03527d3842b2888ba758f7beae41f1857db8a6e Mon Sep 17 00:00:00 2001 From: Hamza El Gatia Date: Thu, 8 Feb 2024 17:22:09 +0100 Subject: [PATCH] feat: create process provider --- .../stock/src/screens/loader/LoaderScreen.js | 16 +- .../core/src/app/ContextedApplication.tsx | 2 - .../templates/Loader/LoaderContext.tsx | 298 ------------------ .../templates/Loader/LoaderPopup.tsx | 51 +-- .../templates/Loader/LoaderToastNotifier.tsx | 80 ----- .../templates/Loader/ProcessProvider.ts | 154 +++++++-- .../src/components/templates/Loader/index.ts | 2 - .../templates/Loader/loader-helper.ts | 21 ++ .../src/components/templates/Loader/types.ts | 36 ++- .../templates/Loader/use-loader-listener.ts | 113 ++----- 10 files changed, 229 insertions(+), 544 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/loader-helper.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 (