Add displayName to contexts (#8814)
This commit is contained in:
@@ -15,7 +15,9 @@ const stateContext = React.createContext<StateContext>({
|
||||
colorMode: 'system',
|
||||
darkTheme: 'dark',
|
||||
})
|
||||
stateContext.displayName = 'ColorModeStateContext'
|
||||
const setContext = React.createContext<SetContext>({} as SetContext)
|
||||
setContext.displayName = 'ColorModeSetContext'
|
||||
|
||||
export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||
const [colorMode, setColorMode] = React.useState(persisted.get('colorMode'))
|
||||
|
||||
@@ -51,12 +51,14 @@ type ControlsContext = {
|
||||
}
|
||||
|
||||
const stateContext = React.createContext<StateContext>(undefined)
|
||||
stateContext.displayName = 'ComposerStateContext'
|
||||
const controlsContext = React.createContext<ControlsContext>({
|
||||
openComposer(_opts: ComposerOpts) {},
|
||||
closeComposer() {
|
||||
return false
|
||||
},
|
||||
})
|
||||
controlsContext.displayName = 'ComposerControlsContext'
|
||||
|
||||
export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||
const {_} = useLingui()
|
||||
|
||||
@@ -4,7 +4,9 @@ type StateContext = boolean
|
||||
type SetContext = (v: boolean) => void
|
||||
|
||||
const stateContext = React.createContext<StateContext>(false)
|
||||
stateContext.displayName = 'DrawerOpenStateContext'
|
||||
const setContext = React.createContext<SetContext>((_: boolean) => {})
|
||||
setContext.displayName = 'DrawerOpenSetContext'
|
||||
|
||||
export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||
const [state, setState] = React.useState(false)
|
||||
|
||||
@@ -4,7 +4,9 @@ type StateContext = boolean
|
||||
type SetContext = (v: boolean) => void
|
||||
|
||||
const stateContext = React.createContext<StateContext>(false)
|
||||
stateContext.displayName = 'DrawerSwipeDisabledStateContext'
|
||||
const setContext = React.createContext<SetContext>((_: boolean) => {})
|
||||
setContext.displayName = 'DrawerSwipeDisabledSetContext'
|
||||
|
||||
export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||
const [state, setState] = React.useState(false)
|
||||
|
||||
@@ -39,12 +39,14 @@ const StateContext = React.createContext<State>({
|
||||
showLoggedOut: false,
|
||||
requestedAccountSwitchTo: undefined,
|
||||
})
|
||||
StateContext.displayName = 'LoggedOutStateContext'
|
||||
|
||||
const ControlsContext = React.createContext<Controls>({
|
||||
setShowLoggedOut: () => {},
|
||||
requestSwitchToAccount: () => {},
|
||||
clearRequestedAccount: () => {},
|
||||
})
|
||||
ControlsContext.displayName = 'LoggedOutControlsContext'
|
||||
|
||||
export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||
const activeStarterPack = useActiveStarterPack()
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import React from 'react'
|
||||
import {SharedValue, useSharedValue, withSpring} from 'react-native-reanimated'
|
||||
import {
|
||||
type SharedValue,
|
||||
useSharedValue,
|
||||
withSpring,
|
||||
} from 'react-native-reanimated'
|
||||
|
||||
type StateContext = {
|
||||
headerMode: SharedValue<number>
|
||||
@@ -29,7 +33,9 @@ const stateContext = React.createContext<StateContext>({
|
||||
set() {},
|
||||
},
|
||||
})
|
||||
stateContext.displayName = 'MinimalModeStateContext'
|
||||
const setContext = React.createContext<SetContext>((_: boolean) => {})
|
||||
setContext.displayName = 'MinimalModeSetContext'
|
||||
|
||||
export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||
const headerMode = useSharedValue(0)
|
||||
|
||||
@@ -29,7 +29,9 @@ export type DispatchContext = (action: Action) => void
|
||||
const stateContext = React.createContext<StateContext>(
|
||||
compute(persisted.defaults.onboarding),
|
||||
)
|
||||
stateContext.displayName = 'OnboardingStateContext'
|
||||
const dispatchContext = React.createContext<DispatchContext>((_: Action) => {})
|
||||
dispatchContext.displayName = 'OnboardingDispatchContext'
|
||||
|
||||
function reducer(state: StateContext, action: Action): StateContext {
|
||||
switch (action.type) {
|
||||
|
||||
@@ -10,6 +10,7 @@ const PostProgressContext = React.createContext<PostProgressState>({
|
||||
progress: 0,
|
||||
status: 'idle',
|
||||
})
|
||||
PostProgressContext.displayName = 'PostProgressContext'
|
||||
|
||||
export function Provider() {}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import {useLingui} from '@lingui/react'
|
||||
import {logEvent} from '#/lib/statsig/statsig'
|
||||
import {
|
||||
ProgressGuideToast,
|
||||
ProgressGuideToastRef,
|
||||
type ProgressGuideToastRef,
|
||||
} from '#/components/ProgressGuide/Toast'
|
||||
import {
|
||||
usePreferencesQuery,
|
||||
@@ -45,6 +45,7 @@ export type ProgressGuide =
|
||||
| undefined
|
||||
|
||||
const ProgressGuideContext = React.createContext<ProgressGuide>(undefined)
|
||||
ProgressGuideContext.displayName = 'ProgressGuideContext'
|
||||
|
||||
const ProgressGuideControlContext = React.createContext<{
|
||||
startProgressGuide(guide: ProgressGuideName): void
|
||||
@@ -55,6 +56,7 @@ const ProgressGuideControlContext = React.createContext<{
|
||||
endProgressGuide: () => {},
|
||||
captureAction: (_action: ProgressGuideAction, _count = 1) => {},
|
||||
})
|
||||
ProgressGuideControlContext.displayName = 'ProgressGuideControlContext'
|
||||
|
||||
export function useProgressGuide(guide: ProgressGuideName) {
|
||||
const ctx = React.useContext(ProgressGuideContext)
|
||||
|
||||
@@ -2,13 +2,15 @@ import React from 'react'
|
||||
|
||||
import {isWeb} from '#/platform/detection'
|
||||
import * as persisted from '#/state/persisted'
|
||||
import {FeedDescriptor} from '#/state/queries/post-feed'
|
||||
import {type FeedDescriptor} from '#/state/queries/post-feed'
|
||||
|
||||
type StateContext = FeedDescriptor | null
|
||||
type SetContext = (v: FeedDescriptor) => void
|
||||
|
||||
const stateContext = React.createContext<StateContext>(null)
|
||||
stateContext.displayName = 'SelectedFeedStateContext'
|
||||
const setContext = React.createContext<SetContext>((_: string) => {})
|
||||
setContext.displayName = 'SelectedFeedSetContext'
|
||||
|
||||
function getInitialFeed(): FeedDescriptor | null {
|
||||
if (isWeb) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import {SharedValue, useSharedValue} from 'react-native-reanimated'
|
||||
import {type SharedValue, useSharedValue} from 'react-native-reanimated'
|
||||
|
||||
type StateContext = {
|
||||
headerHeight: SharedValue<number>
|
||||
@@ -28,6 +28,7 @@ const stateContext = React.createContext<StateContext>({
|
||||
set() {},
|
||||
},
|
||||
})
|
||||
stateContext.displayName = 'ShellLayoutContext'
|
||||
|
||||
export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||
const headerHeight = useSharedValue(0)
|
||||
|
||||
@@ -9,7 +9,9 @@ type StateContext =
|
||||
type SetContext = (v: StateContext) => void
|
||||
|
||||
const stateContext = React.createContext<StateContext>(undefined)
|
||||
stateContext.displayName = 'ActiveStarterPackStateContext'
|
||||
const setContext = React.createContext<SetContext>((_: StateContext) => {})
|
||||
setContext.displayName = 'ActiveStarterPackSetContext'
|
||||
|
||||
export function Provider({children}: {children: React.ReactNode}) {
|
||||
const [state, setState] = React.useState<StateContext>()
|
||||
|
||||
@@ -3,6 +3,7 @@ import React from 'react'
|
||||
type StateContext = number
|
||||
|
||||
const stateContext = React.createContext<StateContext>(0)
|
||||
stateContext.displayName = 'TickEveryMinuteContext'
|
||||
|
||||
export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||
const [tick, setTick] = React.useState(Date.now())
|
||||
|
||||
Reference in New Issue
Block a user