feat: screen presentation and dismiss animations for mobile (#2073)

This commit is contained in:
Mo
2022-11-30 14:37:36 -06:00
committed by GitHub
parent 0e95b451d6
commit 7f2074a6ec
79 changed files with 1338 additions and 878 deletions

View File

@@ -0,0 +1,36 @@
import { ReactNode, createContext, useContext, memo } from 'react'
import { observer } from 'mobx-react-lite'
import { WebApplication } from '@/Application/Application'
const ApplicationContext = createContext<WebApplication | undefined>(undefined)
export const useApplication = () => {
const value = useContext(ApplicationContext)
if (!value) {
throw new Error('Component must be a child of <ApplicationProvider />')
}
return value
}
type ChildrenProps = {
children: ReactNode
}
type ProviderProps = {
application: WebApplication
} & ChildrenProps
const MemoizedChildren = memo(({ children }: ChildrenProps) => <>{children}</>)
const ApplicationProvider = ({ application, children }: ProviderProps) => {
return (
<ApplicationContext.Provider value={application}>
<MemoizedChildren children={children} />
</ApplicationContext.Provider>
)
}
export default observer(ApplicationProvider)