Run react imports codemod

This commit is contained in:
Eric Bailey
2026-03-11 11:32:43 -05:00
parent f5994af620
commit b410ba867f
128 changed files with 905 additions and 799 deletions
@@ -1,4 +1,5 @@
import * as React from 'react'
import {Component, createRef} from 'react'
import {type ComponentType, type ContextType, type RefObject} from 'react'
import {
Dimensions,
type LayoutChangeEvent,
@@ -21,9 +22,9 @@ import {
Context as PortalContext,
} from './BottomSheetPortal'
const NativeView: React.ComponentType<
const NativeView: ComponentType<
BottomSheetViewProps & {
ref: React.RefObject<any>
ref: RefObject<any>
style: StyleProp<ViewStyle>
}
> = requireNativeViewManager('BottomSheet')
@@ -39,14 +40,14 @@ const IS_IOS15 =
const IS_NON_E2E_ANDROID =
Platform.OS === 'android' && Number(Platform.Version) < 35
export class BottomSheetNativeComponent extends React.Component<
export class BottomSheetNativeComponent extends Component<
BottomSheetViewProps,
{
open: boolean
viewHeight?: number
}
> {
ref = React.createRef<any>()
ref = createRef<any>()
static contextType = PortalContext
@@ -79,7 +80,7 @@ export class BottomSheetNativeComponent extends React.Component<
}
render() {
const Portal = this.context as React.ContextType<typeof PortalContext>
const Portal = this.context as ContextType<typeof PortalContext>
if (!Portal) {
throw new Error(
'BottomSheet: You need to wrap your component tree with a <BottomSheetPortalProvider> to use the bottom sheet.',
@@ -139,7 +140,7 @@ function BottomSheetNativeComponentInner({
onStateChange: (
event: NativeSyntheticEvent<{state: BottomSheetState}>,
) => void
nativeViewRef: React.RefObject<View>
nativeViewRef: RefObject<View>
onLayout?: (event: LayoutChangeEvent) => void
}) {
const insets = useSafeAreaInsets()
+8 -11
View File
@@ -1,20 +1,17 @@
import React from 'react'
import {createContext, useContext, useMemo} from 'react'
import {type ElementType, type ReactNode} from 'react'
import {createPortalGroup_INTERNAL} from './lib/Portal'
type PortalContext = React.ElementType<{children: React.ReactNode}>
type PortalContext = ElementType<{children: ReactNode}>
export const Context = React.createContext({} as PortalContext)
export const Context = createContext({} as PortalContext)
Context.displayName = 'BottomSheetPortalContext'
export const useBottomSheetPortal_INTERNAL = () => React.useContext(Context)
export const useBottomSheetPortal_INTERNAL = () => useContext(Context)
export function BottomSheetPortalProvider({
children,
}: {
children: React.ReactNode
}) {
const portal = React.useMemo(() => {
export function BottomSheetPortalProvider({children}: {children: ReactNode}) {
const portal = useMemo(() => {
return createPortalGroup_INTERNAL()
}, [])
@@ -32,7 +29,7 @@ const defaultPortal = createPortalGroup_INTERNAL()
export const BottomSheetOutlet = defaultPortal.Outlet
export function BottomSheetProvider({children}: {children: React.ReactNode}) {
export function BottomSheetProvider({children}: {children: ReactNode}) {
return (
<Context.Provider value={defaultPortal.Portal}>
<defaultPortal.Provider>{children}</defaultPortal.Provider>