Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beasy-mobile
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
G
beasy-mobile
Commits
c1712edb
Commit
c1712edb
authored
May 27, 2024
by
G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
separate modal and backdrop, currently only loading modal is done. testing still need to happen
parent
1214a469
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
8 deletions
+41
-8
LoadingModal.tsx
src/components/modals/LoadingModal.tsx
+28
-0
Overlay.tsx
src/contexts/Overlay.tsx
+13
-8
No files found.
src/components/modals/LoadingModal.tsx
0 → 100644
View file @
c1712edb
import
Box
from
"@components/bases/Box"
;
import
{
ActivityIndicator
,
Text
}
from
"react-native"
;
const
LoadingModal
=
()
=>
{
return
(
<
Box
width=
{
300
}
height=
{
200
}
backgroundColor=
{
"white"
}
alignItems=
{
"center"
}
justifyContent=
{
"center"
}
alignSelf=
{
"center"
}
marginTop=
{
"x240"
}
position=
{
"absolute"
}
zIndex=
{
10
}
borderRadius=
{
20
}
gap=
{
"m"
}
shadowColor=
{
"black"
}
shadowOffset=
{
{
width
:
0
,
height
:
0
}
}
shadowOpacity=
{
0.5
}
>
<
ActivityIndicator
size=
{
"large"
}
/>
<
Text
>
Veuillez patienter
</
Text
>
</
Box
>
);
};
export
default
LoadingModal
;
src/contexts/Overlay.tsx
View file @
c1712edb
import
LoadingModal
from
"@components/modals/LoadingModal"
;
import
{
createContext
,
useContext
,
useState
}
from
"react"
;
import
{
createContext
,
useContext
,
useState
}
from
"react"
;
import
{
View
}
from
"react-native"
;
import
{
View
}
from
"react-native"
;
...
@@ -12,14 +13,17 @@ export const OverlayContext = createContext<IoverlayContext>({
...
@@ -12,14 +13,17 @@ export const OverlayContext = createContext<IoverlayContext>({
});
});
export
const
OverlayProvider
=
({
children
}:
{
children
:
React
.
ReactNode
})
=>
{
export
const
OverlayProvider
=
({
children
}:
{
children
:
React
.
ReactNode
})
=>
{
const
[
overlayVisible
,
setOverlayVisible
]
=
useState
(
false
);
const
[
showBackdrop
,
setShowBackdrop
]
=
useState
(
true
);
const
[
loadingModalVisible
,
setLoadingModalVisible
]
=
useState
(
true
);
const
showOverlay
=
()
=>
{
const
showOverlay
=
()
=>
{
setOverlayVisible
(
true
);
setShowBackdrop
(
true
);
setLoadingModalVisible
(
true
);
};
};
const
hideOverlay
=
()
=>
{
const
hideOverlay
=
()
=>
{
setOverlayVisible
(
false
);
setShowBackdrop
(
false
);
setLoadingModalVisible
(
false
);
};
};
return
(
return
(
...
@@ -30,8 +34,9 @@ export const OverlayProvider = ({ children }: { children: React.ReactNode }) =>
...
@@ -30,8 +34,9 @@ export const OverlayProvider = ({ children }: { children: React.ReactNode }) =>
}
}
}
}
>
>
{
children
}
{
children
}
{
/* <OverlayComponent /> */
}
{
showBackdrop
&&
<
OverlayBackdrop
/>
}
{
overlayVisible
&&
<
OverlayComponent
/>
}
{
loadingModalVisible
&&
<
LoadingModal
/>
}
</
OverlayContext
.
Provider
>
</
OverlayContext
.
Provider
>
);
);
};
};
...
@@ -40,15 +45,15 @@ export const useOverlayContext = () => {
...
@@ -40,15 +45,15 @@ export const useOverlayContext = () => {
return
useContext
(
OverlayContext
);
return
useContext
(
OverlayContext
);
};
};
const
Overlay
Component
=
()
=>
{
const
Overlay
Backdrop
=
()
=>
{
return
(
return
(
<
View
<
View
style=
{
{
style=
{
{
flex
:
1
,
flex
:
1
,
width
:
"100%"
,
width
:
"100%"
,
height
:
"100%"
,
height
:
"100%"
,
justifyContent
:
"center"
,
//
justifyContent: "center",
alignItems
:
"center"
,
//
alignItems: "center",
zIndex
:
10
,
zIndex
:
10
,
backgroundColor
:
"black"
,
backgroundColor
:
"black"
,
opacity
:
0.5
,
opacity
:
0.5
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment