Add displayName to contexts (#8814)
This commit is contained in:
@@ -34,10 +34,12 @@ type ContextType = {
|
||||
} & Pick<RootProps, 'value' | 'onValueChange' | 'disabled'>
|
||||
|
||||
const Context = createContext<ContextType | null>(null)
|
||||
Context.displayName = 'SelectContext'
|
||||
|
||||
const ValueTextContext = createContext<
|
||||
[any, React.Dispatch<React.SetStateAction<any>>]
|
||||
>([undefined, () => {}])
|
||||
ValueTextContext.displayName = 'ValueTextContext'
|
||||
|
||||
function useSelectContext() {
|
||||
const ctx = useContext(Context)
|
||||
@@ -229,6 +231,7 @@ const ItemContext = createContext<{
|
||||
focused: false,
|
||||
pressed: false,
|
||||
})
|
||||
ItemContext.displayName = 'SelectItemContext'
|
||||
|
||||
export function useItemContext() {
|
||||
return useContext(ItemContext)
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
} from './types'
|
||||
|
||||
const SelectedValueContext = createContext<string | undefined | null>(null)
|
||||
SelectedValueContext.displayName = 'SelectSelectedValueContext'
|
||||
|
||||
export function Root(props: RootProps) {
|
||||
return (
|
||||
@@ -219,6 +220,7 @@ const ItemContext = createContext<{
|
||||
pressed: false,
|
||||
selected: false,
|
||||
})
|
||||
ItemContext.displayName = 'SelectItemContext'
|
||||
|
||||
export function useItemContext() {
|
||||
return useContext(ItemContext)
|
||||
|
||||
Reference in New Issue
Block a user