Add displayName to contexts (#8814)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, {createContext, useContext, useMemo} from 'react'
|
||||
import {ScrollHandlers} from 'react-native-reanimated'
|
||||
import {createContext, useContext, useMemo} from 'react'
|
||||
import {type ScrollHandlers} from 'react-native-reanimated'
|
||||
|
||||
const ScrollContext = createContext<ScrollHandlers<any>>({
|
||||
onBeginDrag: undefined,
|
||||
@@ -7,6 +7,7 @@ const ScrollContext = createContext<ScrollHandlers<any>>({
|
||||
onScroll: undefined,
|
||||
onMomentumEnd: undefined,
|
||||
})
|
||||
ScrollContext.displayName = 'ScrollContext'
|
||||
|
||||
export function useScrollHandlers(): ScrollHandlers<any> {
|
||||
return useContext(ScrollContext)
|
||||
|
||||
@@ -89,6 +89,7 @@ export interface ThemeProviderProps {
|
||||
}
|
||||
|
||||
export const ThemeContext = createContext<Theme>(defaultTheme)
|
||||
ThemeContext.displayName = 'ThemeContext'
|
||||
|
||||
export const useTheme = () => useContext(ThemeContext)
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ const KeyboardControllerRefCountContext = createContext<{
|
||||
incrementRefCount: () => {},
|
||||
decrementRefCount: () => {},
|
||||
})
|
||||
KeyboardControllerRefCountContext.displayName =
|
||||
'KeyboardControllerRefCountContext'
|
||||
|
||||
export function KeyboardControllerProvider({
|
||||
children,
|
||||
|
||||
@@ -4,8 +4,11 @@ import {useFocusEffect} from '@react-navigation/native'
|
||||
type HideBottomBarBorderSetter = () => () => void
|
||||
|
||||
const HideBottomBarBorderContext = createContext<boolean>(false)
|
||||
HideBottomBarBorderContext.displayName = 'HideBottomBarBorderContext'
|
||||
const HideBottomBarBorderSetterContext =
|
||||
createContext<HideBottomBarBorderSetter | null>(null)
|
||||
HideBottomBarBorderSetterContext.displayName =
|
||||
'HideBottomBarBorderSetterContext'
|
||||
|
||||
export function useHideBottomBarBorderSetter() {
|
||||
const hideBottomBarBorder = useContext(HideBottomBarBorderSetterContext)
|
||||
|
||||
@@ -147,6 +147,7 @@ function toStringRecord<E extends keyof MetricEvents>(
|
||||
// and it's been difficult to get it to behave in a predictable way.
|
||||
// Our own cache ensures consistent evaluation within a single session.
|
||||
const GateCache = React.createContext<Map<string, boolean> | null>(null)
|
||||
GateCache.displayName = 'StatsigGateCacheContext'
|
||||
|
||||
type GateOptions = {
|
||||
dangerouslyDisableExposureLogging?: boolean
|
||||
|
||||
Reference in New Issue
Block a user