From 29394335aff0816d06562cd43edf3205c98300b6 Mon Sep 17 00:00:00 2001 From: gustavo-em Date: Thu, 24 Feb 2022 16:08:12 -0300 Subject: [PATCH] context of portals --- .../app/contexts/portals/container.tsx | 19 +++++++++++++++++++ react-native/app/contexts/portals/context.ts | 2 ++ react-native/app/contexts/portals/hook.ts | 11 +++++++++++ .../app/pages/list_portals/component.js | 12 ------------ 4 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 react-native/app/contexts/portals/container.tsx create mode 100644 react-native/app/contexts/portals/context.ts create mode 100644 react-native/app/contexts/portals/hook.ts delete mode 100644 react-native/app/pages/list_portals/component.js diff --git a/react-native/app/contexts/portals/container.tsx b/react-native/app/contexts/portals/container.tsx new file mode 100644 index 0000000..8a374a1 --- /dev/null +++ b/react-native/app/contexts/portals/container.tsx @@ -0,0 +1,19 @@ +import React from 'react' +import { PortalContext } from './context' +type IPortalContext = { + portals?: any + setPortals?: any +} + +export const PortalContextContainer = ({children}: any)=>{ + const [portals, setPortals] = React.useState(0) + const portalHook: IPortalContext = {portals, setPortals} + return ( + <> + + {children} + + + ) + +} \ No newline at end of file diff --git a/react-native/app/contexts/portals/context.ts b/react-native/app/contexts/portals/context.ts new file mode 100644 index 0000000..dd851b1 --- /dev/null +++ b/react-native/app/contexts/portals/context.ts @@ -0,0 +1,2 @@ +import React, { createContext } from 'react' +export const PortalContext = createContext(false); \ No newline at end of file diff --git a/react-native/app/contexts/portals/hook.ts b/react-native/app/contexts/portals/hook.ts new file mode 100644 index 0000000..39ca159 --- /dev/null +++ b/react-native/app/contexts/portals/hook.ts @@ -0,0 +1,11 @@ +import React, { useContext } from 'react' +import { PortalContext } from './context'; +type IPortalContext = { + portals?: any + setPortals?: any +} + +export const usePortal = (): IPortalContext=>{ + const contextOfPortals = useContext(PortalContext); + return contextOfPortals as IPortalContext; +} \ No newline at end of file diff --git a/react-native/app/pages/list_portals/component.js b/react-native/app/pages/list_portals/component.js deleted file mode 100644 index 7050705..0000000 --- a/react-native/app/pages/list_portals/component.js +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react' -import { Text, View } from 'react-native'; - -export const ListPortals = ()=>{ - return ( - <> - - List - - - ) -} \ No newline at end of file