Skip to content

Commit

Permalink
feat: create process provider
Browse files Browse the repository at this point in the history
  • Loading branch information
hel-axelor committed Feb 8, 2024
1 parent 39d0bab commit f03527d
Show file tree
Hide file tree
Showing 10 changed files with 229 additions and 544 deletions.
16 changes: 7 additions & 9 deletions packages/apps/stock/src/screens/loader/LoaderScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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 (
<Screen>
<View>
<Button
title="Run process"
onPress={() => setRunProccess(true)}
disabled={loading}
onPress={() => setStart(true)}
disabled={start}
/>
<LoaderPopup
start={start}
process={process}
runProccess={runProccess}
timeout={5000}
onSuccess={handleSuccessAction}
onError={handleErrorAction}
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/app/ContextedApplication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
Camera,
CameraScanner,
HeaderBandList,
LoaderToastNotifier,
Scanner,
Toast,
} from '../components';
Expand Down Expand Up @@ -88,7 +87,6 @@ const ContextedApplication = ({
<NavigationContainer>
<HeaderBandList />
<LoadingIndicator />
<LoaderToastNotifier />
<BlockInteractionMessage />
<RootNavigator
modules={modules}
Expand Down
298 changes: 0 additions & 298 deletions packages/core/src/components/templates/Loader/LoaderContext.tsx

This file was deleted.

Loading

0 comments on commit f03527d

Please sign in to comment.