From cbab010c7dd760c4090e8ad488eaabff925c7a4a Mon Sep 17 00:00:00 2001 From: Yevhenii Date: Sat, 14 Mar 2026 23:44:50 +0200 Subject: [PATCH 1/4] chore(types): enable exactOptionalPropertyTypes --- .../safe-area/SafeAreaView.types.ts | 4 +- src/components/tabs/host/useTabsHost.ts | 8 +- .../tabs/screen/TabsScreen.android.tsx | 12 +-- src/components/tabs/screen/TabsScreen.ios.tsx | 20 ++--- src/components/tabs/screen/useTabsScreen.ts | 10 +-- src/fabric/ModalScreenNativeComponent.ts | 32 +++++--- src/fabric/ScreenNativeComponent.ts | 32 +++++--- .../ScreenStackHeaderConfigNativeComponent.ts | 12 ++- src/fabric/ScreenStackNativeComponent.ts | 4 +- .../safe-area/SafeAreaViewNativeComponent.ts | 14 ++-- .../tabs/TabsHostAndroidNativeComponent.ts | 2 +- src/fabric/tabs/TabsHostIOSNativeComponent.ts | 4 +- .../tabs/TabsScreenAndroidNativeComponent.ts | 64 ++++++++-------- .../tabs/TabsScreenIOSNativeComponent.ts | 76 ++++++++++--------- src/types.tsx | 33 +++++--- tsconfig.json | 1 + 16 files changed, 185 insertions(+), 143 deletions(-) diff --git a/src/components/safe-area/SafeAreaView.types.ts b/src/components/safe-area/SafeAreaView.types.ts index 1132dcab67..e2a15f0179 100644 --- a/src/components/safe-area/SafeAreaView.types.ts +++ b/src/components/safe-area/SafeAreaView.types.ts @@ -8,7 +8,7 @@ export type Edge = 'top' | 'right' | 'bottom' | 'left'; export type InsetType = 'all' | 'system' | 'interface'; export interface SafeAreaViewProps extends ViewProps { - edges?: Readonly>>; + edges?: Readonly>> | undefined; // Android-only - insetType?: InsetType; + insetType?: InsetType | undefined; } diff --git a/src/components/tabs/host/useTabsHost.ts b/src/components/tabs/host/useTabsHost.ts index 8ee7e2d241..c90474cf55 100644 --- a/src/components/tabs/host/useTabsHost.ts +++ b/src/components/tabs/host/useTabsHost.ts @@ -12,10 +12,10 @@ type TabsHostPlatformNativeComponentProps = interface TabsHostConfig { componentNodeRef: React.RefObject | null>; - controlNavigationStateInJS?: boolean; - onNativeFocusChange?: ( - event: NativeSyntheticEvent, - ) => void; + controlNavigationStateInJS?: boolean | undefined; + onNativeFocusChange?: + | ((event: NativeSyntheticEvent) => void) + | undefined; } export function useTabsHost({ diff --git a/src/components/tabs/screen/TabsScreen.android.tsx b/src/components/tabs/screen/TabsScreen.android.tsx index 21f1df5475..65c93d25ae 100644 --- a/src/components/tabs/screen/TabsScreen.android.tsx +++ b/src/components/tabs/screen/TabsScreen.android.tsx @@ -137,10 +137,10 @@ function parseIconsToNativeProps( icon: PlatformIconAndroid | undefined, selectedIcon: PlatformIconAndroid | undefined, ): { - imageIconResource?: ImageResolvedAssetSource; - drawableIconResourceName?: string; - selectedImageIconResource?: ImageResolvedAssetSource; - selectedDrawableIconResourceName?: string; + imageIconResource?: ImageResolvedAssetSource | undefined; + drawableIconResourceName?: string | undefined; + selectedImageIconResource?: ImageResolvedAssetSource | undefined; + selectedDrawableIconResourceName?: string | undefined; } { const parsedIcon = parseIconToNativeProps(icon); const parsedSelectedIcon = parseIconToNativeProps(selectedIcon); @@ -155,8 +155,8 @@ function parseIconsToNativeProps( } function parseIconToNativeProps(icon: PlatformIconAndroid | undefined): { - imageIconResource?: ImageResolvedAssetSource; - drawableIconResourceName?: string; + imageIconResource?: ImageResolvedAssetSource | undefined; + drawableIconResourceName?: string | undefined; } { if (!icon) { return {}; diff --git a/src/components/tabs/screen/TabsScreen.ios.tsx b/src/components/tabs/screen/TabsScreen.ios.tsx index cb82d5a252..ad2f91bd5b 100644 --- a/src/components/tabs/screen/TabsScreen.ios.tsx +++ b/src/components/tabs/screen/TabsScreen.ios.tsx @@ -159,13 +159,13 @@ function parseIconsToNativeProps( icon: PlatformIconIOS | undefined, selectedIcon: PlatformIconIOS | undefined, ): { - imageIconResource?: ImageResolvedAssetSource; - drawableIconResourceName?: string; - iconType?: IconType; - iconImageSource?: ImageSourcePropType; - iconResourceName?: string; - selectedIconImageSource?: ImageSourcePropType; - selectedIconResourceName?: string; + imageIconResource?: ImageResolvedAssetSource | undefined; + drawableIconResourceName?: string | undefined; + iconType?: IconType | undefined; + iconImageSource?: ImageSourcePropType | undefined; + iconResourceName?: string | undefined; + selectedIconImageSource?: ImageSourcePropType | undefined; + selectedIconResourceName?: string | undefined; } { const parsedIcon = parseIconToNativeProps(icon); const parsedSelectedIcon = parseIconToNativeProps(selectedIcon); @@ -195,9 +195,9 @@ function parseIconsToNativeProps( } function parseIconToNativeProps(icon: PlatformIconIOS | undefined): { - iconType?: IconType; - iconImageSource?: ImageSourcePropType; - iconResourceName?: string; + iconType?: IconType | undefined; + iconImageSource?: ImageSourcePropType | undefined; + iconResourceName?: string | undefined; } { if (!icon) { return {}; diff --git a/src/components/tabs/screen/useTabsScreen.ts b/src/components/tabs/screen/useTabsScreen.ts index 08b6e8515d..ab1b8b4b56 100644 --- a/src/components/tabs/screen/useTabsScreen.ts +++ b/src/components/tabs/screen/useTabsScreen.ts @@ -11,11 +11,11 @@ type TabsScreenPlatformNativeComponentProps = interface TabsScreenConfig { componentNodeRef: React.RefObject | null>; - onDidAppear?: TabsScreenEventHandler; - onDidDisappear?: TabsScreenEventHandler; - onWillAppear?: TabsScreenEventHandler; - onWillDisappear?: TabsScreenEventHandler; - isFocused?: boolean; + onDidAppear?: TabsScreenEventHandler | undefined; + onDidDisappear?: TabsScreenEventHandler | undefined; + onWillAppear?: TabsScreenEventHandler | undefined; + onWillDisappear?: TabsScreenEventHandler | undefined; + isFocused?: boolean | undefined; screenKey: string; } diff --git a/src/fabric/ModalScreenNativeComponent.ts b/src/fabric/ModalScreenNativeComponent.ts index 9005280de2..92c96e1689 100644 --- a/src/fabric/ModalScreenNativeComponent.ts +++ b/src/fabric/ModalScreenNativeComponent.ts @@ -62,19 +62,27 @@ type ReplaceAnimation = 'pop' | 'push'; type OptionalBoolean = 'undefined' | 'false' | 'true'; export interface NativeProps extends ViewProps { - onAppear?: CT.DirectEventHandler; - onDisappear?: CT.DirectEventHandler; - onDismissed?: CT.DirectEventHandler; - onNativeDismissCancelled?: CT.DirectEventHandler; - onWillAppear?: CT.DirectEventHandler; - onWillDisappear?: CT.DirectEventHandler; - onHeaderHeightChange?: CT.DirectEventHandler; - onTransitionProgress?: CT.DirectEventHandler; - onGestureCancel?: CT.DirectEventHandler; - onHeaderBackButtonClicked?: CT.DirectEventHandler; - onSheetDetentChanged?: CT.DirectEventHandler; + onAppear?: CT.DirectEventHandler | undefined; + onDisappear?: CT.DirectEventHandler | undefined; + onDismissed?: CT.DirectEventHandler | undefined; + onNativeDismissCancelled?: + | CT.DirectEventHandler + | undefined; + onWillAppear?: CT.DirectEventHandler | undefined; + onWillDisappear?: CT.DirectEventHandler | undefined; + onHeaderHeightChange?: + | CT.DirectEventHandler + | undefined; + onTransitionProgress?: + | CT.DirectEventHandler + | undefined; + onGestureCancel?: CT.DirectEventHandler | undefined; + onHeaderBackButtonClicked?: CT.DirectEventHandler | undefined; + onSheetDetentChanged?: + | CT.DirectEventHandler + | undefined; screenId?: CT.WithDefault; - sheetAllowedDetents?: number[]; + sheetAllowedDetents?: number[] | undefined; sheetLargestUndimmedDetent?: CT.WithDefault; sheetGrabberVisible?: CT.WithDefault; sheetCornerRadius?: CT.WithDefault; diff --git a/src/fabric/ScreenNativeComponent.ts b/src/fabric/ScreenNativeComponent.ts index 257e9e4236..d4beb57350 100644 --- a/src/fabric/ScreenNativeComponent.ts +++ b/src/fabric/ScreenNativeComponent.ts @@ -64,19 +64,27 @@ type ScrollEdgeEffect = 'automatic' | 'hard' | 'soft' | 'hidden'; type OptionalBoolean = 'undefined' | 'false' | 'true'; export interface NativeProps extends ViewProps { - onAppear?: CT.DirectEventHandler; - onDisappear?: CT.DirectEventHandler; - onDismissed?: CT.DirectEventHandler; - onNativeDismissCancelled?: CT.DirectEventHandler; - onWillAppear?: CT.DirectEventHandler; - onWillDisappear?: CT.DirectEventHandler; - onHeaderHeightChange?: CT.DirectEventHandler; - onTransitionProgress?: CT.DirectEventHandler; - onGestureCancel?: CT.DirectEventHandler; - onHeaderBackButtonClicked?: CT.DirectEventHandler; - onSheetDetentChanged?: CT.DirectEventHandler; + onAppear?: CT.DirectEventHandler | undefined; + onDisappear?: CT.DirectEventHandler | undefined; + onDismissed?: CT.DirectEventHandler | undefined; + onNativeDismissCancelled?: + | CT.DirectEventHandler + | undefined; + onWillAppear?: CT.DirectEventHandler | undefined; + onWillDisappear?: CT.DirectEventHandler | undefined; + onHeaderHeightChange?: + | CT.DirectEventHandler + | undefined; + onTransitionProgress?: + | CT.DirectEventHandler + | undefined; + onGestureCancel?: CT.DirectEventHandler | undefined; + onHeaderBackButtonClicked?: CT.DirectEventHandler | undefined; + onSheetDetentChanged?: + | CT.DirectEventHandler + | undefined; screenId?: CT.WithDefault; - sheetAllowedDetents?: number[]; + sheetAllowedDetents?: number[] | undefined; sheetLargestUndimmedDetent?: CT.WithDefault; sheetGrabberVisible?: CT.WithDefault; sheetCornerRadius?: CT.WithDefault; diff --git a/src/fabric/ScreenStackHeaderConfigNativeComponent.ts b/src/fabric/ScreenStackHeaderConfigNativeComponent.ts index fcbb2683cb..43d72b9c14 100644 --- a/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +++ b/src/fabric/ScreenStackHeaderConfigNativeComponent.ts @@ -72,10 +72,14 @@ export interface NativeProps extends ViewProps { blurEffect?: CT.WithDefault; // TODO: implement this props on iOS topInsetEnabled?: boolean; - headerLeftBarButtonItems?: CT.UnsafeMixed[]; - headerRightBarButtonItems?: CT.UnsafeMixed[]; - onPressHeaderBarButtonItem?: CT.DirectEventHandler; - onPressHeaderBarButtonMenuItem?: CT.DirectEventHandler; + headerLeftBarButtonItems?: CT.UnsafeMixed[] | undefined; + headerRightBarButtonItems?: CT.UnsafeMixed[] | undefined; + onPressHeaderBarButtonItem?: + | CT.DirectEventHandler + | undefined; + onPressHeaderBarButtonMenuItem?: + | CT.DirectEventHandler + | undefined; synchronousShadowStateUpdatesEnabled?: CT.WithDefault; // Experimental diff --git a/src/fabric/ScreenStackNativeComponent.ts b/src/fabric/ScreenStackNativeComponent.ts index b6e1a34230..381b476b65 100644 --- a/src/fabric/ScreenStackNativeComponent.ts +++ b/src/fabric/ScreenStackNativeComponent.ts @@ -9,7 +9,9 @@ type FinishTransitioningEvent = Readonly<{}>; export interface NativeProps extends ViewProps { iosPreventReattachmentOfDismissedScreens?: CT.WithDefault; - onFinishTransitioning?: CT.DirectEventHandler; + onFinishTransitioning?: + | CT.DirectEventHandler + | undefined; } export default codegenNativeComponent('RNSScreenStack', {}); diff --git a/src/fabric/safe-area/SafeAreaViewNativeComponent.ts b/src/fabric/safe-area/SafeAreaViewNativeComponent.ts index 01de59a279..b3d0d2d8b1 100644 --- a/src/fabric/safe-area/SafeAreaViewNativeComponent.ts +++ b/src/fabric/safe-area/SafeAreaViewNativeComponent.ts @@ -7,12 +7,14 @@ import type { CodegenTypes as CT, ViewProps } from 'react-native'; type InsetType = 'all' | 'system' | 'interface'; export interface NativeProps extends ViewProps { - edges?: Readonly<{ - top: boolean; - right: boolean; - bottom: boolean; - left: boolean; - }>; + edges?: + | Readonly<{ + top: boolean; + right: boolean; + bottom: boolean; + left: boolean; + }> + | undefined; // Android-only insetType?: CT.WithDefault; } diff --git a/src/fabric/tabs/TabsHostAndroidNativeComponent.ts b/src/fabric/tabs/TabsHostAndroidNativeComponent.ts index 481024bd85..9e45fb5870 100644 --- a/src/fabric/tabs/TabsHostAndroidNativeComponent.ts +++ b/src/fabric/tabs/TabsHostAndroidNativeComponent.ts @@ -24,7 +24,7 @@ export interface NativeProps extends ViewProps { // General tabBarHidden?: CT.WithDefault; - nativeContainerBackgroundColor?: ColorValue; + nativeContainerBackgroundColor?: ColorValue | undefined; colorScheme?: CT.WithDefault; // Android-specific props diff --git a/src/fabric/tabs/TabsHostIOSNativeComponent.ts b/src/fabric/tabs/TabsHostIOSNativeComponent.ts index c1b4f04177..2a430c2716 100644 --- a/src/fabric/tabs/TabsHostIOSNativeComponent.ts +++ b/src/fabric/tabs/TabsHostIOSNativeComponent.ts @@ -34,7 +34,7 @@ export interface NativeProps extends ViewProps { // General tabBarHidden?: CT.WithDefault; - nativeContainerBackgroundColor?: ColorValue; + nativeContainerBackgroundColor?: ColorValue | undefined; colorScheme?: CT.WithDefault; // We can't use `direction` name for this prop as it's also used by @@ -47,7 +47,7 @@ export interface NativeProps extends ViewProps { controlNavigationStateInJS?: CT.WithDefault; // iOS-specific props - tabBarTintColor?: ColorValue; + tabBarTintColor?: ColorValue | undefined; tabBarMinimizeBehavior?: CT.WithDefault; tabBarControllerMode?: CT.WithDefault; } diff --git a/src/fabric/tabs/TabsScreenAndroidNativeComponent.ts b/src/fabric/tabs/TabsScreenAndroidNativeComponent.ts index adadcfcfc1..d817062ba1 100644 --- a/src/fabric/tabs/TabsScreenAndroidNativeComponent.ts +++ b/src/fabric/tabs/TabsScreenAndroidNativeComponent.ts @@ -24,16 +24,16 @@ type TabBarItemLabelVisibilityMode = | 'unlabeled'; export type ItemStateAppearance = { - tabBarItemTitleFontColor?: ProcessedColorValue | null; - tabBarItemIconColor?: ProcessedColorValue | null; + tabBarItemTitleFontColor?: ProcessedColorValue | null | undefined; + tabBarItemIconColor?: ProcessedColorValue | null | undefined; }; export type Appearance = { // TabBar - Appearance - tabBarBackgroundColor?: ProcessedColorValue | null; + tabBarBackgroundColor?: ProcessedColorValue | null | undefined; // TabBarItem - Ripple - tabBarItemRippleColor?: ProcessedColorValue | null; + tabBarItemRippleColor?: ProcessedColorValue | null | undefined; // TabBarItem - Label layout tabBarItemLabelVisibilityMode?: CT.WithDefault< @@ -42,25 +42,25 @@ export type Appearance = { >; // TabBarItem - State-dependent appearance - normal?: ItemStateAppearance; - selected?: ItemStateAppearance; - focused?: ItemStateAppearance; - disabled?: ItemStateAppearance; + normal?: ItemStateAppearance | undefined; + selected?: ItemStateAppearance | undefined; + focused?: ItemStateAppearance | undefined; + disabled?: ItemStateAppearance | undefined; // TabBarItem - Active Indicator - tabBarItemActiveIndicatorColor?: ProcessedColorValue | null; + tabBarItemActiveIndicatorColor?: ProcessedColorValue | null | undefined; tabBarItemActiveIndicatorEnabled?: CT.WithDefault; // TabBarItem - Label - tabBarItemTitleFontFamily?: string; - tabBarItemTitleSmallLabelFontSize?: CT.Float; - tabBarItemTitleLargeLabelFontSize?: CT.Float; - tabBarItemTitleFontWeight?: string; - tabBarItemTitleFontStyle?: string; + tabBarItemTitleFontFamily?: string | undefined; + tabBarItemTitleSmallLabelFontSize?: CT.Float | undefined; + tabBarItemTitleLargeLabelFontSize?: CT.Float | undefined; + tabBarItemTitleFontWeight?: string | undefined; + tabBarItemTitleFontStyle?: string | undefined; // TabBarItem - Badge - tabBarItemBadgeBackgroundColor?: ProcessedColorValue | null; - tabBarItemBadgeTextColor?: ProcessedColorValue | null; + tabBarItemBadgeBackgroundColor?: ProcessedColorValue | null | undefined; + tabBarItemBadgeTextColor?: ProcessedColorValue | null | undefined; }; // #endregion Android-specific helpers @@ -73,34 +73,36 @@ export interface NativeProps extends ViewProps { onDidDisappear?: CT.DirectEventHandler; // Control - isFocused?: boolean; + isFocused?: boolean | undefined; screenKey: string; // General title?: string | undefined | null; - badgeValue?: string; + badgeValue?: string | undefined; // Accessibility - tabBarItemTestID?: string; - tabBarItemAccessibilityLabel?: string; + tabBarItemTestID?: string | undefined; + tabBarItemAccessibilityLabel?: string | undefined; // Effects - specialEffects?: { - repeatedTabSelection?: { - popToRoot?: CT.WithDefault; - scrollToTop?: CT.WithDefault; - }; - }; + specialEffects?: + | { + repeatedTabSelection?: { + popToRoot?: CT.WithDefault; + scrollToTop?: CT.WithDefault; + }; + } + | undefined; // Android-specific props // Image handling - drawableIconResourceName?: string; - imageIconResource?: ImageSource; - selectedDrawableIconResourceName?: string; - selectedImageIconResource?: ImageSource; + drawableIconResourceName?: string | undefined; + imageIconResource?: ImageSource | undefined; + selectedDrawableIconResourceName?: string | undefined; + selectedImageIconResource?: ImageSource | undefined; // Appearance - standardAppearance?: Appearance; + standardAppearance?: Appearance | undefined; } export default codegenNativeComponent('RNSTabsScreenAndroid', { diff --git a/src/fabric/tabs/TabsScreenIOSNativeComponent.ts b/src/fabric/tabs/TabsScreenIOSNativeComponent.ts index 3132470ec0..647f43b768 100644 --- a/src/fabric/tabs/TabsScreenIOSNativeComponent.ts +++ b/src/fabric/tabs/TabsScreenIOSNativeComponent.ts @@ -23,33 +23,35 @@ type GenericEmptyEvent = Readonly<{}>; export type IconType = 'image' | 'template' | 'sfSymbol' | 'xcasset'; export type ItemStateAppearance = { - tabBarItemTitleFontFamily?: string; - tabBarItemTitleFontSize?: CT.Float; - tabBarItemTitleFontWeight?: string; - tabBarItemTitleFontStyle?: string; - tabBarItemTitleFontColor?: ProcessedColorValue | null; - tabBarItemTitlePositionAdjustment?: { - horizontal?: CT.Float; - vertical?: CT.Float; - }; - tabBarItemIconColor?: ProcessedColorValue | null; - tabBarItemBadgeBackgroundColor?: ProcessedColorValue | null; + tabBarItemTitleFontFamily?: string | undefined; + tabBarItemTitleFontSize?: CT.Float | undefined; + tabBarItemTitleFontWeight?: string | undefined; + tabBarItemTitleFontStyle?: string | undefined; + tabBarItemTitleFontColor?: ProcessedColorValue | null | undefined; + tabBarItemTitlePositionAdjustment?: + | { + horizontal?: CT.Float; + vertical?: CT.Float; + } + | undefined; + tabBarItemIconColor?: ProcessedColorValue | null | undefined; + tabBarItemBadgeBackgroundColor?: ProcessedColorValue | null | undefined; }; export type ItemAppearance = { - normal?: ItemStateAppearance; - selected?: ItemStateAppearance; - focused?: ItemStateAppearance; - disabled?: ItemStateAppearance; + normal?: ItemStateAppearance | undefined; + selected?: ItemStateAppearance | undefined; + focused?: ItemStateAppearance | undefined; + disabled?: ItemStateAppearance | undefined; }; export type Appearance = { - stacked?: ItemAppearance; - inline?: ItemAppearance; - compactInline?: ItemAppearance; + stacked?: ItemAppearance | undefined; + inline?: ItemAppearance | undefined; + compactInline?: ItemAppearance | undefined; - tabBarBackgroundColor?: ProcessedColorValue | null; - tabBarShadowColor?: ProcessedColorValue | null; + tabBarBackgroundColor?: ProcessedColorValue | null | undefined; + tabBarShadowColor?: ProcessedColorValue | null | undefined; tabBarBlurEffect?: CT.WithDefault; }; @@ -117,25 +119,27 @@ export interface NativeProps extends ViewProps { onDidDisappear?: CT.DirectEventHandler; // Control - isFocused?: boolean; + isFocused?: boolean | undefined; screenKey: string; // General title?: string | undefined | null; - badgeValue?: string; + badgeValue?: string | undefined; orientation?: CT.WithDefault; // Accessibility - tabBarItemTestID?: string; - tabBarItemAccessibilityLabel?: string; + tabBarItemTestID?: string | undefined; + tabBarItemAccessibilityLabel?: string | undefined; // Effects - specialEffects?: { - repeatedTabSelection?: { - popToRoot?: CT.WithDefault; - scrollToTop?: CT.WithDefault; - }; - }; + specialEffects?: + | { + repeatedTabSelection?: { + popToRoot?: CT.WithDefault; + scrollToTop?: CT.WithDefault; + }; + } + | undefined; // iOS-specific props // Tab config @@ -143,15 +147,15 @@ export interface NativeProps extends ViewProps { systemItem?: CT.WithDefault; // Appearance - standardAppearance?: UnsafeMixed; - scrollEdgeAppearance?: UnsafeMixed; + standardAppearance?: UnsafeMixed | undefined; + scrollEdgeAppearance?: UnsafeMixed | undefined; // Icons iconType?: CT.WithDefault; - iconImageSource?: ImageSource; - iconResourceName?: string; - selectedIconImageSource?: ImageSource; - selectedIconResourceName?: string; + iconImageSource?: ImageSource | undefined; + iconResourceName?: string | undefined; + selectedIconImageSource?: ImageSource | undefined; + selectedIconResourceName?: string | undefined; // ScrollView interactions overrideScrollViewContentInsetAdjustmentBehavior?: CT.WithDefault< diff --git a/src/types.tsx b/src/types.tsx index bbff3c8d0f..a3026cfa2a 100644 --- a/src/types.tsx +++ b/src/types.tsx @@ -124,11 +124,16 @@ export type PlatformIconAndroid = export interface ScreenProps extends ViewProps { active?: 0 | 1 | Animated.AnimatedInterpolation; - activityState?: 0 | 1 | 2 | Animated.AnimatedInterpolation; + activityState?: + | 0 + | 1 + | 2 + | Animated.AnimatedInterpolation + | undefined; /** * Boolean indicating that the screen should be frozen with `react-freeze`. */ - shouldFreeze?: boolean; + shouldFreeze?: boolean | undefined; children?: React.ReactNode; /** * Boolean indicating that swipe dismissal should trigger animation provided by `stackAnimation`. Defaults to `false`. @@ -284,9 +289,9 @@ export interface ScreenProps extends ViewProps { /** * A callback that gets called when the header height has changed. */ - onHeaderHeightChange?: ( - e: NativeSyntheticEvent, - ) => void; + onHeaderHeightChange?: + | ((e: NativeSyntheticEvent) => void) + | undefined; /** * A callback that gets called after swipe back is canceled. */ @@ -389,7 +394,13 @@ export interface ScreenProps extends ViewProps { * * Defaults to `[1.0]`. */ - sheetAllowedDetents?: number[] | 'fitToContents' | 'medium' | 'large' | 'all'; + sheetAllowedDetents?: + | number[] + | 'fitToContents' + | 'medium' + | 'large' + | 'all' + | undefined; /** * Integer value describing elevation of the sheet, impacting shadow on the top edge of the sheet. * @@ -1280,11 +1291,11 @@ export type AnimatedScreenTransition = { export type ScreensRefsHolder = Record>; export interface GestureProps { - screensRefs?: React.MutableRefObject; - currentScreenId?: string; - goBackGesture?: GoBackGesture; - transitionAnimation?: AnimatedScreenTransition; - screenEdgeGesture?: boolean; + screensRefs?: React.MutableRefObject | undefined; + currentScreenId?: string | undefined; + goBackGesture?: GoBackGesture | undefined; + transitionAnimation?: AnimatedScreenTransition | undefined; + screenEdgeGesture?: boolean | undefined; } export interface GestureProviderProps extends GestureProps { diff --git a/tsconfig.json b/tsconfig.json index 4f37a6075c..2203330329 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,6 +20,7 @@ "resolveJsonModule": true, "skipLibCheck": true, "strict": true, + "exactOptionalPropertyTypes": true, "target": "esnext", "types": ["jest", "node"] }, From 14c3927d8c310968d0a9c67e268f09920c71b991 Mon Sep 17 00:00:00 2001 From: Krzysztof Ligarski Date: Wed, 15 Apr 2026 18:15:13 +0200 Subject: [PATCH 2/4] add undefined to all non-required props --- src/components/DebugContainer.tsx | 2 +- src/components/FullWindowOverlay.tsx | 2 +- src/components/ScreenFooter.tsx | 2 +- .../ScreenStackHeaderConfig.web.tsx | 2 +- src/components/ScreenStackItem.tsx | 6 +- src/components/SearchBar.tsx | 4 +- .../ScrollViewMarker.types.ts | 16 +- src/components/gamma/split/SplitHost.types.ts | 64 +-- .../gamma/split/SplitScreen.types.ts | 18 +- src/components/gamma/stack/StackHost.types.ts | 9 +- .../gamma/stack/StackScreen.types.ts | 18 +- .../TabsBottomAccessory.types.ts | 8 +- .../TabsBottomAccessoryContent.types.ts | 2 +- .../tabs/host/TabsHost.android.types.ts | 2 +- .../tabs/host/TabsHost.ios.types.ts | 14 +- src/components/tabs/host/TabsHost.types.ts | 36 +- .../tabs/screen/TabsScreen.android.types.ts | 42 +- .../tabs/screen/TabsScreen.ios.types.ts | 72 ++-- .../tabs/screen/TabsScreen.types.ts | 60 +-- .../FullWindowOverlayNativeComponent.ts | 2 +- src/fabric/ModalScreenNativeComponent.ts | 90 ++-- src/fabric/ScreenNativeComponent.ts | 101 +++-- .../ScreenStackHeaderConfigNativeComponent.ts | 74 ++-- ...ScreenStackHeaderSubviewNativeComponent.ts | 8 +- src/fabric/ScreenStackNativeComponent.ts | 8 +- src/fabric/SearchBarNativeComponent.ts | 60 +-- .../gamma/ScrollViewMarkerNativeComponent.ts | 16 +- .../gamma/split/SplitHostNativeComponent.ts | 81 ++-- .../gamma/split/SplitScreenNativeComponent.ts | 10 +- .../gamma/stack/StackScreenNativeComponent.ts | 18 +- .../safe-area/SafeAreaViewNativeComponent.ts | 2 +- ...bsBottomAccessoryContentNativeComponent.ts | 4 +- .../TabsBottomAccessoryNativeComponent.ts | 4 +- .../tabs/TabsHostAndroidNativeComponent.ts | 18 +- src/fabric/tabs/TabsHostIOSNativeComponent.ts | 30 +- .../tabs/TabsScreenAndroidNativeComponent.ts | 27 +- .../tabs/TabsScreenIOSNativeComponent.ts | 59 +-- src/types.tsx | 404 +++++++++--------- 38 files changed, 772 insertions(+), 623 deletions(-) diff --git a/src/components/DebugContainer.tsx b/src/components/DebugContainer.tsx index 235c046742..c96adea9f7 100644 --- a/src/components/DebugContainer.tsx +++ b/src/components/DebugContainer.tsx @@ -7,7 +7,7 @@ import ScreenContentWrapper from './ScreenContentWrapper'; import { StackPresentationTypes } from '../types'; type ContainerProps = ViewProps & { - contentStyle?: StyleProp; + contentStyle?: StyleProp | undefined; stackPresentation: StackPresentationTypes; children: React.ReactNode; }; diff --git a/src/components/FullWindowOverlay.tsx b/src/components/FullWindowOverlay.tsx index 0888810701..711a0120d5 100644 --- a/src/components/FullWindowOverlay.tsx +++ b/src/components/FullWindowOverlay.tsx @@ -21,7 +21,7 @@ const NativeFullWindowOverlay: React.ComponentType< type FullWindowOverlayProps = { children: ReactNode; - unstable_accessibilityContainerViewIsModal?: boolean; + unstable_accessibilityContainerViewIsModal?: boolean | undefined; }; function FullWindowOverlay(props: FullWindowOverlayProps) { diff --git a/src/components/ScreenFooter.tsx b/src/components/ScreenFooter.tsx index 598021ddba..8b357b8860 100644 --- a/src/components/ScreenFooter.tsx +++ b/src/components/ScreenFooter.tsx @@ -10,7 +10,7 @@ function ScreenFooter(props: ViewProps) { } type FooterProps = { - children?: React.ReactNode; + children?: React.ReactNode | undefined; }; export function FooterComponent({ children }: FooterProps) { diff --git a/src/components/ScreenStackHeaderConfig.web.tsx b/src/components/ScreenStackHeaderConfig.web.tsx index bb840d32c6..14737bc8b9 100644 --- a/src/components/ScreenStackHeaderConfig.web.tsx +++ b/src/components/ScreenStackHeaderConfig.web.tsx @@ -31,5 +31,5 @@ export const ScreenStackHeaderConfig = ( ): React.JSX.Element => ; export const ScreenStackHeaderSubview: React.ComponentType< - ViewProps & { type?: HeaderSubviewTypes } + ViewProps & { type?: HeaderSubviewTypes | undefined } > = View; diff --git a/src/components/ScreenStackItem.tsx b/src/components/ScreenStackItem.tsx index ead4811e8f..b29c9ed7a3 100644 --- a/src/components/ScreenStackItem.tsx +++ b/src/components/ScreenStackItem.tsx @@ -33,8 +33,8 @@ type Props = Omit< 'enabled' | 'isNativeStack' | 'hasLargeHeader' > & { screenId: string; - headerConfig?: ScreenStackHeaderConfigProps; - contentStyle?: StyleProp; + headerConfig?: ScreenStackHeaderConfigProps | undefined; + contentStyle?: StyleProp | undefined; }; function ScreenStackItem( @@ -261,7 +261,7 @@ function getPositioningStyle( type SplitStyleResult = { screenStyles: { - backgroundColor?: ViewStyle['backgroundColor']; + backgroundColor?: ViewStyle['backgroundColor'] | undefined; }; contentWrapperStyles: StyleProp; }; diff --git a/src/components/SearchBar.tsx b/src/components/SearchBar.tsx index 29b88654b7..2955923324 100644 --- a/src/components/SearchBar.tsx +++ b/src/components/SearchBar.tsx @@ -19,7 +19,9 @@ import SearchBarNativeComponent, { import type { CodegenTypes as CT } from 'react-native'; const NativeSearchBar: React.ComponentType< - SearchBarNativeProps & { ref?: React.RefObject } + SearchBarNativeProps & { + ref?: React.RefObject | undefined; + } > & typeof NativeSearchBarCommands = SearchBarNativeComponent as unknown as React.ComponentType & diff --git a/src/components/gamma/scroll-view-marker/ScrollViewMarker.types.ts b/src/components/gamma/scroll-view-marker/ScrollViewMarker.types.ts index f6a8599080..0094059ace 100644 --- a/src/components/gamma/scroll-view-marker/ScrollViewMarker.types.ts +++ b/src/components/gamma/scroll-view-marker/ScrollViewMarker.types.ts @@ -3,12 +3,14 @@ import type { ScrollEdgeEffect } from '../../shared/types'; export interface ScrollViewMarkerProps { children: ViewProps['children']; - style?: ViewProps['style']; + style?: ViewProps['style'] | undefined; - scrollEdgeEffects?: { - bottom?: ScrollEdgeEffect; - left?: ScrollEdgeEffect; - right?: ScrollEdgeEffect; - top?: ScrollEdgeEffect; - }; + scrollEdgeEffects?: + | { + bottom?: ScrollEdgeEffect | undefined; + left?: ScrollEdgeEffect | undefined; + right?: ScrollEdgeEffect | undefined; + top?: ScrollEdgeEffect | undefined; + } + | undefined; } diff --git a/src/components/gamma/split/SplitHost.types.ts b/src/components/gamma/split/SplitHost.types.ts index 83ba3785ff..26622334ef 100644 --- a/src/components/gamma/split/SplitHost.types.ts +++ b/src/components/gamma/split/SplitHost.types.ts @@ -34,37 +34,37 @@ export interface SplitColumnMetrics { * * Specifies the minimum width for the primary column in the Split layout, typically representing the leftmost sidebar. */ - minimumPrimaryColumnWidth?: number; + minimumPrimaryColumnWidth?: number | undefined; /** * @summary Maximum width for the primary sidebar. * * Specifies the maximum width (in points) for the primary column in the Split layout, typically representing the leftmost sidebar. */ - maximumPrimaryColumnWidth?: number; + maximumPrimaryColumnWidth?: number | undefined; /** * @summary Preferred width for the primary sidebar. * * Specifies the preferred width (in points or as a fraction for percentage width support) for the primary column in the Split layout, typically representing the leftmost sidebar. */ - preferredPrimaryColumnWidthOrFraction?: number; + preferredPrimaryColumnWidthOrFraction?: number | undefined; /** * @summary Minimum width for the intermediate sidebar. * * Specifies the minimum width (in points) for the supplementary column in the Split layout, typically representing the intermediate sidebar. */ - minimumSupplementaryColumnWidth?: number; + minimumSupplementaryColumnWidth?: number | undefined; /** * @summary Maximum width for the intermediate sidebar. * * Specifies the maximum width (in points) for the supplementary column in the Split layout, typically representing the intermediate sidebar. */ - maximumSupplementaryColumnWidth?: number; + maximumSupplementaryColumnWidth?: number | undefined; /** * @summary Preferred width for the intermediate sidebar. * * Specifies the preferred width (in points or as a fraction for percentage width support) for the supplementary column in the Split layout, typically representing the intermediate sidebar. */ - preferredSupplementaryColumnWidthOrFraction?: number; + preferredSupplementaryColumnWidthOrFraction?: number | undefined; /** * @summary Minimum width for the secondary component. * @@ -72,7 +72,7 @@ export interface SplitColumnMetrics { * * @supported iOS 26 or higher */ - minimumSecondaryColumnWidth?: number; + minimumSecondaryColumnWidth?: number | undefined; /** * @summary Preferred width for the secondary component. * @@ -80,7 +80,7 @@ export interface SplitColumnMetrics { * * @supported iOS 26 or higher */ - preferredSecondaryColumnWidthOrFraction?: number; + preferredSecondaryColumnWidthOrFraction?: number | undefined; /** * @summary Minimum width for the inspector component. * @@ -88,7 +88,7 @@ export interface SplitColumnMetrics { * * @supported iOS 26 or higher */ - minimumInspectorColumnWidth?: number; + minimumInspectorColumnWidth?: number | undefined; /** * @summary Maximum width for the inspector component. * @@ -96,7 +96,7 @@ export interface SplitColumnMetrics { * * @supported iOS 26 or higher */ - maximumInspectorColumnWidth?: number; + maximumInspectorColumnWidth?: number | undefined; /** * @summary Preferred width for the inspector component. * @@ -104,7 +104,7 @@ export interface SplitColumnMetrics { * * @supported iOS 26 or higher */ - preferredInspectorColumnWidthOrFraction?: number; + preferredInspectorColumnWidthOrFraction?: number | undefined; } export type SplitNavigableColumn = 'primary' | 'supplementary' | 'secondary'; @@ -113,8 +113,8 @@ export type SplitHostCommands = { }; export interface SplitHostProps extends ViewProps { - children?: React.ReactNode; - ref?: React.Ref; + children?: React.ReactNode | undefined; + ref?: React.Ref | undefined; /** * @summary An object describing bounds for column widths. @@ -129,7 +129,7 @@ export interface SplitHostProps extends ViewProps { * - `secondary` - the view with the main content * - `inspector` - the view which is providing additional data about the secondary column */ - columnMetrics?: SplitColumnMetrics; + columnMetrics?: SplitColumnMetrics | undefined; /** * @summary Determines whether the button for changing the Split display mode is visible on the screen. * @@ -144,24 +144,26 @@ export interface SplitHostProps extends ViewProps { * * @default automatic */ - displayModeButtonVisibility?: SplitDisplayModeButtonVisibility; + displayModeButtonVisibility?: SplitDisplayModeButtonVisibility | undefined; /** * @summary A callback that gets invoked when the Split was collapsed to a single column. */ - onCollapse?: (e: NativeSyntheticEvent) => void; + onCollapse?: + | ((e: NativeSyntheticEvent) => void) + | undefined; /** * @summary A callback that gets invoked when the Split displayMode has changed. * * The purpose of this callback is tracking displayMode updates on host from the JS side. * These updates might be a consequence of some native interactions, like pressing native button or performing swipe gesture. */ - onDisplayModeWillChange?: ( - e: NativeSyntheticEvent, - ) => void; + onDisplayModeWillChange?: + | ((e: NativeSyntheticEvent) => void) + | undefined; /** * @summary A callback that gets invoked when the Split was expanded to multiple columns. */ - onExpand?: (e: NativeSyntheticEvent) => void; + onExpand?: ((e: NativeSyntheticEvent) => void) | undefined; /** * @summary A callback that gets invoked when the Split inspector is either programmatically hidden (in column presentation) or dismissed (in modal presentation). * @@ -169,7 +171,9 @@ export interface SplitHostProps extends ViewProps { * * @supported iOS 26 or higher */ - onInspectorHide?: (e: NativeSyntheticEvent) => void; + onInspectorHide?: + | ((e: NativeSyntheticEvent) => void) + | undefined; /** * @summary Specifies supported orientations for the tab screen. * @@ -212,11 +216,11 @@ export interface SplitHostProps extends ViewProps { * * @platform ios */ - orientation?: SplitHostOrientation; + orientation?: SplitHostOrientation | undefined; /** * @summary Determines whether gestures are enabled to change the display mode. */ - presentsWithGesture?: boolean; + presentsWithGesture?: boolean | undefined; /** * @summary Specifies the display mode which will be preferred to use, if the layout requirements are met. * @@ -237,7 +241,7 @@ export interface SplitHostProps extends ViewProps { * * @default automatic */ - preferredDisplayMode?: SplitDisplayMode; + preferredDisplayMode?: SplitDisplayMode | undefined; /** * @summary Specifies the split behavior which will be preferred to use, if the layout requirements are met. * @@ -255,7 +259,7 @@ export interface SplitHostProps extends ViewProps { * * @default automatic */ - preferredSplitBehavior?: SplitBehavior; + preferredSplitBehavior?: SplitBehavior | undefined; /** * @summary Specifies the background style of the primary view controller. * @@ -277,7 +281,7 @@ export interface SplitHostProps extends ViewProps { * @remarks * According to the documentation, this property shouldn't have any effect on iOS. However, on iOS 26 the support for this prop was added. */ - primaryBackgroundStyle?: SplitPrimaryBackgroundStyle; + primaryBackgroundStyle?: SplitPrimaryBackgroundStyle | undefined; /** * @summary Indicates on which side primary sidebar is placed, affecting the split view layout. * @@ -291,7 +295,7 @@ export interface SplitHostProps extends ViewProps { * * @default leading */ - primaryEdge?: SplitPrimaryEdge; + primaryEdge?: SplitPrimaryEdge | undefined; /** * @summary Determines whether inspector column should be displayed. * @@ -300,11 +304,11 @@ export interface SplitHostProps extends ViewProps { * * @supported iOS 26 or higher */ - showInspector?: boolean; + showInspector?: boolean | undefined; /** * @summary Determines whether a button to toggle to and from secondaryOnly display mode is visible. */ - showSecondaryToggleButton?: boolean; + showSecondaryToggleButton?: boolean | undefined; /** * @summary Specifies which column should be shown when the split view collapses to a single column. * @@ -319,5 +323,5 @@ export interface SplitHostProps extends ViewProps { * - `supplementary` - the supplementary sidebar is shown * - `secondary` - the secondary (main content) column is shown */ - topColumnForCollapsing?: SplitNavigableColumn; + topColumnForCollapsing?: SplitNavigableColumn | undefined; } diff --git a/src/components/gamma/split/SplitScreen.types.ts b/src/components/gamma/split/SplitScreen.types.ts index 79c7634cb7..cacb94deeb 100644 --- a/src/components/gamma/split/SplitScreen.types.ts +++ b/src/components/gamma/split/SplitScreen.types.ts @@ -6,29 +6,37 @@ type GenericEmptyEvent = Readonly<{}>; export type SplitScreenColumnType = 'column' | 'inspector'; export interface SplitScreenProps extends ViewProps { - children?: React.ReactNode; + children?: React.ReactNode | undefined; /** * @summary A callback that gets invoked when the current SplitScreen did appear. * * This is called as soon as the transition ends. */ - onDidAppear?: (e: NativeSyntheticEvent) => void; + onDidAppear?: + | ((e: NativeSyntheticEvent) => void) + | undefined; /** * @summary A callback that gets invoked when the current SplitScreen did disappear. * * This is called as soon as the transition ends. */ - onDidDisappear?: (e: NativeSyntheticEvent) => void; + onDidDisappear?: + | ((e: NativeSyntheticEvent) => void) + | undefined; /** * @summary A callback that gets invoked when the current SplitScreen will appear. * * This is called as soon as the transition begins. */ - onWillAppear?: (e: NativeSyntheticEvent) => void; + onWillAppear?: + | ((e: NativeSyntheticEvent) => void) + | undefined; /** * @summary A callback that gets invoked when the current SplitScreen will disappear. * * This is called as soon as the transition begins. */ - onWillDisappear?: (e: NativeSyntheticEvent) => void; + onWillDisappear?: + | ((e: NativeSyntheticEvent) => void) + | undefined; } diff --git a/src/components/gamma/stack/StackHost.types.ts b/src/components/gamma/stack/StackHost.types.ts index a57ef13809..2788a1cb26 100644 --- a/src/components/gamma/stack/StackHost.types.ts +++ b/src/components/gamma/stack/StackHost.types.ts @@ -4,7 +4,10 @@ import { type NativeProps } from '../../../fabric/gamma/stack/StackHostNativeCom export type StackHostProps = { children: ViewProps['children']; - ref?: React.RefObject< - (React.Component & ReactNativeElement) | null - >; // TODO: Work on these types + // TODO: Work on these types + ref?: + | React.RefObject< + (React.Component & ReactNativeElement) | null + > + | undefined; }; diff --git a/src/components/gamma/stack/StackScreen.types.ts b/src/components/gamma/stack/StackScreen.types.ts index 8bf01ae543..8deb6c8189 100644 --- a/src/components/gamma/stack/StackScreen.types.ts +++ b/src/components/gamma/stack/StackScreen.types.ts @@ -15,22 +15,22 @@ export type StackScreenEventHandler = ( ) => void; export type StackScreenProps = { - children?: ViewProps['children']; + children?: ViewProps['children'] | undefined; // Control activityMode: StackScreenActivityMode; screenKey: string; // Events - onWillAppear?: StackScreenEventHandler; - onDidAppear?: StackScreenEventHandler; - onWillDisappear?: StackScreenEventHandler; - onDidDisappear?: StackScreenEventHandler; + onWillAppear?: StackScreenEventHandler | undefined; + onDidAppear?: StackScreenEventHandler | undefined; + onWillDisappear?: StackScreenEventHandler | undefined; + onDidDisappear?: StackScreenEventHandler | undefined; - onDismiss?: (screenKey: string) => void; - onNativeDismiss?: (screenKey: string) => void; - onNativeDismissPrevented?: StackScreenEventHandler; + onDismiss?: ((screenKey: string) => void) | undefined; + onNativeDismiss?: ((screenKey: string) => void) | undefined; + onNativeDismissPrevented?: StackScreenEventHandler | undefined; // Configuration - preventNativeDismiss?: boolean; + preventNativeDismiss?: boolean | undefined; }; diff --git a/src/components/tabs/bottom-accessory/TabsBottomAccessory.types.ts b/src/components/tabs/bottom-accessory/TabsBottomAccessory.types.ts index 55d20e624a..d7dbe611ae 100644 --- a/src/components/tabs/bottom-accessory/TabsBottomAccessory.types.ts +++ b/src/components/tabs/bottom-accessory/TabsBottomAccessory.types.ts @@ -7,7 +7,9 @@ export type TabsBottomAccessoryEnvironmentChangeEvent = { }; export type TabsBottomAccessoryProps = ViewProps & { - onEnvironmentChange?: ( - event: NativeSyntheticEvent, - ) => void; + onEnvironmentChange?: + | (( + event: NativeSyntheticEvent, + ) => void) + | undefined; }; diff --git a/src/components/tabs/bottom-accessory/TabsBottomAccessoryContent.types.ts b/src/components/tabs/bottom-accessory/TabsBottomAccessoryContent.types.ts index 3339368069..09b191b1f6 100644 --- a/src/components/tabs/bottom-accessory/TabsBottomAccessoryContent.types.ts +++ b/src/components/tabs/bottom-accessory/TabsBottomAccessoryContent.types.ts @@ -2,5 +2,5 @@ import { ViewProps } from 'react-native'; import { TabsBottomAccessoryEnvironment } from './TabsBottomAccessory.types'; export type TabsBottomAccessoryContentProps = ViewProps & { - environment?: TabsBottomAccessoryEnvironment; + environment?: TabsBottomAccessoryEnvironment | undefined; }; diff --git a/src/components/tabs/host/TabsHost.android.types.ts b/src/components/tabs/host/TabsHost.android.types.ts index 2d575067fb..4f86e43cef 100644 --- a/src/components/tabs/host/TabsHost.android.types.ts +++ b/src/components/tabs/host/TabsHost.android.types.ts @@ -14,5 +14,5 @@ export interface TabsHostPropsAndroid { * @platform android * @supported API 30 or higher */ - tabBarRespectsIMEInsets?: boolean; + tabBarRespectsIMEInsets?: boolean | undefined; } diff --git a/src/components/tabs/host/TabsHost.ios.types.ts b/src/components/tabs/host/TabsHost.ios.types.ts index 1dd7333a6c..da586a2e21 100644 --- a/src/components/tabs/host/TabsHost.ios.types.ts +++ b/src/components/tabs/host/TabsHost.ios.types.ts @@ -45,7 +45,7 @@ export interface TabsHostPropsIOS { * * @platform ios */ - tabBarTintColor?: ColorValue; + tabBarTintColor?: ColorValue | undefined; /** * @summary Specifies the minimize behavior for the tab bar. * @@ -68,7 +68,7 @@ export interface TabsHostPropsIOS { * @platform ios * @supported iOS 26 or higher */ - tabBarMinimizeBehavior?: TabBarMinimizeBehavior; + tabBarMinimizeBehavior?: TabBarMinimizeBehavior | undefined; /** * @summary Specifies component used as bottom accessory. * @@ -98,7 +98,7 @@ export interface TabsHostPropsIOS { * @platform iOS * @supported iOS 26 or higher */ - bottomAccessory?: TabsBottomAccessoryComponentFactory; + bottomAccessory?: TabsBottomAccessoryComponentFactory | undefined; /** * @summary Specifies the display mode for the tab bar. * @@ -119,7 +119,7 @@ export interface TabsHostPropsIOS { * @platform ios * @supported iOS 18 or higher */ - tabBarControllerMode?: TabBarControllerMode; + tabBarControllerMode?: TabBarControllerMode | undefined; /** * @summary * A callback that gets invoked when the user taps the "More" tab bar item. @@ -133,7 +133,7 @@ export interface TabsHostPropsIOS { * * @platform ios */ - onMoreTabSelected?: ( - event: NativeSyntheticEvent, - ) => void; + onMoreTabSelected?: + | ((event: NativeSyntheticEvent) => void) + | undefined; } diff --git a/src/components/tabs/host/TabsHost.types.ts b/src/components/tabs/host/TabsHost.types.ts index daa3c13376..abf5101b4e 100644 --- a/src/components/tabs/host/TabsHost.types.ts +++ b/src/components/tabs/host/TabsHost.types.ts @@ -122,7 +122,7 @@ export type TabsHostNativeContainerStyleProps = { * * @platform android, ios */ - backgroundColor?: ColorValue; + backgroundColor?: ColorValue | undefined; }; // #endregion General helpers @@ -164,10 +164,10 @@ export interface TabsHostPropsBase { * * @default false */ - rejectStaleNavStateUpdates?: boolean; + rejectStaleNavStateUpdates?: boolean | undefined; // General - children?: ViewProps['children']; + children?: ViewProps['children'] | undefined; /** * @summary Hides the tab bar. * @@ -175,7 +175,7 @@ export interface TabsHostPropsBase { * * @platform android, ios */ - tabBarHidden?: boolean; + tabBarHidden?: boolean | undefined; /** * @summary Allows for native container view customization. * @@ -185,7 +185,7 @@ export interface TabsHostPropsBase { * * @platform android, ios */ - nativeContainerStyle?: TabsHostNativeContainerStyleProps; + nativeContainerStyle?: TabsHostNativeContainerStyleProps | undefined; /** * @summary Specifies the layout direction of the native container, its views and child containers. * @@ -211,7 +211,7 @@ export interface TabsHostPropsBase { * * @platform android, ios */ - direction?: TabsHostDirection; + direction?: TabsHostDirection | undefined; /** * @summary Specifies the color scheme used by the container and any child containers. * @@ -224,7 +224,7 @@ export interface TabsHostPropsBase { * * @platform android, ios */ - colorScheme?: TabsHostColorScheme; + colorScheme?: TabsHostColorScheme | undefined; // Experimental support /** @@ -243,7 +243,7 @@ export interface TabsHostPropsBase { * * @platform android, ios */ - experimentalControlNavigationStateInJS?: boolean; + experimentalControlNavigationStateInJS?: boolean | undefined; // Events /** @@ -251,7 +251,9 @@ export interface TabsHostPropsBase { * * @platform android, ios */ - onTabSelected?: (event: NativeSyntheticEvent) => void; + onTabSelected?: + | ((event: NativeSyntheticEvent) => void) + | undefined; /** * @summary @@ -259,9 +261,9 @@ export interface TabsHostPropsBase { * * @see {@link TabSelectionRejectedEvent} */ - onTabSelectionRejected?: ( - event: NativeSyntheticEvent, - ) => void; + onTabSelectionRejected?: + | ((event: NativeSyntheticEvent) => void) + | undefined; /** * @summary @@ -270,12 +272,12 @@ export interface TabsHostPropsBase { * * @see {@link TabSelectionPreventedEvent} */ - onTabSelectionPrevented?: ( - event: NativeSyntheticEvent, - ) => void; + onTabSelectionPrevented?: + | ((event: NativeSyntheticEvent) => void) + | undefined; } export interface TabsHostProps extends TabsHostPropsBase { - ios?: TabsHostPropsIOS; - android?: TabsHostPropsAndroid; + ios?: TabsHostPropsIOS | undefined; + android?: TabsHostPropsAndroid | undefined; } diff --git a/src/components/tabs/screen/TabsScreen.android.types.ts b/src/components/tabs/screen/TabsScreen.android.types.ts index fb7ec983bd..2e3b25bbeb 100644 --- a/src/components/tabs/screen/TabsScreen.android.types.ts +++ b/src/components/tabs/screen/TabsScreen.android.types.ts @@ -13,13 +13,13 @@ export interface TabsScreenItemStateAppearanceAndroid { * * @platform android */ - tabBarItemTitleFontColor?: TextStyle['color']; + tabBarItemTitleFontColor?: TextStyle['color'] | undefined; /** * @summary Specifies the icon color for each tab bar item. * * @platform android */ - tabBarItemIconColor?: ColorValue; + tabBarItemIconColor?: ColorValue | undefined; } export interface TabsScreenAppearanceAndroid { @@ -28,13 +28,13 @@ export interface TabsScreenAppearanceAndroid { * * @platform android */ - tabBarBackgroundColor?: ColorValue; + tabBarBackgroundColor?: ColorValue | undefined; /** * @summary Specifies the color of each tab bar item's ripple effect. * * @platform android */ - tabBarItemRippleColor?: ColorValue; + tabBarItemRippleColor?: ColorValue | undefined; /** * @summary Specifies the label visibility mode. * @@ -53,14 +53,14 @@ export interface TabsScreenAppearanceAndroid { * * @platform android */ - tabBarItemLabelVisibilityMode?: TabBarItemLabelVisibilityMode; + tabBarItemLabelVisibilityMode?: TabBarItemLabelVisibilityMode | undefined; /** * Defines the colors for all tab bar items which are in their enabled, unselected and unfocused state. * The color scheme is determined by the configuration of the currently selected tab. * * @platform android */ - normal?: TabsScreenItemStateAppearanceAndroid; + normal?: TabsScreenItemStateAppearanceAndroid | undefined; /** * Defines the colors for the tab bar item that is currently active. * The color scheme is determined by the configuration of the currently selected tab itself. @@ -68,7 +68,7 @@ export interface TabsScreenAppearanceAndroid { * * @platform android */ - selected?: TabsScreenItemStateAppearanceAndroid; + selected?: TabsScreenItemStateAppearanceAndroid | undefined; /** * Defines the colors for a tab bar item when it receives focus. * The color scheme is determined by the configuration of the currently selected tab. @@ -76,7 +76,7 @@ export interface TabsScreenAppearanceAndroid { * * @platform android */ - focused?: TabsScreenItemStateAppearanceAndroid; + focused?: TabsScreenItemStateAppearanceAndroid | undefined; /** * Defines the colors for tab bar items when they are disabled. * The color scheme is determined by the configuration of the currently selected tab. @@ -84,13 +84,13 @@ export interface TabsScreenAppearanceAndroid { * * @platform android */ - disabled?: TabsScreenItemStateAppearanceAndroid; + disabled?: TabsScreenItemStateAppearanceAndroid | undefined; /** * @summary Specifies the background color of the active indicator. * * @platform android */ - tabBarItemActiveIndicatorColor?: ColorValue; + tabBarItemActiveIndicatorColor?: ColorValue | undefined; /** * @summary Specifies if the active indicator should be used. * @@ -98,13 +98,13 @@ export interface TabsScreenAppearanceAndroid { * * @platform android */ - tabBarItemActiveIndicatorEnabled?: boolean; + tabBarItemActiveIndicatorEnabled?: boolean | undefined; /** * @summary Specifies the font family used for the title of each tab bar item. * * @platform android */ - tabBarItemTitleFontFamily?: TextStyle['fontFamily']; + tabBarItemTitleFontFamily?: TextStyle['fontFamily'] | undefined; /** * @summary Specifies the font size used for the title of unselected tab bar items. * @@ -112,7 +112,7 @@ export interface TabsScreenAppearanceAndroid { * * @platform android */ - tabBarItemTitleSmallLabelFontSize?: TextStyle['fontSize']; + tabBarItemTitleSmallLabelFontSize?: TextStyle['fontSize'] | undefined; /** * @summary Specifies the font size used for the title of selected tab bar item. * @@ -120,31 +120,31 @@ export interface TabsScreenAppearanceAndroid { * * @platform android */ - tabBarItemTitleLargeLabelFontSize?: TextStyle['fontSize']; + tabBarItemTitleLargeLabelFontSize?: TextStyle['fontSize'] | undefined; /** * @summary Specifies the font weight used for the title of each tab bar item. * * @platform android */ - tabBarItemTitleFontWeight?: TextStyle['fontWeight']; + tabBarItemTitleFontWeight?: TextStyle['fontWeight'] | undefined; /** * @summary Specifies the font style used for the title of each tab bar item. * * @platform android */ - tabBarItemTitleFontStyle?: TextStyle['fontStyle']; + tabBarItemTitleFontStyle?: TextStyle['fontStyle'] | undefined; /** * @summary Specifies the background color of the badge. * * @platform android */ - tabBarItemBadgeBackgroundColor?: ColorValue; + tabBarItemBadgeBackgroundColor?: ColorValue | undefined; /** * @summary Specifies the text color of the badge. * * @platform android */ - tabBarItemBadgeTextColor?: ColorValue; + tabBarItemBadgeTextColor?: ColorValue | undefined; } export interface TabsScreenPropsAndroid { @@ -157,7 +157,7 @@ export interface TabsScreenPropsAndroid { * * @platform android */ - standardAppearance?: TabsScreenAppearanceAndroid; + standardAppearance?: TabsScreenAppearanceAndroid | undefined; /** * @summary Specifies the icon for the tab bar item. * @@ -175,7 +175,7 @@ export interface TabsScreenPropsAndroid { * * @platform android */ - icon?: PlatformIconAndroid; + icon?: PlatformIconAndroid | undefined; /** * @summary Specifies the icon for tab bar item when it is selected. * @@ -185,5 +185,5 @@ export interface TabsScreenPropsAndroid { * * @platform android */ - selectedIcon?: PlatformIconAndroid; + selectedIcon?: PlatformIconAndroid | undefined; } diff --git a/src/components/tabs/screen/TabsScreen.ios.types.ts b/src/components/tabs/screen/TabsScreen.ios.types.ts index 84ad13eeb4..2dbbb263f6 100644 --- a/src/components/tabs/screen/TabsScreen.ios.types.ts +++ b/src/components/tabs/screen/TabsScreen.ios.types.ts @@ -31,7 +31,7 @@ export interface TabsScreenAppearanceIOS { * * @platform ios */ - stacked?: TabsScreenItemAppearanceIOS; + stacked?: TabsScreenItemAppearanceIOS | undefined; /** * @summary Specifies the appearance of tab bar items when they are in inline layout. * @@ -43,7 +43,7 @@ export interface TabsScreenAppearanceIOS { * * @platform ios */ - inline?: TabsScreenItemAppearanceIOS; + inline?: TabsScreenItemAppearanceIOS | undefined; /** * @summary Specifies the appearance of tab bar items when they are in compact inline layout. * @@ -55,7 +55,7 @@ export interface TabsScreenAppearanceIOS { * * @platform ios */ - compactInline?: TabsScreenItemAppearanceIOS; + compactInline?: TabsScreenItemAppearanceIOS | undefined; /** * @summary Specifies the background color for the entire tab bar when tab screen is selected. @@ -65,7 +65,7 @@ export interface TabsScreenAppearanceIOS { * @platform ios * @supported iOS 18 or lower */ - tabBarBackgroundColor?: ColorValue; + tabBarBackgroundColor?: ColorValue | undefined; /** * @summary Specifies the blur effect applied to the tab bar when tab screen is selected. * @@ -87,7 +87,7 @@ export interface TabsScreenAppearanceIOS { * @platform ios * @supported iOS 18 or lower */ - tabBarBlurEffect?: TabsScreenBlurEffect; + tabBarBlurEffect?: TabsScreenBlurEffect | undefined; /** * @summary Specifies the shadow color for the tab bar when tab screen is selected. * @@ -96,7 +96,7 @@ export interface TabsScreenAppearanceIOS { * @platform ios * @supported iOS 18 or lower */ - tabBarShadowColor?: ColorValue; + tabBarShadowColor?: ColorValue | undefined; } export interface TabsScreenItemAppearanceIOS { @@ -106,28 +106,28 @@ export interface TabsScreenItemAppearanceIOS { * * @platform ios */ - normal?: TabsScreenItemStateAppearanceIOS; + normal?: TabsScreenItemStateAppearanceIOS | undefined; /** * Defines appearance for the tab bar item that is currently active. * The appearance is determined by the configuration of the currently selected tab itself. * * @platform ios */ - selected?: TabsScreenItemStateAppearanceIOS; + selected?: TabsScreenItemStateAppearanceIOS | undefined; /** * Defines appearance for a tab bar item when it receives focus. * The appearance is determined by the configuration of the currently selected tab. * * @platform ios */ - focused?: TabsScreenItemStateAppearanceIOS; + focused?: TabsScreenItemStateAppearanceIOS | undefined; /** * Defines appearance for tab bar items when they are disabled. * The appearance is determined by the configuration of the currently selected tab. * * @platform ios */ - disabled?: TabsScreenItemStateAppearanceIOS; + disabled?: TabsScreenItemStateAppearanceIOS | undefined; } export interface TabsScreenItemStateAppearanceIOS { @@ -137,28 +137,28 @@ export interface TabsScreenItemStateAppearanceIOS { * * @platform ios */ - tabBarItemTitleFontFamily?: TextStyle['fontFamily']; + tabBarItemTitleFontFamily?: TextStyle['fontFamily'] | undefined; /** * @summary Specifies the font size used for the title of each tab bar item * when tab screen is selected. * * @platform ios */ - tabBarItemTitleFontSize?: TextStyle['fontSize']; + tabBarItemTitleFontSize?: TextStyle['fontSize'] | undefined; /** * @summary Specifies the font weight used for the title of each tab bar item * when tab screen is selected. * * @platform ios */ - tabBarItemTitleFontWeight?: TextStyle['fontWeight']; + tabBarItemTitleFontWeight?: TextStyle['fontWeight'] | undefined; /** * @summary Specifies the font style used for the title of each tab bar item * when tab screen is selected. * * @platform ios */ - tabBarItemTitleFontStyle?: TextStyle['fontStyle']; + tabBarItemTitleFontStyle?: TextStyle['fontStyle'] | undefined; /** * @summary Specifies the font color used for the title of each tab bar item * when tab screen is selected. @@ -167,7 +167,7 @@ export interface TabsScreenItemStateAppearanceIOS { * * @platform ios */ - tabBarItemTitleFontColor?: TextStyle['color']; + tabBarItemTitleFontColor?: TextStyle['color'] | undefined; /** * @summary Specifies the title offset for each tab bar item when tab screen * is selected. @@ -177,10 +177,12 @@ export interface TabsScreenItemStateAppearanceIOS { * * @platform ios */ - tabBarItemTitlePositionAdjustment?: { - horizontal?: number; - vertical?: number; - }; + tabBarItemTitlePositionAdjustment?: + | { + horizontal?: number | undefined; + vertical?: number | undefined; + } + | undefined; /** * @summary Specifies the icon color for each tab bar item when tab screen * is selected. @@ -195,14 +197,14 @@ export interface TabsScreenItemStateAppearanceIOS { * * @platform ios */ - tabBarItemIconColor?: ColorValue; + tabBarItemIconColor?: ColorValue | undefined; /** * @summary Specifies the background color of badges for each tab bar item * when tab screen is selected. * * @platform ios */ - tabBarItemBadgeBackgroundColor?: ColorValue; + tabBarItemBadgeBackgroundColor?: ColorValue | undefined; } export interface TabsScreenPropsIOS { @@ -214,7 +216,7 @@ export interface TabsScreenPropsIOS { * * @platform ios */ - standardAppearance?: TabsScreenAppearanceIOS; + standardAppearance?: TabsScreenAppearanceIOS | undefined; /** * @summary Specifies the tab bar appearace when edge of scrollable content aligns * with the edge of the tab bar. @@ -227,7 +229,7 @@ export interface TabsScreenPropsIOS { * * @platform ios */ - scrollEdgeAppearance?: TabsScreenAppearanceIOS; + scrollEdgeAppearance?: TabsScreenAppearanceIOS | undefined; /** * @summary Specifies the icon for the tab bar item. * @@ -248,7 +250,7 @@ export interface TabsScreenPropsIOS { * * @platform ios */ - icon?: PlatformIconIOS; + icon?: PlatformIconIOS | undefined; /** * @summary Specifies the icon for tab bar item when it is selected. * @@ -258,7 +260,7 @@ export interface TabsScreenPropsIOS { * * @platform ios */ - selectedIcon?: PlatformIconIOS; + selectedIcon?: PlatformIconIOS | undefined; /** * @summary System-provided tab bar item with predefined icon and title * @@ -271,7 +273,7 @@ export interface TabsScreenPropsIOS { * * @platform ios */ - systemItem?: TabsScreenSystemItem; + systemItem?: TabsScreenSystemItem | undefined; /** * @summary Specifies if `contentInsetAdjustmentBehavior` of first ScrollView * in first descendant chain from tab screen should be overridden back from `never` @@ -288,7 +290,7 @@ export interface TabsScreenPropsIOS { * * @platform ios */ - overrideScrollViewContentInsetAdjustmentBehavior?: boolean; + overrideScrollViewContentInsetAdjustmentBehavior?: boolean | undefined; /** * Configures the scroll edge effect for the _content ScrollView_ (the ScrollView that is present in first descendants chain of the Screen). * Depending on values set, it will blur the scrolling content below certain UI elements (header items, search bar) @@ -315,12 +317,14 @@ export interface TabsScreenPropsIOS { * * @supported iOS 26 or higher */ - scrollEdgeEffects?: { - bottom?: ScrollEdgeEffect; - left?: ScrollEdgeEffect; - right?: ScrollEdgeEffect; - top?: ScrollEdgeEffect; - }; + scrollEdgeEffects?: + | { + bottom?: ScrollEdgeEffect | undefined; + left?: ScrollEdgeEffect | undefined; + right?: ScrollEdgeEffect | undefined; + top?: ScrollEdgeEffect | undefined; + } + | undefined; /** * @summary Allows to override system appearance for the tab bar. * @@ -342,5 +346,5 @@ export interface TabsScreenPropsIOS { * * @platform ios */ - experimental_userInterfaceStyle?: UserInterfaceStyle; + experimental_userInterfaceStyle?: UserInterfaceStyle | undefined; } diff --git a/src/components/tabs/screen/TabsScreen.types.ts b/src/components/tabs/screen/TabsScreen.types.ts index 87b5eba39d..fb6ab58075 100644 --- a/src/components/tabs/screen/TabsScreen.types.ts +++ b/src/components/tabs/screen/TabsScreen.types.ts @@ -37,17 +37,17 @@ export interface TabsScreenPropsBase { * * @platform android, ios */ - preventNativeSelection?: boolean; + preventNativeSelection?: boolean | undefined; // General - children?: ViewProps['children']; - style?: StyleProp>; + children?: ViewProps['children'] | undefined; + style?: StyleProp> | undefined; /** * @summary Title of the tab screen, displayed in the tab bar item. * * @platform android, ios */ - title?: string; + title?: string | undefined; /** * @summary Specifies content of tab bar item badge. * @@ -60,7 +60,7 @@ export interface TabsScreenPropsBase { * * @platform android, ios */ - badgeValue?: string; + badgeValue?: string | undefined; /** * @summary Specifies which special effects (also known as microinteractions) * are enabled for the tab screen. @@ -79,18 +79,22 @@ export interface TabsScreenPropsBase { * * @platform android, ios */ - specialEffects?: { - repeatedTabSelection?: { - /** - * @default true - */ - popToRoot?: boolean; - /** - * @default true - */ - scrollToTop?: boolean; - }; - }; + specialEffects?: + | { + repeatedTabSelection?: + | { + /** + * @default true + */ + popToRoot?: boolean | undefined; + /** + * @default true + */ + scrollToTop?: boolean | undefined; + } + | undefined; + } + | undefined; /** * @summary Specifies supported orientations for the tab screen. * @@ -139,27 +143,27 @@ export interface TabsScreenPropsBase { * * @platform ios */ - orientation?: TabsScreenOrientation; + orientation?: TabsScreenOrientation | undefined; // Accessibility /** * @summary testID for the TabsScreen */ - testID?: string; + testID?: string | undefined; /** * @summary accessibilityLabel for the TabsScreen */ - accessibilityLabel?: string; + accessibilityLabel?: string | undefined; /** * @summary testID for the TabBarItem */ - tabBarItemTestID?: string; + tabBarItemTestID?: string | undefined; /** * @summary accessibilityLabel for the TabBarItem * * @supported iOS, Android API level >=26 */ - tabBarItemAccessibilityLabel?: string; + tabBarItemAccessibilityLabel?: string | undefined; // Events /** @@ -168,31 +172,31 @@ export interface TabsScreenPropsBase { * * @platform android, ios */ - onWillAppear?: TabsScreenEventHandler; + onWillAppear?: TabsScreenEventHandler | undefined; /** * @summary A callback that gets invoked when the tab screen did appear. * This is called as soon as the transition ends. * * @platform android, ios */ - onDidAppear?: TabsScreenEventHandler; + onDidAppear?: TabsScreenEventHandler | undefined; /** * @summary A callback that gets invoked when the tab screen will disappear. * This is called as soon as the transition begins. * * @platform android, ios */ - onWillDisappear?: TabsScreenEventHandler; + onWillDisappear?: TabsScreenEventHandler | undefined; /** * @summary A callback that gets invoked when the tab screen did disappear. * This is called as soon as the transition ends. * * @platform android, ios */ - onDidDisappear?: TabsScreenEventHandler; + onDidDisappear?: TabsScreenEventHandler | undefined; } export interface TabsScreenProps extends TabsScreenPropsBase { - ios?: TabsScreenPropsIOS; - android?: TabsScreenPropsAndroid; + ios?: TabsScreenPropsIOS | undefined; + android?: TabsScreenPropsAndroid | undefined; } diff --git a/src/fabric/FullWindowOverlayNativeComponent.ts b/src/fabric/FullWindowOverlayNativeComponent.ts index 4906480c7f..0192291528 100644 --- a/src/fabric/FullWindowOverlayNativeComponent.ts +++ b/src/fabric/FullWindowOverlayNativeComponent.ts @@ -5,7 +5,7 @@ import type { CodegenTypes as CT, ViewProps } from 'react-native'; // Internal export, not part of stable library API. export interface NativeProps extends ViewProps { - accessibilityContainerViewIsModal?: CT.WithDefault; + accessibilityContainerViewIsModal?: CT.WithDefault | undefined; } export default codegenNativeComponent('RNSFullWindowOverlay', { diff --git a/src/fabric/ModalScreenNativeComponent.ts b/src/fabric/ModalScreenNativeComponent.ts index 61bd78f0a3..ba4750f59b 100644 --- a/src/fabric/ModalScreenNativeComponent.ts +++ b/src/fabric/ModalScreenNativeComponent.ts @@ -83,45 +83,59 @@ export interface NativeProps extends ViewProps { onSheetDetentChanged?: | CT.DirectEventHandler | undefined; - screenId?: CT.WithDefault; + screenId?: CT.WithDefault | undefined; sheetAllowedDetents?: number[] | undefined; - sheetLargestUndimmedDetent?: CT.WithDefault; - sheetGrabberVisible?: CT.WithDefault; - sheetCornerRadius?: CT.WithDefault; - sheetExpandsWhenScrolledToEdge?: CT.WithDefault; - sheetInitialDetent?: CT.WithDefault; - sheetElevation?: CT.WithDefault; - sheetShouldOverflowTopInset?: CT.WithDefault; - sheetDefaultResizeAnimationEnabled?: CT.WithDefault; - customAnimationOnSwipe?: boolean; - fullScreenSwipeEnabled?: CT.WithDefault; - fullScreenSwipeShadowEnabled?: CT.WithDefault; - homeIndicatorHidden?: boolean; - preventNativeDismiss?: boolean; - gestureEnabled?: CT.WithDefault; - statusBarColor?: ColorValue; - statusBarHidden?: boolean; - screenOrientation?: string; - statusBarAnimation?: string; - statusBarStyle?: string; - statusBarTranslucent?: boolean; - gestureResponseDistance?: GestureResponseDistanceType; - stackPresentation?: CT.WithDefault; - stackAnimation?: CT.WithDefault; - transitionDuration?: CT.WithDefault; - replaceAnimation?: CT.WithDefault; - swipeDirection?: CT.WithDefault; - hideKeyboardOnSwipe?: boolean; - activityState?: CT.WithDefault; - navigationBarColor?: ColorValue; - navigationBarTranslucent?: boolean; - navigationBarHidden?: boolean; - nativeBackButtonDismissalEnabled?: boolean; - bottomScrollEdgeEffect?: CT.WithDefault; - leftScrollEdgeEffect?: CT.WithDefault; - rightScrollEdgeEffect?: CT.WithDefault; - topScrollEdgeEffect?: CT.WithDefault; - synchronousShadowStateUpdatesEnabled?: CT.WithDefault; + sheetLargestUndimmedDetent?: CT.WithDefault | undefined; + sheetGrabberVisible?: CT.WithDefault | undefined; + sheetCornerRadius?: CT.WithDefault | undefined; + sheetExpandsWhenScrolledToEdge?: CT.WithDefault | undefined; + sheetInitialDetent?: CT.WithDefault | undefined; + sheetElevation?: CT.WithDefault | undefined; + sheetShouldOverflowTopInset?: CT.WithDefault | undefined; + sheetDefaultResizeAnimationEnabled?: + | CT.WithDefault + | undefined; + customAnimationOnSwipe?: boolean | undefined; + fullScreenSwipeEnabled?: + | CT.WithDefault + | undefined; + fullScreenSwipeShadowEnabled?: CT.WithDefault | undefined; + homeIndicatorHidden?: boolean | undefined; + preventNativeDismiss?: boolean | undefined; + gestureEnabled?: CT.WithDefault | undefined; + statusBarColor?: ColorValue | undefined; + statusBarHidden?: boolean | undefined; + screenOrientation?: string | undefined; + statusBarAnimation?: string | undefined; + statusBarStyle?: string | undefined; + statusBarTranslucent?: boolean | undefined; + gestureResponseDistance?: GestureResponseDistanceType | undefined; + stackPresentation?: CT.WithDefault | undefined; + stackAnimation?: CT.WithDefault | undefined; + transitionDuration?: CT.WithDefault | undefined; + replaceAnimation?: CT.WithDefault | undefined; + swipeDirection?: CT.WithDefault | undefined; + hideKeyboardOnSwipe?: boolean | undefined; + activityState?: CT.WithDefault | undefined; + navigationBarColor?: ColorValue | undefined; + navigationBarTranslucent?: boolean | undefined; + navigationBarHidden?: boolean | undefined; + nativeBackButtonDismissalEnabled?: boolean | undefined; + bottomScrollEdgeEffect?: + | CT.WithDefault + | undefined; + leftScrollEdgeEffect?: + | CT.WithDefault + | undefined; + rightScrollEdgeEffect?: + | CT.WithDefault + | undefined; + topScrollEdgeEffect?: + | CT.WithDefault + | undefined; + synchronousShadowStateUpdatesEnabled?: + | CT.WithDefault + | undefined; } export default codegenNativeComponent('RNSModalScreen', { diff --git a/src/fabric/ScreenNativeComponent.ts b/src/fabric/ScreenNativeComponent.ts index d4beb57350..91d89f297c 100644 --- a/src/fabric/ScreenNativeComponent.ts +++ b/src/fabric/ScreenNativeComponent.ts @@ -83,50 +83,65 @@ export interface NativeProps extends ViewProps { onSheetDetentChanged?: | CT.DirectEventHandler | undefined; - screenId?: CT.WithDefault; + screenId?: CT.WithDefault | undefined; sheetAllowedDetents?: number[] | undefined; - sheetLargestUndimmedDetent?: CT.WithDefault; - sheetGrabberVisible?: CT.WithDefault; - sheetCornerRadius?: CT.WithDefault; - sheetExpandsWhenScrolledToEdge?: CT.WithDefault; - sheetInitialDetent?: CT.WithDefault; - sheetElevation?: CT.WithDefault; - sheetShouldOverflowTopInset?: CT.WithDefault; - sheetDefaultResizeAnimationEnabled?: CT.WithDefault; - customAnimationOnSwipe?: boolean; - fullScreenSwipeEnabled?: CT.WithDefault; - fullScreenSwipeShadowEnabled?: CT.WithDefault; - homeIndicatorHidden?: boolean; - preventNativeDismiss?: boolean; - gestureEnabled?: CT.WithDefault; - statusBarColor?: ColorValue; - statusBarHidden?: boolean; - screenOrientation?: string; - statusBarAnimation?: string; - statusBarStyle?: string; - statusBarTranslucent?: boolean; - gestureResponseDistance?: GestureResponseDistanceType; - stackPresentation?: CT.WithDefault; - stackAnimation?: CT.WithDefault; - transitionDuration?: CT.WithDefault; - replaceAnimation?: CT.WithDefault; - swipeDirection?: CT.WithDefault; - hideKeyboardOnSwipe?: boolean; - activityState?: CT.WithDefault; - navigationBarColor?: ColorValue; - navigationBarTranslucent?: boolean; - navigationBarHidden?: boolean; - nativeBackButtonDismissalEnabled?: boolean; - bottomScrollEdgeEffect?: CT.WithDefault; - leftScrollEdgeEffect?: CT.WithDefault; - rightScrollEdgeEffect?: CT.WithDefault; - topScrollEdgeEffect?: CT.WithDefault; - synchronousShadowStateUpdatesEnabled?: CT.WithDefault; - androidResetScreenShadowStateOnOrientationChangeEnabled?: CT.WithDefault< - boolean, - true - >; - ios26AllowInteractionsDuringTransition?: CT.WithDefault; + sheetLargestUndimmedDetent?: CT.WithDefault | undefined; + sheetGrabberVisible?: CT.WithDefault | undefined; + sheetCornerRadius?: CT.WithDefault | undefined; + sheetExpandsWhenScrolledToEdge?: CT.WithDefault | undefined; + sheetInitialDetent?: CT.WithDefault | undefined; + sheetElevation?: CT.WithDefault | undefined; + sheetShouldOverflowTopInset?: CT.WithDefault | undefined; + sheetDefaultResizeAnimationEnabled?: + | CT.WithDefault + | undefined; + customAnimationOnSwipe?: boolean | undefined; + fullScreenSwipeEnabled?: + | CT.WithDefault + | undefined; + fullScreenSwipeShadowEnabled?: CT.WithDefault | undefined; + homeIndicatorHidden?: boolean | undefined; + preventNativeDismiss?: boolean | undefined; + gestureEnabled?: CT.WithDefault | undefined; + statusBarColor?: ColorValue | undefined; + statusBarHidden?: boolean | undefined; + screenOrientation?: string | undefined; + statusBarAnimation?: string | undefined; + statusBarStyle?: string | undefined; + statusBarTranslucent?: boolean | undefined; + gestureResponseDistance?: GestureResponseDistanceType | undefined; + stackPresentation?: CT.WithDefault | undefined; + stackAnimation?: CT.WithDefault | undefined; + transitionDuration?: CT.WithDefault | undefined; + replaceAnimation?: CT.WithDefault | undefined; + swipeDirection?: CT.WithDefault | undefined; + hideKeyboardOnSwipe?: boolean | undefined; + activityState?: CT.WithDefault | undefined; + navigationBarColor?: ColorValue | undefined; + navigationBarTranslucent?: boolean | undefined; + navigationBarHidden?: boolean | undefined; + nativeBackButtonDismissalEnabled?: boolean | undefined; + bottomScrollEdgeEffect?: + | CT.WithDefault + | undefined; + leftScrollEdgeEffect?: + | CT.WithDefault + | undefined; + rightScrollEdgeEffect?: + | CT.WithDefault + | undefined; + topScrollEdgeEffect?: + | CT.WithDefault + | undefined; + synchronousShadowStateUpdatesEnabled?: + | CT.WithDefault + | undefined; + androidResetScreenShadowStateOnOrientationChangeEnabled?: + | CT.WithDefault + | undefined; + ios26AllowInteractionsDuringTransition?: + | CT.WithDefault + | undefined; } export default codegenNativeComponent('RNSScreen', { diff --git a/src/fabric/ScreenStackHeaderConfigNativeComponent.ts b/src/fabric/ScreenStackHeaderConfigNativeComponent.ts index 468727a11f..82ffbe8d41 100644 --- a/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +++ b/src/fabric/ScreenStackHeaderConfigNativeComponent.ts @@ -41,37 +41,39 @@ type BlurEffect = type UserInterfaceStyle = 'unspecified' | 'light' | 'dark'; export interface NativeProps extends ViewProps { - onAttached?: CT.DirectEventHandler; - onDetached?: CT.DirectEventHandler; - backgroundColor?: ColorValue; - backTitle?: string; - backTitleFontFamily?: string; - backTitleFontSize?: CT.Int32; - backTitleVisible?: CT.WithDefault; - color?: ColorValue; - direction?: CT.WithDefault; - hidden?: boolean; - hideShadow?: boolean; - largeTitle?: boolean; - largeTitleFontFamily?: string; - largeTitleFontSize?: CT.Int32; - largeTitleFontWeight?: string; - largeTitleBackgroundColor?: ColorValue; - largeTitleHideShadow?: boolean; - largeTitleColor?: ColorValue; - translucent?: boolean; - title?: string; - titleFontFamily?: string; - titleFontSize?: CT.Int32; - titleFontWeight?: string; - titleColor?: ColorValue; - disableBackButtonMenu?: boolean; - backButtonDisplayMode?: CT.WithDefault; - hideBackButton?: boolean; - backButtonInCustomView?: boolean; - blurEffect?: CT.WithDefault; + onAttached?: CT.DirectEventHandler | undefined; + onDetached?: CT.DirectEventHandler | undefined; + backgroundColor?: ColorValue | undefined; + backTitle?: string | undefined; + backTitleFontFamily?: string | undefined; + backTitleFontSize?: CT.Int32 | undefined; + backTitleVisible?: CT.WithDefault | undefined; + color?: ColorValue | undefined; + direction?: CT.WithDefault | undefined; + hidden?: boolean | undefined; + hideShadow?: boolean | undefined; + largeTitle?: boolean | undefined; + largeTitleFontFamily?: string | undefined; + largeTitleFontSize?: CT.Int32 | undefined; + largeTitleFontWeight?: string | undefined; + largeTitleBackgroundColor?: ColorValue | undefined; + largeTitleHideShadow?: boolean | undefined; + largeTitleColor?: ColorValue | undefined; + translucent?: boolean | undefined; + title?: string | undefined; + titleFontFamily?: string | undefined; + titleFontSize?: CT.Int32 | undefined; + titleFontWeight?: string | undefined; + titleColor?: ColorValue | undefined; + disableBackButtonMenu?: boolean | undefined; + backButtonDisplayMode?: + | CT.WithDefault + | undefined; + hideBackButton?: boolean | undefined; + backButtonInCustomView?: boolean | undefined; + blurEffect?: CT.WithDefault | undefined; // TODO: implement this props on iOS - topInsetEnabled?: boolean; + topInsetEnabled?: boolean | undefined; headerLeftBarButtonItems?: CT.UnsafeMixed[] | undefined; headerRightBarButtonItems?: CT.UnsafeMixed[] | undefined; onPressHeaderBarButtonItem?: @@ -80,12 +82,16 @@ export interface NativeProps extends ViewProps { onPressHeaderBarButtonMenuItem?: | CT.DirectEventHandler | undefined; - synchronousShadowStateUpdatesEnabled?: CT.WithDefault; + synchronousShadowStateUpdatesEnabled?: + | CT.WithDefault + | undefined; // Experimental - userInterfaceStyle?: CT.WithDefault; - consumeTopInset?: boolean; - legacyTopInsetBehavior?: boolean; + userInterfaceStyle?: + | CT.WithDefault + | undefined; + consumeTopInset?: boolean | undefined; + legacyTopInsetBehavior?: boolean | undefined; } export default codegenNativeComponent( diff --git a/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts b/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts index 61da7f7c36..91df5d6a1b 100644 --- a/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts +++ b/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts @@ -12,9 +12,11 @@ export type HeaderSubviewTypes = | 'searchBar'; export interface NativeProps extends ViewProps { - type?: CT.WithDefault; - hidesSharedBackground?: boolean; - synchronousShadowStateUpdatesEnabled?: CT.WithDefault; + type?: CT.WithDefault | undefined; + hidesSharedBackground?: boolean | undefined; + synchronousShadowStateUpdatesEnabled?: + | CT.WithDefault + | undefined; } export default codegenNativeComponent( diff --git a/src/fabric/ScreenStackNativeComponent.ts b/src/fabric/ScreenStackNativeComponent.ts index 9bfaf3cf39..44da23978f 100644 --- a/src/fabric/ScreenStackNativeComponent.ts +++ b/src/fabric/ScreenStackNativeComponent.ts @@ -7,8 +7,12 @@ import type { CodegenTypes as CT, ViewProps, ColorValue } from 'react-native'; type FinishTransitioningEvent = Readonly<{}>; export interface NativeProps extends ViewProps { - iosPreventReattachmentOfDismissedScreens?: CT.WithDefault; - iosPreventReattachmentOfDismissedModals?: CT.WithDefault; + iosPreventReattachmentOfDismissedScreens?: + | CT.WithDefault + | undefined; + iosPreventReattachmentOfDismissedModals?: + | CT.WithDefault + | undefined; nativeContainerBackgroundColor?: ColorValue | undefined; diff --git a/src/fabric/SearchBarNativeComponent.ts b/src/fabric/SearchBarNativeComponent.ts index df774b955f..8c7f4b5c4b 100644 --- a/src/fabric/SearchBarNativeComponent.ts +++ b/src/fabric/SearchBarNativeComponent.ts @@ -12,11 +12,11 @@ import type { export type SearchBarEvent = Readonly<{}>; export type SearchButtonPressedEvent = Readonly<{ - text?: string; + text?: string | undefined; }>; export type ChangeTextEvent = Readonly<{ - text?: string; + text?: string | undefined; }>; type SearchBarPlacement = @@ -37,34 +37,42 @@ type AutoCapitalizeType = type OptionalBoolean = 'undefined' | 'false' | 'true'; export interface NativeProps extends ViewProps { - onSearchFocus?: CT.DirectEventHandler | null; - onSearchBlur?: CT.DirectEventHandler | null; - onSearchButtonPress?: CT.DirectEventHandler | null; - onCancelButtonPress?: CT.DirectEventHandler | null; - onChangeText?: CT.DirectEventHandler | null; - hideWhenScrolling?: CT.WithDefault; - autoCapitalize?: CT.WithDefault; - placeholder?: string; - placement?: CT.WithDefault; - allowToolbarIntegration?: CT.WithDefault; - obscureBackground?: CT.WithDefault; - hideNavigationBar?: CT.WithDefault; - cancelButtonText?: string; + onSearchFocus?: CT.DirectEventHandler | null | undefined; + onSearchBlur?: CT.DirectEventHandler | null | undefined; + onSearchButtonPress?: + | CT.DirectEventHandler + | null + | undefined; + onCancelButtonPress?: + | CT.DirectEventHandler + | null + | undefined; + onChangeText?: CT.DirectEventHandler | null | undefined; + hideWhenScrolling?: CT.WithDefault | undefined; + autoCapitalize?: + | CT.WithDefault + | undefined; + placeholder?: string | undefined; + placement?: CT.WithDefault | undefined; + allowToolbarIntegration?: CT.WithDefault | undefined; + obscureBackground?: CT.WithDefault | undefined; + hideNavigationBar?: CT.WithDefault | undefined; + cancelButtonText?: string | undefined; // TODO: implement these on iOS - barTintColor?: ColorValue; - tintColor?: ColorValue; - textColor?: ColorValue; + barTintColor?: ColorValue | undefined; + tintColor?: ColorValue | undefined; + textColor?: ColorValue | undefined; // Android only - autoFocus?: CT.WithDefault; - disableBackButtonOverride?: boolean; + autoFocus?: CT.WithDefault | undefined; + disableBackButtonOverride?: boolean | undefined; // TODO: consider creating enum here - inputType?: string; - onClose?: CT.DirectEventHandler | null; - onOpen?: CT.DirectEventHandler | null; - hintTextColor?: ColorValue; - headerIconColor?: ColorValue; - shouldShowHintSearchIcon?: CT.WithDefault; + inputType?: string | undefined; + onClose?: CT.DirectEventHandler | null | undefined; + onOpen?: CT.DirectEventHandler | null | undefined; + hintTextColor?: ColorValue | undefined; + headerIconColor?: ColorValue | undefined; + shouldShowHintSearchIcon?: CT.WithDefault | undefined; } type ComponentType = HostComponent; diff --git a/src/fabric/gamma/ScrollViewMarkerNativeComponent.ts b/src/fabric/gamma/ScrollViewMarkerNativeComponent.ts index e76a42042b..d27694a8a8 100644 --- a/src/fabric/gamma/ScrollViewMarkerNativeComponent.ts +++ b/src/fabric/gamma/ScrollViewMarkerNativeComponent.ts @@ -6,10 +6,18 @@ import { codegenNativeComponent } from 'react-native'; type ScrollEdgeEffect = 'automatic' | 'hard' | 'soft' | 'hidden'; interface NativeProps extends ViewProps { - leftScrollEdgeEffect?: CT.WithDefault; - topScrollEdgeEffect?: CT.WithDefault; - rightScrollEdgeEffect?: CT.WithDefault; - bottomScrollEdgeEffect?: CT.WithDefault; + leftScrollEdgeEffect?: + | CT.WithDefault + | undefined; + topScrollEdgeEffect?: + | CT.WithDefault + | undefined; + rightScrollEdgeEffect?: + | CT.WithDefault + | undefined; + bottomScrollEdgeEffect?: + | CT.WithDefault + | undefined; } export default codegenNativeComponent('RNSScrollViewMarker'); diff --git a/src/fabric/gamma/split/SplitHostNativeComponent.ts b/src/fabric/gamma/split/SplitHostNativeComponent.ts index 7a70092723..2ef2454d22 100644 --- a/src/fabric/gamma/split/SplitHostNativeComponent.ts +++ b/src/fabric/gamma/split/SplitHostNativeComponent.ts @@ -50,57 +50,68 @@ type SplitViewTopColumnForCollapsing = | 'secondary'; interface ColumnMetrics { - minimumPrimaryColumnWidth?: CT.WithDefault; - maximumPrimaryColumnWidth?: CT.WithDefault; - preferredPrimaryColumnWidthOrFraction?: CT.WithDefault; - minimumSupplementaryColumnWidth?: CT.WithDefault; - maximumSupplementaryColumnWidth?: CT.WithDefault; - preferredSupplementaryColumnWidthOrFraction?: CT.WithDefault; + minimumPrimaryColumnWidth?: CT.WithDefault | undefined; + maximumPrimaryColumnWidth?: CT.WithDefault | undefined; + preferredPrimaryColumnWidthOrFraction?: + | CT.WithDefault + | undefined; + minimumSupplementaryColumnWidth?: CT.WithDefault | undefined; + maximumSupplementaryColumnWidth?: CT.WithDefault | undefined; + preferredSupplementaryColumnWidthOrFraction?: + | CT.WithDefault + | undefined; // iOS 26 only - minimumSecondaryColumnWidth?: CT.WithDefault; - preferredSecondaryColumnWidthOrFraction?: CT.WithDefault; - minimumInspectorColumnWidth?: CT.WithDefault; - maximumInspectorColumnWidth?: CT.WithDefault; - preferredInspectorColumnWidthOrFraction?: CT.WithDefault; + minimumSecondaryColumnWidth?: CT.WithDefault | undefined; + preferredSecondaryColumnWidthOrFraction?: + | CT.WithDefault + | undefined; + minimumInspectorColumnWidth?: CT.WithDefault | undefined; + maximumInspectorColumnWidth?: CT.WithDefault | undefined; + preferredInspectorColumnWidthOrFraction?: + | CT.WithDefault + | undefined; } interface NativeProps extends ViewProps { // Appearance - preferredDisplayMode?: CT.WithDefault; - preferredSplitBehavior?: CT.WithDefault; - primaryEdge?: CT.WithDefault; - showSecondaryToggleButton?: CT.WithDefault; - displayModeButtonVisibility?: CT.WithDefault< - SplitViewDisplayModeButtonVisibility, - 'automatic' - >; - columnMetrics?: ColumnMetrics; - orientation?: CT.WithDefault; - primaryBackgroundStyle?: CT.WithDefault< - SplitViewPrimaryBackgroundStyle, - 'default' - >; + preferredDisplayMode?: + | CT.WithDefault + | undefined; + preferredSplitBehavior?: + | CT.WithDefault + | undefined; + primaryEdge?: CT.WithDefault | undefined; + showSecondaryToggleButton?: CT.WithDefault | undefined; + displayModeButtonVisibility?: + | CT.WithDefault + | undefined; + columnMetrics?: ColumnMetrics | undefined; + orientation?: CT.WithDefault | undefined; + primaryBackgroundStyle?: + | CT.WithDefault + | undefined; // Behavior - topColumnForCollapsing?: CT.WithDefault< - SplitViewTopColumnForCollapsing, - 'default' - >; + topColumnForCollapsing?: + | CT.WithDefault + | undefined; // Interactions - presentsWithGesture?: CT.WithDefault; - showInspector?: CT.WithDefault; + presentsWithGesture?: CT.WithDefault | undefined; + showInspector?: CT.WithDefault | undefined; // Custom events - onCollapse?: CT.DirectEventHandler; - onDisplayModeWillChange?: CT.DirectEventHandler; - onExpand?: CT.DirectEventHandler; - onInspectorHide?: CT.DirectEventHandler; + onCollapse?: CT.DirectEventHandler | undefined; + onDisplayModeWillChange?: + | CT.DirectEventHandler + | undefined; + onExpand?: CT.DirectEventHandler | undefined; + onInspectorHide?: CT.DirectEventHandler | undefined; } type ComponentType = HostComponent; diff --git a/src/fabric/gamma/split/SplitScreenNativeComponent.ts b/src/fabric/gamma/split/SplitScreenNativeComponent.ts index ce4438e140..dbd7c1af8c 100644 --- a/src/fabric/gamma/split/SplitScreenNativeComponent.ts +++ b/src/fabric/gamma/split/SplitScreenNativeComponent.ts @@ -10,13 +10,13 @@ type SplitScreenColumnType = 'column' | 'inspector'; interface NativeProps extends ViewProps { // Config - columnType?: CT.WithDefault; + columnType?: CT.WithDefault | undefined; // Events - onWillAppear?: CT.DirectEventHandler; - onDidAppear?: CT.DirectEventHandler; - onWillDisappear?: CT.DirectEventHandler; - onDidDisappear?: CT.DirectEventHandler; + onWillAppear?: CT.DirectEventHandler | undefined; + onDidAppear?: CT.DirectEventHandler | undefined; + onWillDisappear?: CT.DirectEventHandler | undefined; + onDidDisappear?: CT.DirectEventHandler | undefined; } export default codegenNativeComponent('RNSSplitScreen', { diff --git a/src/fabric/gamma/stack/StackScreenNativeComponent.ts b/src/fabric/gamma/stack/StackScreenNativeComponent.ts index 06cd3ec369..d4c76efd78 100644 --- a/src/fabric/gamma/stack/StackScreenNativeComponent.ts +++ b/src/fabric/gamma/stack/StackScreenNativeComponent.ts @@ -16,23 +16,25 @@ export interface NativeProps extends ViewProps { // Control // Codegen does not currently support non-optional enum. - activityMode?: CT.WithDefault; + activityMode?: CT.WithDefault | undefined; screenKey: string; // Events - onWillAppear?: CT.DirectEventHandler; - onDidAppear?: CT.DirectEventHandler; - onWillDisappear?: CT.DirectEventHandler; - onDidDisappear?: CT.DirectEventHandler; + onWillAppear?: CT.DirectEventHandler | undefined; + onDidAppear?: CT.DirectEventHandler | undefined; + onWillDisappear?: CT.DirectEventHandler | undefined; + onDidDisappear?: CT.DirectEventHandler | undefined; - onDismiss?: CT.DirectEventHandler; + onDismiss?: CT.DirectEventHandler | undefined; - onNativeDismissPrevented?: CT.DirectEventHandler; + onNativeDismissPrevented?: + | CT.DirectEventHandler + | undefined; // Configuration - preventNativeDismiss?: CT.WithDefault; + preventNativeDismiss?: CT.WithDefault | undefined; } export default codegenNativeComponent('RNSStackScreen', { diff --git a/src/fabric/safe-area/SafeAreaViewNativeComponent.ts b/src/fabric/safe-area/SafeAreaViewNativeComponent.ts index b3d0d2d8b1..c1bc416db2 100644 --- a/src/fabric/safe-area/SafeAreaViewNativeComponent.ts +++ b/src/fabric/safe-area/SafeAreaViewNativeComponent.ts @@ -16,7 +16,7 @@ export interface NativeProps extends ViewProps { }> | undefined; // Android-only - insetType?: CT.WithDefault; + insetType?: CT.WithDefault | undefined; } export default codegenNativeComponent('RNSSafeAreaView', { diff --git a/src/fabric/tabs/TabsBottomAccessoryContentNativeComponent.ts b/src/fabric/tabs/TabsBottomAccessoryContentNativeComponent.ts index 3646447be8..6657c1c671 100644 --- a/src/fabric/tabs/TabsBottomAccessoryContentNativeComponent.ts +++ b/src/fabric/tabs/TabsBottomAccessoryContentNativeComponent.ts @@ -6,7 +6,9 @@ import type { CodegenTypes as CT, ViewProps } from 'react-native'; type BottomAccessoryEnvironment = 'regular' | 'inline'; export interface NativeProps extends ViewProps { - environment?: CT.WithDefault; + environment?: + | CT.WithDefault + | undefined; } export default codegenNativeComponent( diff --git a/src/fabric/tabs/TabsBottomAccessoryNativeComponent.ts b/src/fabric/tabs/TabsBottomAccessoryNativeComponent.ts index fa7d6126bc..11b058b00f 100644 --- a/src/fabric/tabs/TabsBottomAccessoryNativeComponent.ts +++ b/src/fabric/tabs/TabsBottomAccessoryNativeComponent.ts @@ -8,7 +8,9 @@ type EnvironmentChangeEvent = { }; export interface NativeProps extends ViewProps { - onEnvironmentChange?: CT.DirectEventHandler; + onEnvironmentChange?: + | CT.DirectEventHandler + | undefined; } export default codegenNativeComponent('RNSTabsBottomAccessory', { diff --git a/src/fabric/tabs/TabsHostAndroidNativeComponent.ts b/src/fabric/tabs/TabsHostAndroidNativeComponent.ts index 7477c751fd..64d08997f6 100644 --- a/src/fabric/tabs/TabsHostAndroidNativeComponent.ts +++ b/src/fabric/tabs/TabsHostAndroidNativeComponent.ts @@ -43,20 +43,24 @@ type TabsHostColorScheme = 'inherit' | 'light' | 'dark'; export interface NativeProps extends ViewProps { // Control navState: NavigationState; - rejectStaleNavStateUpdates?: CT.WithDefault; + rejectStaleNavStateUpdates?: CT.WithDefault | undefined; // Events - onTabSelected?: CT.DirectEventHandler; - onTabSelectionRejected?: CT.DirectEventHandler; - onTabSelectionPrevented?: CT.DirectEventHandler; + onTabSelected?: CT.DirectEventHandler | undefined; + onTabSelectionRejected?: + | CT.DirectEventHandler + | undefined; + onTabSelectionPrevented?: + | CT.DirectEventHandler + | undefined; // General - tabBarHidden?: CT.WithDefault; + tabBarHidden?: CT.WithDefault | undefined; nativeContainerBackgroundColor?: ColorValue | undefined; - colorScheme?: CT.WithDefault; + colorScheme?: CT.WithDefault | undefined; // Android-specific props - tabBarRespectsIMEInsets?: CT.WithDefault; + tabBarRespectsIMEInsets?: CT.WithDefault | undefined; } export default codegenNativeComponent('RNSTabsHostAndroid', { diff --git a/src/fabric/tabs/TabsHostIOSNativeComponent.ts b/src/fabric/tabs/TabsHostIOSNativeComponent.ts index 4b76e27037..ebf6e477d4 100644 --- a/src/fabric/tabs/TabsHostIOSNativeComponent.ts +++ b/src/fabric/tabs/TabsHostIOSNativeComponent.ts @@ -58,30 +58,38 @@ type TabBarControllerMode = 'automatic' | 'tabBar' | 'tabSidebar'; export interface NativeProps extends ViewProps { // Control navState: NavigationState; - rejectStaleNavStateUpdates?: CT.WithDefault; + rejectStaleNavStateUpdates?: CT.WithDefault | undefined; // Events - onTabSelected?: CT.DirectEventHandler; - onTabSelectionRejected?: CT.DirectEventHandler; - onTabSelectionPrevented?: CT.DirectEventHandler; - onMoreTabSelected?: CT.DirectEventHandler; + onTabSelected?: CT.DirectEventHandler | undefined; + onTabSelectionRejected?: + | CT.DirectEventHandler + | undefined; + onTabSelectionPrevented?: + | CT.DirectEventHandler + | undefined; + onMoreTabSelected?: CT.DirectEventHandler | undefined; // General - tabBarHidden?: CT.WithDefault; + tabBarHidden?: CT.WithDefault | undefined; nativeContainerBackgroundColor?: ColorValue | undefined; - colorScheme?: CT.WithDefault; + colorScheme?: CT.WithDefault | undefined; // We can't use `direction` name for this prop as it's also used by // direction style View prop. - layoutDirection?: CT.WithDefault; + layoutDirection?: CT.WithDefault | undefined; // Experimental support - controlNavigationStateInJS?: CT.WithDefault; + controlNavigationStateInJS?: CT.WithDefault | undefined; // iOS-specific props tabBarTintColor?: ColorValue | undefined; - tabBarMinimizeBehavior?: CT.WithDefault; - tabBarControllerMode?: CT.WithDefault; + tabBarMinimizeBehavior?: + | CT.WithDefault + | undefined; + tabBarControllerMode?: + | CT.WithDefault + | undefined; } export default codegenNativeComponent('RNSTabsHostIOS', { diff --git a/src/fabric/tabs/TabsScreenAndroidNativeComponent.ts b/src/fabric/tabs/TabsScreenAndroidNativeComponent.ts index 4b42dbcaff..80c3a7c772 100644 --- a/src/fabric/tabs/TabsScreenAndroidNativeComponent.ts +++ b/src/fabric/tabs/TabsScreenAndroidNativeComponent.ts @@ -36,10 +36,9 @@ export type Appearance = { tabBarItemRippleColor?: ProcessedColorValue | null | undefined; // TabBarItem - Label layout - tabBarItemLabelVisibilityMode?: CT.WithDefault< - TabBarItemLabelVisibilityMode, - 'auto' - >; + tabBarItemLabelVisibilityMode?: + | CT.WithDefault + | undefined; // TabBarItem - State-dependent appearance normal?: ItemStateAppearance | undefined; @@ -49,7 +48,7 @@ export type Appearance = { // TabBarItem - Active Indicator tabBarItemActiveIndicatorColor?: ProcessedColorValue | null | undefined; - tabBarItemActiveIndicatorEnabled?: CT.WithDefault; + tabBarItemActiveIndicatorEnabled?: CT.WithDefault | undefined; // TabBarItem - Label tabBarItemTitleFontFamily?: string | undefined; @@ -67,10 +66,10 @@ export type Appearance = { export interface NativeProps extends ViewProps { // Events - onWillAppear?: CT.DirectEventHandler; - onDidAppear?: CT.DirectEventHandler; - onWillDisappear?: CT.DirectEventHandler; - onDidDisappear?: CT.DirectEventHandler; + onWillAppear?: CT.DirectEventHandler | undefined; + onDidAppear?: CT.DirectEventHandler | undefined; + onWillDisappear?: CT.DirectEventHandler | undefined; + onDidDisappear?: CT.DirectEventHandler | undefined; // Control screenKey: string; @@ -87,10 +86,12 @@ export interface NativeProps extends ViewProps { // Effects specialEffects?: | { - repeatedTabSelection?: { - popToRoot?: CT.WithDefault; - scrollToTop?: CT.WithDefault; - }; + repeatedTabSelection?: + | { + popToRoot?: CT.WithDefault | undefined; + scrollToTop?: CT.WithDefault | undefined; + } + | undefined; } | undefined; diff --git a/src/fabric/tabs/TabsScreenIOSNativeComponent.ts b/src/fabric/tabs/TabsScreenIOSNativeComponent.ts index 20fa124016..d861137c03 100644 --- a/src/fabric/tabs/TabsScreenIOSNativeComponent.ts +++ b/src/fabric/tabs/TabsScreenIOSNativeComponent.ts @@ -30,8 +30,8 @@ export type ItemStateAppearance = { tabBarItemTitleFontColor?: ProcessedColorValue | null | undefined; tabBarItemTitlePositionAdjustment?: | { - horizontal?: CT.Float; - vertical?: CT.Float; + horizontal?: CT.Float | undefined; + vertical?: CT.Float | undefined; } | undefined; tabBarItemIconColor?: ProcessedColorValue | null | undefined; @@ -52,7 +52,7 @@ export type Appearance = { tabBarBackgroundColor?: ProcessedColorValue | null | undefined; tabBarShadowColor?: ProcessedColorValue | null | undefined; - tabBarBlurEffect?: CT.WithDefault; + tabBarBlurEffect?: CT.WithDefault | undefined; }; type BlurEffect = @@ -113,10 +113,10 @@ type UserInterfaceStyle = 'unspecified' | 'light' | 'dark'; export interface NativeProps extends ViewProps { // Events - onWillAppear?: CT.DirectEventHandler; - onDidAppear?: CT.DirectEventHandler; - onWillDisappear?: CT.DirectEventHandler; - onDidDisappear?: CT.DirectEventHandler; + onWillAppear?: CT.DirectEventHandler | undefined; + onDidAppear?: CT.DirectEventHandler | undefined; + onWillDisappear?: CT.DirectEventHandler | undefined; + onDidDisappear?: CT.DirectEventHandler | undefined; // Control screenKey: string; @@ -125,7 +125,7 @@ export interface NativeProps extends ViewProps { // General title?: string | undefined | null; badgeValue?: string | undefined; - orientation?: CT.WithDefault; + orientation?: CT.WithDefault | undefined; // Accessibility tabBarItemTestID?: string | undefined; @@ -134,41 +134,52 @@ export interface NativeProps extends ViewProps { // Effects specialEffects?: | { - repeatedTabSelection?: { - popToRoot?: CT.WithDefault; - scrollToTop?: CT.WithDefault; - }; + repeatedTabSelection?: + | { + popToRoot?: CT.WithDefault | undefined; + scrollToTop?: CT.WithDefault | undefined; + } + | undefined; } | undefined; // iOS-specific props // Tab config - isTitleUndefined?: CT.WithDefault; - systemItem?: CT.WithDefault; + isTitleUndefined?: CT.WithDefault | undefined; + systemItem?: CT.WithDefault | undefined; // Appearance standardAppearance?: UnsafeMixed | undefined; scrollEdgeAppearance?: UnsafeMixed | undefined; // Icons - iconType?: CT.WithDefault; + iconType?: CT.WithDefault | undefined; iconImageSource?: ImageSource | undefined; iconResourceName?: string | undefined; selectedIconImageSource?: ImageSource | undefined; selectedIconResourceName?: string | undefined; // ScrollView interactions - overrideScrollViewContentInsetAdjustmentBehavior?: CT.WithDefault< - boolean, - true - >; - bottomScrollEdgeEffect?: CT.WithDefault; - leftScrollEdgeEffect?: CT.WithDefault; - rightScrollEdgeEffect?: CT.WithDefault; - topScrollEdgeEffect?: CT.WithDefault; + overrideScrollViewContentInsetAdjustmentBehavior?: + | CT.WithDefault + | undefined; + bottomScrollEdgeEffect?: + | CT.WithDefault + | undefined; + leftScrollEdgeEffect?: + | CT.WithDefault + | undefined; + rightScrollEdgeEffect?: + | CT.WithDefault + | undefined; + topScrollEdgeEffect?: + | CT.WithDefault + | undefined; // Experimental - userInterfaceStyle?: CT.WithDefault; + userInterfaceStyle?: + | CT.WithDefault + | undefined; } export default codegenNativeComponent('RNSTabsScreenIOS', { diff --git a/src/types.tsx b/src/types.tsx index bd1c7eb634..76a83f3acb 100644 --- a/src/types.tsx +++ b/src/types.tsx @@ -77,10 +77,10 @@ export type TransitionProgressEventType = { }; export type GestureResponseDistanceType = { - start?: number; - end?: number; - top?: number; - bottom?: number; + start?: number | undefined; + end?: number | undefined; + top?: number | undefined; + bottom?: number | undefined; }; export type SearchBarPlacement = @@ -133,11 +133,11 @@ export type ScreenStackNativeContainerStyleProps = { * * @platform ios */ - backgroundColor?: ColorValue; + backgroundColor?: ColorValue | undefined; }; export interface ScreenProps extends ViewProps { - active?: 0 | 1 | Animated.AnimatedInterpolation; + active?: 0 | 1 | Animated.AnimatedInterpolation | undefined; activityState?: | 0 | 1 @@ -148,30 +148,30 @@ export interface ScreenProps extends ViewProps { * Boolean indicating that the screen should be frozen with `react-freeze`. */ shouldFreeze?: boolean | undefined; - children?: React.ReactNode; + children?: React.ReactNode | undefined; /** * Boolean indicating that swipe dismissal should trigger animation provided by `stackAnimation`. Defaults to `false`. * * @platform ios */ - customAnimationOnSwipe?: boolean; + customAnimationOnSwipe?: boolean | undefined; /** * All children screens should have the same value of their "enabled" prop as their container. */ - enabled?: boolean; + enabled?: boolean | undefined; /** * Internal boolean used to not attach events used only by native-stack. It prevents non native-stack navigators from sending transition progress from their Screen components. */ - isNativeStack?: boolean; + isNativeStack?: boolean | undefined; /** * Internal boolean used to detect if current header has large title on iOS. */ - hasLargeHeader?: boolean; + hasLargeHeader?: boolean | undefined; /** * Whether inactive screens should be suspended from re-rendering. Defaults to `false`. * When `enableFreeze()` is run at the top of the application defaults to `true`. */ - freezeOnBlur?: boolean; + freezeOnBlur?: boolean | undefined; /** * Boolean indicating whether the swipe gesture should work on whole screen. The behavior depends on iOS version. * @@ -186,7 +186,7 @@ export interface ScreenProps extends ViewProps { * * @platform ios */ - fullScreenSwipeEnabled?: boolean; + fullScreenSwipeEnabled?: boolean | undefined; /** * Whether the full screen dismiss gesture has shadow under view during transition. * When enabled, a custom shadow view is added during the transition which tries to mimic the @@ -199,31 +199,31 @@ export interface ScreenProps extends ViewProps { * * @platform ios */ - fullScreenSwipeShadowEnabled?: boolean; + fullScreenSwipeShadowEnabled?: boolean | undefined; /** * Whether you can use gestures to dismiss this screen. Defaults to `true`. * * @platform ios */ - gestureEnabled?: boolean; + gestureEnabled?: boolean | undefined; /** * Use it to restrict the distance from the edges of screen in which the gesture should be recognized. To be used alongside `fullScreenSwipeEnabled`. * * @platform ios */ - gestureResponseDistance?: GestureResponseDistanceType; + gestureResponseDistance?: GestureResponseDistanceType | undefined; /** * Whether the home indicator should be hidden on this screen. Defaults to `false`. * * @platform ios */ - homeIndicatorHidden?: boolean; + homeIndicatorHidden?: boolean | undefined; /** * Whether the keyboard should hide when swiping to the previous screen. Defaults to `false`. * * @platform ios */ - hideKeyboardOnSwipe?: boolean; + hideKeyboardOnSwipe?: boolean | undefined; /** * Boolean indicating whether, when the Android default back button is clicked, the `pop` action should be performed on the native side or on the JS side to be able to prevent it. * Unfortunately the same behavior is not available on iOS since the behavior of native back button cannot be changed there. @@ -231,7 +231,7 @@ export interface ScreenProps extends ViewProps { * * @platform android */ - nativeBackButtonDismissalEnabled?: boolean; + nativeBackButtonDismissalEnabled?: boolean | undefined; /** * Configures the scroll edge effect for the _content ScrollView_ (the ScrollView that is present in first descendants chain of the Screen). * Depending on values set, it will blur the scrolling content below certain UI elements (header items, search bar) @@ -260,46 +260,50 @@ export interface ScreenProps extends ViewProps { * * @supported iOS 26 or higher */ - scrollEdgeEffects?: { - bottom: ScrollEdgeEffect; - left: ScrollEdgeEffect; - right: ScrollEdgeEffect; - top: ScrollEdgeEffect; - }; + scrollEdgeEffects?: + | { + bottom: ScrollEdgeEffect; + left: ScrollEdgeEffect; + right: ScrollEdgeEffect; + top: ScrollEdgeEffect; + } + | undefined; /** * @deprecated Setting this prop has no effect. Retained only for backward compatibility. * * For all apps targeting Android SDK 35 or above this prop has no effect. * See: https://developer.android.com/reference/android/view/Window#setNavigationBarColor(int) */ - navigationBarColor?: ColorValue; + navigationBarColor?: ColorValue | undefined; /** * @deprecated Setting this prop has no effect. Retained only for backward compatibility. * * For all apps targeting Android SDK 35 or above edge-to-edge is enabled by default. * See: https://developer.android.com/about/versions/15/behavior-changes-15#window-insets */ - navigationBarTranslucent?: boolean; + navigationBarTranslucent?: boolean | undefined; /** * Sets the visibility of the navigation bar. Defaults to `false`. * * @platform android */ - navigationBarHidden?: boolean; + navigationBarHidden?: boolean | undefined; /** * A callback that gets called when the current screen appears. */ - onAppear?: (e: NativeSyntheticEvent) => void; - onComponentRef?: (view: unknown) => void; + onAppear?: ((e: NativeSyntheticEvent) => void) | undefined; + onComponentRef?: ((view: unknown) => void) | undefined; /** * A callback that gets called when the current screen disappears. */ - onDisappear?: (e: NativeSyntheticEvent) => void; + onDisappear?: ((e: NativeSyntheticEvent) => void) | undefined; /** * A callback that gets called when the current screen is dismissed by hardware back (on Android) or dismiss gesture (swipe back or down). * The callback takes the number of dismissed screens as an argument since iOS 14 native header back button can pop more than 1 screen at a time. */ - onDismissed?: (e: NativeSyntheticEvent<{ dismissCount: number }>) => void; + onDismissed?: + | ((e: NativeSyntheticEvent<{ dismissCount: number }>) => void) + | undefined; /** * A callback that gets called when the header height has changed. */ @@ -309,56 +313,58 @@ export interface ScreenProps extends ViewProps { /** * A callback that gets called after swipe back is canceled. */ - onGestureCancel?: (e: NativeSyntheticEvent) => void; + onGestureCancel?: ((e: NativeSyntheticEvent) => void) | undefined; /** * An internal callback that gets called when the native header back button is clicked on Android and `enableNativeBackButtonDismissal` is set to `false`. It dismises the screen using `navigation.pop()`. * * @platform android */ - onHeaderBackButtonClicked?: () => void; + onHeaderBackButtonClicked?: (() => void) | undefined; /** * An internal callback called when screen is dismissed by gesture or by native header back button and `preventNativeDismiss` is set to `true`. * * @platform ios */ - onNativeDismissCancelled?: ( - e: NativeSyntheticEvent<{ dismissCount: number }>, - ) => void; + onNativeDismissCancelled?: + | ((e: NativeSyntheticEvent<{ dismissCount: number }>) => void) + | undefined; /** * A callback that gets called when the current screen is in `formSheet` presentation and its detent has changed. */ - onSheetDetentChanged?: ( - e: NativeSyntheticEvent<{ index: number; isStable: boolean }>, - ) => void; + onSheetDetentChanged?: + | ((e: NativeSyntheticEvent<{ index: number; isStable: boolean }>) => void) + | undefined; /** * An internal callback called every frame during the transition of screens of `native-stack`, used to feed transition context. */ - onTransitionProgress?: ( - e: NativeSyntheticEvent, - ) => void; + onTransitionProgress?: + | ((e: NativeSyntheticEvent) => void) + | undefined; /** * A callback that gets called when the current screen will appear. This is called as soon as the transition begins. */ - onWillAppear?: (e: NativeSyntheticEvent) => void; + onWillAppear?: ((e: NativeSyntheticEvent) => void) | undefined; /** * A callback that gets called when the current screen will disappear. This is called as soon as the transition begins. */ - onWillDisappear?: (e: NativeSyntheticEvent) => void; + onWillDisappear?: + | ((e: NativeSyntheticEvent) => void) + | undefined; /** * Boolean indicating whether to prevent current screen from being dismissed. * Defaults to `false`. * * @platform ios */ - preventNativeDismiss?: boolean; - ref?: React.Ref; + preventNativeDismiss?: boolean | undefined; + ref?: React.Ref | undefined; /** * How should the screen replacing another screen animate. Defaults to `pop`. * The following values are currently supported: * - "push" – the new screen will perform push animation. * - "pop" – the new screen will perform pop animation. */ - replaceAnimation?: ScreenReplaceTypes; + replaceAnimation?: ScreenReplaceTypes | undefined; /** * A way to identify the screen in native code. This value will be passed down to native side, * where it can be later consulted. Meant for native integration with the library. @@ -381,7 +387,7 @@ export interface ScreenProps extends ViewProps { * - "landscape_left" – landscape-left orientation is permitted * - "landscape_right" – landscape-right orientation is permitted */ - screenOrientation?: ScreenOrientationTypes; + screenOrientation?: ScreenOrientationTypes | undefined; /** * Describes heights where a sheet can rest. * Works only when `presentation` is set to `formSheet`. @@ -424,7 +430,7 @@ export interface ScreenProps extends ViewProps { * * @platform Android */ - sheetElevation?: number; + sheetElevation?: number | undefined; /** * Whether the sheet should expand to larger detent when scrolling. * Works only when `stackPresentation` is set to `formSheet`. @@ -432,7 +438,7 @@ export interface ScreenProps extends ViewProps { * * @platform ios */ - sheetExpandsWhenScrolledToEdge?: boolean; + sheetExpandsWhenScrolledToEdge?: boolean | undefined; /** * The corner radius that the sheet will try to render with. * Works only when `stackPresentation` is set to `formSheet`. @@ -443,7 +449,7 @@ export interface ScreenProps extends ViewProps { * * @platform ios */ - sheetCornerRadius?: number; + sheetCornerRadius?: number | undefined; /** * Boolean indicating whether the sheet shows a grabber at the top. * Works only when `stackPresentation` is set to `formSheet`. @@ -451,7 +457,7 @@ export interface ScreenProps extends ViewProps { * * @platform ios */ - sheetGrabberVisible?: boolean; + sheetGrabberVisible?: boolean | undefined; /** * The largest sheet detent for which a view underneath won't be dimmed. * Works only when `stackPresentation` is set to `formSheet`. @@ -485,7 +491,8 @@ export interface ScreenProps extends ViewProps { | 'last' | 'medium' // deprecated | 'large' // deprecated - | 'all'; // deprecated + | 'all' // deprecated + | undefined; /** * Index of the detent the sheet should expand to after being opened. * Works only when `stackPresentation` is set to `formSheet`. @@ -497,7 +504,7 @@ export interface ScreenProps extends ViewProps { * * Defaults to `0` - which represents first detent in the detents array. */ - sheetInitialDetentIndex?: number | 'last'; + sheetInitialDetentIndex?: number | 'last' | undefined; /** * Whether the sheet content should be rendered behind the Status Bar or display cutouts. * @@ -513,7 +520,7 @@ export interface ScreenProps extends ViewProps { * * @platform android */ - sheetShouldOverflowTopInset?: boolean; + sheetShouldOverflowTopInset?: boolean | undefined; /** * Whether the default native animation should be used when the sheet's with * `fitToContents` content size changes. @@ -530,7 +537,7 @@ export interface ScreenProps extends ViewProps { * * @platform android */ - sheetDefaultResizeAnimationEnabled?: boolean; + sheetDefaultResizeAnimationEnabled?: boolean | undefined; /** * How the screen should appear/disappear when pushed or popped at the top of the stack. * The following values are currently supported: @@ -546,7 +553,7 @@ export interface ScreenProps extends ViewProps { * - "ios_from_left" - iOS like slide in animation. pushes in the new screen from left to right (Android only, resolves to default transition on iOS) * - "none" – the screen appears/dissapears without an animation */ - stackAnimation?: StackAnimationTypes; + stackAnimation?: StackAnimationTypes | undefined; /** * How should the screen be presented. * The following values are currently supported: @@ -559,7 +566,7 @@ export interface ScreenProps extends ViewProps { * - "formSheet" – will use "UIModalPresentationFormSheet" modal style on iOS, on Android this will use Material BottomSheetBehaviour. On Android neested stack rendering is not yet supported. * - "pageSheet" – will use "UIModalPresentationPageSheet" modal style on iOS and will fallback to "modal" on Android. */ - stackPresentation?: StackPresentationTypes; + stackPresentation?: StackPresentationTypes | undefined; /** * Sets the status bar animation (similar to the `StatusBar` component). * On Android, setting either `fade` or `slide` will set the transition of status bar color. On iOS, this option applies to appereance animation of the status bar. @@ -567,31 +574,31 @@ export interface ScreenProps extends ViewProps { * * Defaults to `fade` on iOS and `none` on Android. */ - statusBarAnimation?: 'none' | 'fade' | 'slide'; + statusBarAnimation?: 'none' | 'fade' | 'slide' | undefined; /** * @deprecated Setting this prop has no effect. Retained only for backward compatibility. * * For all apps targeting Android SDK 35 or above this prop has no effect. * See: https://developer.android.com/reference/android/view/Window#setStatusBarColor(int) */ - statusBarColor?: ColorValue; + statusBarColor?: ColorValue | undefined; /** * Whether the status bar should be hidden on this screen. Requires enabling (or deleting) `View controller-based status bar appearance` in your Info.plist file on iOS. Defaults to `false`. */ - statusBarHidden?: boolean; + statusBarHidden?: boolean | undefined; /** * Sets the status bar color (similar to the `StatusBar` component). Requires enabling (or deleting) `View controller-based status bar appearance` in your Info.plist file on iOS. * `auto` and `inverted` are supported only on iOS. On Android, they will fallback to `light`. * Defaults to `auto` on iOS and `light` on Android. */ - statusBarStyle?: 'inverted' | 'auto' | 'light' | 'dark'; + statusBarStyle?: 'inverted' | 'auto' | 'light' | 'dark' | undefined; /** * @deprecated Setting this prop has no effect. Retained only for backward compatibility. * * For all apps targeting Android SDK 35 or above edge-to-edge mode on Android is enabled by default and this prop loses relevance. * See: https://developer.android.com/about/versions/15/behavior-changes-15#ux. */ - statusBarTranslucent?: boolean; + statusBarTranslucent?: boolean | undefined; /** * Sets the direction in which you should swipe to dismiss the screen. * When using `vertical` option, options `fullScreenSwipeEnabled: true`, `customAnimationOnSwipe: true` and `stackAnimation: 'slide_from_bottom'` are set by default. @@ -601,14 +608,14 @@ export interface ScreenProps extends ViewProps { * * @platform ios */ - swipeDirection?: SwipeDirectionTypes; + swipeDirection?: SwipeDirectionTypes | undefined; /** * Changes the duration (in milliseconds) of `slide_from_bottom`, `fade_from_bottom`, `fade` and `simple_push` transitions on iOS. Defaults to `500`. * For screens with `default` and `flip` transitions, and, as of now, for screens with `presentation` set to `modal`, `formSheet`, `pageSheet` (regardless of transition), the duration isn't customizable. * * @platform ios */ - transitionDuration?: number; + transitionDuration?: number | undefined; /** * Footer component that can be used alongside formSheet stack presentation style. * @@ -621,19 +628,19 @@ export interface ScreenProps extends ViewProps { * * @platform android */ - unstable_sheetFooter?: () => React.ReactNode; + unstable_sheetFooter?: (() => React.ReactNode) | undefined; } export interface ScreenContainerProps extends ViewProps { - children?: React.ReactNode; + children?: React.ReactNode | undefined; /** * A prop that gives users an option to switch between using Screens for the navigator (container). All children screens should have the same value of their "enabled" prop as their container. */ - enabled?: boolean; + enabled?: boolean | undefined; /** * A prop to be used in navigators always showing only one screen (providing only `0` or `2` `activityState` values) for better implementation of `ScreenContainer` on iOS. */ - hasTwoStates?: boolean; + hasTwoStates?: boolean | undefined; } export interface GestureDetectorBridge { @@ -648,39 +655,41 @@ export interface GestureDetectorBridge { } export interface ScreenStackProps extends ViewProps, GestureProps { - children?: React.ReactNode; + children?: React.ReactNode | undefined; /** * A callback that gets called when the current screen finishes its transition. */ - onFinishTransitioning?: (e: NativeSyntheticEvent) => void; - ref?: React.MutableRefObject>; - nativeContainerStyle?: ScreenStackNativeContainerStyleProps; + onFinishTransitioning?: + | ((e: NativeSyntheticEvent) => void) + | undefined; + ref?: React.MutableRefObject> | undefined; + nativeContainerStyle?: ScreenStackNativeContainerStyleProps | undefined; } export interface ScreenStackHeaderConfigProps extends ViewProps { /** * Whether to show the back button with custom left side of the header. */ - backButtonInCustomView?: boolean; + backButtonInCustomView?: boolean | undefined; /** * Controls the color of the navigation header. */ - backgroundColor?: ColorValue; + backgroundColor?: ColorValue | undefined; /** * Title to display in the back button. * @platform ios. */ - backTitle?: string; + backTitle?: string | undefined; /** * Allows for customizing font family to be used for back button title on iOS. * @platform ios */ - backTitleFontFamily?: string; + backTitleFontFamily?: string | undefined; /** * Allows for customizing font size to be used for back button title on iOS. * @platform ios */ - backTitleFontSize?: number; + backTitleFontSize?: number | undefined; /** * Whether the back button title should be visible or not. Defaults to `true`. * @@ -689,7 +698,7 @@ export interface ScreenStackHeaderConfigProps extends ViewProps { * * @platform ios */ - backTitleVisible?: boolean; + backTitleVisible?: boolean | undefined; /** * Blur effect to be applied to the header. Works with backgroundColor's alpha < 1. * @@ -697,24 +706,24 @@ export interface ScreenStackHeaderConfigProps extends ViewProps { * * @platform ios */ - blurEffect?: BlurEffectTypes; + blurEffect?: BlurEffectTypes | undefined; /** * Pass HeaderLeft, HeaderRight and HeaderTitle */ - children?: React.ReactNode; + children?: React.ReactNode | undefined; /** * Controls the color of items rendered on the header. This includes back icon, back text (iOS only) and title text. If you want the title to have different color use titleColor property. */ - color?: ColorValue; + color?: ColorValue | undefined; /** * Whether the stack should be in rtl or ltr form. */ - direction?: Direction; + direction?: Direction | undefined; /** * Boolean indicating whether to show the menu on longPress of iOS >= 14 back button. * @platform ios */ - disableBackButtonMenu?: boolean; + disableBackButtonMenu?: boolean | undefined; /** * How the back button behaves. It is used only when none of: `backTitleFontFamily`, `backTitleFontSize`, `disableBackButtonMenu` and `backTitleVisible=false` is set. * The following values are currently supported (they correspond to [UINavigationItemBackButtonDisplayMode](https://developer.apple.com/documentation/uikit/uinavigationitembackbuttondisplaymode?language=objc)): @@ -725,31 +734,31 @@ export interface ScreenStackHeaderConfigProps extends ViewProps { * * @platform ios */ - backButtonDisplayMode?: BackButtonDisplayMode; + backButtonDisplayMode?: BackButtonDisplayMode | undefined; /** * Array of UIBarButtomItems to the left side of the header. * * @platform ios */ - headerLeftBarButtonItems?: HeaderBarButtonItem[]; + headerLeftBarButtonItems?: HeaderBarButtonItem[] | undefined; /** * Array of UIBarButtomItems to the right side of the header. * * @platform ios */ - headerRightBarButtonItems?: HeaderBarButtonItem[]; + headerRightBarButtonItems?: HeaderBarButtonItem[] | undefined; /** * When set to true the header will be hidden while the parent Screen is on the top of the stack. The default value is false. */ - hidden?: boolean; + hidden?: boolean | undefined; /** * Boolean indicating whether to hide the back button in header. */ - hideBackButton?: boolean; + hideBackButton?: boolean | undefined; /** * Boolean indicating whether to hide the elevation shadow or the bottom border on the header. */ - hideShadow?: boolean; + hideShadow?: boolean | undefined; /** * Boolean to set native property to prefer large title header (like in iOS setting). * For large title to collapse on scroll, the content of the screen should be wrapped in a scrollable view such as `ScrollView` or `FlatList`. @@ -758,70 +767,70 @@ export interface ScreenStackHeaderConfigProps extends ViewProps { * * @platform ios */ - largeTitle?: boolean; + largeTitle?: boolean | undefined; /** * Controls the color of the navigation header when the edge of any scrollable content reaches the matching edge of the navigation bar. */ - largeTitleBackgroundColor?: ColorValue; + largeTitleBackgroundColor?: ColorValue | undefined; /** * Customize the color to be used for the large title. By default uses the titleColor property. * @platform ios */ - largeTitleColor?: ColorValue; + largeTitleColor?: ColorValue | undefined; /** * Customize font family to be used for the large title. * @platform ios */ - largeTitleFontFamily?: string; + largeTitleFontFamily?: string | undefined; /** * Customize the size of the font to be used for the large title. * @platform ios */ - largeTitleFontSize?: number; + largeTitleFontSize?: number | undefined; /** * Customize the weight of the font to be used for the large title. * @platform ios */ - largeTitleFontWeight?: string; + largeTitleFontWeight?: string | undefined; /** * Boolean that allows for disabling drop shadow under navigation header when the edge of any scrollable content reaches the matching edge of the navigation bar. */ - largeTitleHideShadow?: boolean; + largeTitleHideShadow?: boolean | undefined; /** * Callback which is executed when screen header is attached */ - onAttached?: () => void; + onAttached?: (() => void) | undefined; /** * Callback which is executed when screen header is detached */ - onDetached?: () => void; + onDetached?: (() => void) | undefined; /** * String that can be displayed in the header as a fallback for `headerTitle`. */ - title?: string; + title?: string | undefined; /** * Allows for setting text color of the title. */ - titleColor?: ColorValue; + titleColor?: ColorValue | undefined; /** * Customize font family to be used for the title. */ - titleFontFamily?: string; + titleFontFamily?: string | undefined; /** * Customize the size of the font to be used for the title. */ - titleFontSize?: number; + titleFontSize?: number | undefined; /** * Customize the weight of the font to be used for the title. */ - titleFontWeight?: string; + titleFontWeight?: string | undefined; /** * @deprecated Setting this prop has no effect. Retained only for backward compatibility. * * For apps targeting Android SDK 35 or above edge-to-edge mode is enabled by default * therefore this prop loses its relevance. */ - topInsetEnabled?: boolean; + topInsetEnabled?: boolean | undefined; /** * When set to `true` on the outermost stack with a **visible** header, disables top inset * handling for that header and the entire subtree. @@ -834,11 +843,11 @@ export interface ScreenStackHeaderConfigProps extends ViewProps { * * @platform android */ - disableTopInsetApplication?: boolean; + disableTopInsetApplication?: boolean | undefined; /** * Boolean indicating whether the navigation bar is translucent. */ - translucent?: boolean; + translucent?: boolean | undefined; /** * Allows to override system appearance for the navigation bar. * @@ -858,7 +867,7 @@ export interface ScreenStackHeaderConfigProps extends ViewProps { * @default unspecified * @platform ios */ - experimental_userInterfaceStyle?: UserInterfaceStyle; + experimental_userInterfaceStyle?: UserInterfaceStyle | undefined; } export interface SearchBarProps { @@ -874,7 +883,7 @@ export interface SearchBarProps { * * `cancelSearch` - cancel search in search bar. * * `toggleCancelButton` - depending on passed boolean value, hides or shows cancel button (iOS only) */ - ref?: React.RefObject; + ref?: React.RefObject | undefined; /** * The auto-capitalization behavior. @@ -888,23 +897,24 @@ export interface SearchBarProps { | 'none' | 'words' | 'sentences' - | 'characters'; + | 'characters' + | undefined; /** * Automatically focuses search bar on mount * * @platform android */ - autoFocus?: boolean; + autoFocus?: boolean | undefined; /** * The search field background color */ - barTintColor?: ColorValue; + barTintColor?: ColorValue | undefined; /** * The color for the cursor caret and cancel button text. * * @platform ios */ - tintColor?: ColorValue; + tintColor?: ColorValue | undefined; /** * The text to be used instead of default `Cancel` button text * @@ -913,13 +923,13 @@ export interface SearchBarProps { * * @platform ios */ - cancelButtonText?: string; + cancelButtonText?: string | undefined; /** * Specifies whether the back button should close search bar's text input or not. * * @platform android */ - disableBackButtonOverride?: boolean; + disableBackButtonOverride?: boolean | undefined; /** * Indicates whether to hide the navigation bar. * @@ -931,19 +941,19 @@ export interface SearchBarProps { * * @platform ios */ - hideNavigationBar?: boolean; + hideNavigationBar?: boolean | undefined; /** * Indicates whether to hide the search bar when scrolling * * @platform ios */ - hideWhenScrolling?: boolean; + hideWhenScrolling?: boolean | undefined; /** * Sets type of the input. Defaults to `text`. * * @platform android */ - inputType?: 'text' | 'phone' | 'number' | 'email'; + inputType?: 'text' | 'phone' | 'number' | 'email' | undefined; /** * Indicates whether to obscure the underlying content. * @@ -955,49 +965,53 @@ export interface SearchBarProps { * * @platform ios */ - obscureBackground?: boolean; + obscureBackground?: boolean | undefined; /** * A callback that gets called when search bar has lost focus */ - onBlur?: (e: NativeSyntheticEvent) => void; + onBlur?: ((e: NativeSyntheticEvent) => void) | undefined; /** * A callback that gets called when the cancel button is pressed * * @platform ios */ - onCancelButtonPress?: (e: NativeSyntheticEvent) => void; + onCancelButtonPress?: + | ((e: NativeSyntheticEvent) => void) + | undefined; /** * A callback that gets called when the text changes. It receives the current text value of the search bar. */ - onChangeText?: (e: NativeSyntheticEvent) => void; + onChangeText?: + | ((e: NativeSyntheticEvent) => void) + | undefined; /** * A callback that gets called when search bar is closed * * @platform android */ - onClose?: () => void; + onClose?: (() => void) | undefined; /** * A callback that gets called when search bar has received focus */ - onFocus?: (e: NativeSyntheticEvent) => void; + onFocus?: ((e: NativeSyntheticEvent) => void) | undefined; /** * A callback that gets called when search bar is opened * * @platform android */ - onOpen?: () => void; + onOpen?: (() => void) | undefined; /** * A callback that gets called when the search button is pressed. It receives the current text value of the search bar. */ - onSearchButtonPress?: ( - e: NativeSyntheticEvent, - ) => void; + onSearchButtonPress?: + | ((e: NativeSyntheticEvent) => void) + | undefined; /** * Text displayed when search field is empty */ - placeholder?: string; + placeholder?: string | undefined; /** * Position of the search bar * @@ -1030,7 +1044,7 @@ export interface SearchBarProps { * * @platform iOS (>= 16.0) */ - placement?: SearchBarPlacement; + placement?: SearchBarPlacement | undefined; /** * Indicates whether the system can place the search bar among other toolbar items on iPhone. * @@ -1043,30 +1057,30 @@ export interface SearchBarProps { * * @platform iOS (>= 26.0) */ - allowToolbarIntegration?: boolean; + allowToolbarIntegration?: boolean | undefined; /** * The search field text color */ - textColor?: ColorValue; + textColor?: ColorValue | undefined; /** * The search hint text color * * @plaform android */ - hintTextColor?: ColorValue; + hintTextColor?: ColorValue | undefined; /** * The search and close icon color shown in the header * * @plaform android */ - headerIconColor?: ColorValue; + headerIconColor?: ColorValue | undefined; /** * Show the search hint icon when search bar is focused * * @plaform android * @default true */ - shouldShowHintSearchIcon?: boolean; + shouldShowHintSearchIcon?: boolean | undefined; } export interface ScreenStackHeaderSubviewProps { @@ -1077,99 +1091,105 @@ export interface ScreenStackHeaderSubviewProps { * * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/hidessharedbackground */ - hidesSharedBackground?: boolean; + hidesSharedBackground?: boolean | undefined; } interface SharedHeaderBarButtonItem { /** * Position of the item in the navigation items array. */ - index?: number; + index?: number | undefined; /** * Title of the item. */ - title?: string; + title?: string | undefined; /** * Style for the item label. */ - titleStyle?: { - fontFamily?: string; - fontSize?: number; - fontWeight?: string; - color?: ColorValue; - }; + titleStyle?: + | { + fontFamily?: string | undefined; + fontSize?: number | undefined; + fontWeight?: string | undefined; + color?: ColorValue | undefined; + } + | undefined; /** * Icon for the item */ - icon?: PlatformIconIOS; + icon?: PlatformIconIOS | undefined; /** * The variant of the item. * "Prominent" only available from iOS 26.0 and later. * * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/style-swift.property */ - variant?: 'plain' | 'done' | 'prominent'; + variant?: 'plain' | 'done' | 'prominent' | undefined; /** * The tint color to apply to the item. * * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/tintcolor */ - tintColor?: ColorValue; + tintColor?: ColorValue | undefined; /** * A Boolean value that indicates whether the item is in a disabled state. */ - disabled?: boolean; + disabled?: boolean | undefined; /** * The width of the item. * * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/width */ - width?: number; + width?: number | undefined; /** * A boolean value indicating whether the background this item may share with other items in the bar should be hidden. * Only available from iOS 26.0 and later. * * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/hidessharedbackground */ - hidesSharedBackground?: boolean; + hidesSharedBackground?: boolean | undefined; /** * A boolean value indicating whether this item can share a background with other items in a navigation bar or a toolbar. * Only available from iOS 26.0 and later. * * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground */ - sharesBackground?: boolean; + sharesBackground?: boolean | undefined; /** * An identifier used to match items across transitions in a navigation bar or toolbar. * Only available from iOS 26.0 and later. * * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/identifier */ - identifier?: string; + identifier?: string | undefined; /** * A badge to be rendered on a item. * Only available from iOS 26.0 and later. * * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitembadge */ - badge?: { - /** - * The text to display in the badge. - */ - value: string; - /** - * Style of the badge. - */ - style?: { - color?: ColorValue; - backgroundColor?: ColorValue; - fontFamily?: string; - fontSize?: number; - fontWeight?: string; - }; - }; - accessibilityLabel?: string; - accessibilityHint?: string; + badge?: + | { + /** + * The text to display in the badge. + */ + value: string; + /** + * Style of the badge. + */ + style?: + | { + color?: ColorValue | undefined; + backgroundColor?: ColorValue | undefined; + fontFamily?: string | undefined; + fontSize?: number | undefined; + fontWeight?: string | undefined; + } + | undefined; + } + | undefined; + accessibilityLabel?: string | undefined; + accessibilityHint?: string | undefined; } export interface HeaderBarButtonItemWithAction @@ -1181,71 +1201,71 @@ export interface HeaderBarButtonItemWithAction * * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/isselected */ - selected?: boolean; + selected?: boolean | undefined; } export interface HeaderBarButtonItemMenuAction { type: 'action'; - title?: string; - subtitle?: string; + title?: string | undefined; + subtitle?: string | undefined; onPress: () => void; - icon?: PlatformIconIOS; + icon?: PlatformIconIOS | undefined; /** * State of the item. * * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/state */ - state?: 'on' | 'off' | 'mixed'; + state?: 'on' | 'off' | 'mixed' | undefined; /** * Indicates whether to apply disabled style to the item. * * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/disabled */ - disabled?: boolean; + disabled?: boolean | undefined; /** * Indicates whether to apply destructive style to the item. * * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive */ - destructive?: boolean; + destructive?: boolean | undefined; /** * Indicates whether to apply hidden style to the item. * * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/hidden */ - hidden?: boolean; + hidden?: boolean | undefined; /** * Indicates whether to keep the menu presented after firing the element’s action. * * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented */ - keepsMenuPresented?: boolean; + keepsMenuPresented?: boolean | undefined; /** * Discoverability label of the menu item. * * Read more: https://developer.apple.com/documentation/uikit/uiaction/discoverabilitytitle */ - discoverabilityLabel?: string; + discoverabilityLabel?: string | undefined; } export interface HeaderBarButtonItemSubmenu { type: 'submenu'; - title?: string; - icon?: PlatformIconIOS; + title?: string | undefined; + icon?: PlatformIconIOS | undefined; items: HeaderBarButtonItemWithMenu['menu']['items']; - displayInline?: boolean; - destructive?: boolean; - singleSelection?: boolean; - displayAsPalette?: boolean; + displayInline?: boolean | undefined; + destructive?: boolean | undefined; + singleSelection?: boolean | undefined; + displayAsPalette?: boolean | undefined; } export interface HeaderBarButtonItemWithMenu extends SharedHeaderBarButtonItem { type: 'menu'; menu: { - title?: string; + title?: string | undefined; items: (HeaderBarButtonItemMenuAction | HeaderBarButtonItemSubmenu)[]; - singleSelection?: boolean; - displayAsPalette?: boolean; + singleSelection?: boolean | undefined; + displayAsPalette?: boolean | undefined; }; /** * A Boolean value that indicates whether the button title should indicate selection or not. @@ -1253,7 +1273,7 @@ export interface HeaderBarButtonItemWithMenu extends SharedHeaderBarButtonItem { * * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/changesselectionasprimaryaction */ - changesSelectionAsPrimaryAction?: boolean; + changesSelectionAsPrimaryAction?: boolean | undefined; } export interface HeaderBarButtonItemSpacing { @@ -1327,6 +1347,6 @@ export interface GestureProps { } export interface GestureProviderProps extends GestureProps { - children?: React.ReactNode; + children?: React.ReactNode | undefined; gestureDetectorBridge: React.MutableRefObject; } From bebd04cbadcbd808379edf67d8c74584e0c5b850 Mon Sep 17 00:00:00 2001 From: Krzysztof Ligarski Date: Wed, 15 Apr 2026 19:01:54 +0200 Subject: [PATCH 3/4] remove undefined after CT.WithDefault to satisfy codegen --- .../FullWindowOverlayNativeComponent.ts | 2 +- src/fabric/ModalScreenNativeComponent.ts | 60 ++++++---------- src/fabric/ScreenNativeComponent.ts | 71 ++++++++----------- .../ScreenStackHeaderConfigNativeComponent.ts | 18 ++--- ...ScreenStackHeaderSubviewNativeComponent.ts | 6 +- src/fabric/ScreenStackNativeComponent.ts | 8 +-- src/fabric/SearchBarNativeComponent.ts | 18 +++-- .../gamma/ScrollViewMarkerNativeComponent.ts | 16 ++--- .../gamma/split/SplitHostNativeComponent.ts | 69 ++++++++---------- .../gamma/split/SplitScreenNativeComponent.ts | 2 +- .../gamma/stack/StackScreenNativeComponent.ts | 4 +- .../safe-area/SafeAreaViewNativeComponent.ts | 2 +- ...bsBottomAccessoryContentNativeComponent.ts | 4 +- .../tabs/TabsHostAndroidNativeComponent.ts | 8 +-- src/fabric/tabs/TabsHostIOSNativeComponent.ts | 18 ++--- .../tabs/TabsScreenAndroidNativeComponent.ts | 15 ++-- .../tabs/TabsScreenIOSNativeComponent.ts | 43 +++++------ 17 files changed, 145 insertions(+), 219 deletions(-) diff --git a/src/fabric/FullWindowOverlayNativeComponent.ts b/src/fabric/FullWindowOverlayNativeComponent.ts index 0192291528..4906480c7f 100644 --- a/src/fabric/FullWindowOverlayNativeComponent.ts +++ b/src/fabric/FullWindowOverlayNativeComponent.ts @@ -5,7 +5,7 @@ import type { CodegenTypes as CT, ViewProps } from 'react-native'; // Internal export, not part of stable library API. export interface NativeProps extends ViewProps { - accessibilityContainerViewIsModal?: CT.WithDefault | undefined; + accessibilityContainerViewIsModal?: CT.WithDefault; } export default codegenNativeComponent('RNSFullWindowOverlay', { diff --git a/src/fabric/ModalScreenNativeComponent.ts b/src/fabric/ModalScreenNativeComponent.ts index ba4750f59b..3721cbefe7 100644 --- a/src/fabric/ModalScreenNativeComponent.ts +++ b/src/fabric/ModalScreenNativeComponent.ts @@ -83,26 +83,22 @@ export interface NativeProps extends ViewProps { onSheetDetentChanged?: | CT.DirectEventHandler | undefined; - screenId?: CT.WithDefault | undefined; + screenId?: CT.WithDefault; sheetAllowedDetents?: number[] | undefined; - sheetLargestUndimmedDetent?: CT.WithDefault | undefined; - sheetGrabberVisible?: CT.WithDefault | undefined; - sheetCornerRadius?: CT.WithDefault | undefined; - sheetExpandsWhenScrolledToEdge?: CT.WithDefault | undefined; - sheetInitialDetent?: CT.WithDefault | undefined; - sheetElevation?: CT.WithDefault | undefined; - sheetShouldOverflowTopInset?: CT.WithDefault | undefined; - sheetDefaultResizeAnimationEnabled?: - | CT.WithDefault - | undefined; + sheetLargestUndimmedDetent?: CT.WithDefault; + sheetGrabberVisible?: CT.WithDefault; + sheetCornerRadius?: CT.WithDefault; + sheetExpandsWhenScrolledToEdge?: CT.WithDefault; + sheetInitialDetent?: CT.WithDefault; + sheetElevation?: CT.WithDefault; + sheetShouldOverflowTopInset?: CT.WithDefault; + sheetDefaultResizeAnimationEnabled?: CT.WithDefault; customAnimationOnSwipe?: boolean | undefined; - fullScreenSwipeEnabled?: - | CT.WithDefault - | undefined; - fullScreenSwipeShadowEnabled?: CT.WithDefault | undefined; + fullScreenSwipeEnabled?: CT.WithDefault; + fullScreenSwipeShadowEnabled?: CT.WithDefault; homeIndicatorHidden?: boolean | undefined; preventNativeDismiss?: boolean | undefined; - gestureEnabled?: CT.WithDefault | undefined; + gestureEnabled?: CT.WithDefault; statusBarColor?: ColorValue | undefined; statusBarHidden?: boolean | undefined; screenOrientation?: string | undefined; @@ -110,32 +106,22 @@ export interface NativeProps extends ViewProps { statusBarStyle?: string | undefined; statusBarTranslucent?: boolean | undefined; gestureResponseDistance?: GestureResponseDistanceType | undefined; - stackPresentation?: CT.WithDefault | undefined; - stackAnimation?: CT.WithDefault | undefined; - transitionDuration?: CT.WithDefault | undefined; - replaceAnimation?: CT.WithDefault | undefined; - swipeDirection?: CT.WithDefault | undefined; + stackPresentation?: CT.WithDefault; + stackAnimation?: CT.WithDefault; + transitionDuration?: CT.WithDefault; + replaceAnimation?: CT.WithDefault; + swipeDirection?: CT.WithDefault; hideKeyboardOnSwipe?: boolean | undefined; - activityState?: CT.WithDefault | undefined; + activityState?: CT.WithDefault; navigationBarColor?: ColorValue | undefined; navigationBarTranslucent?: boolean | undefined; navigationBarHidden?: boolean | undefined; nativeBackButtonDismissalEnabled?: boolean | undefined; - bottomScrollEdgeEffect?: - | CT.WithDefault - | undefined; - leftScrollEdgeEffect?: - | CT.WithDefault - | undefined; - rightScrollEdgeEffect?: - | CT.WithDefault - | undefined; - topScrollEdgeEffect?: - | CT.WithDefault - | undefined; - synchronousShadowStateUpdatesEnabled?: - | CT.WithDefault - | undefined; + bottomScrollEdgeEffect?: CT.WithDefault; + leftScrollEdgeEffect?: CT.WithDefault; + rightScrollEdgeEffect?: CT.WithDefault; + topScrollEdgeEffect?: CT.WithDefault; + synchronousShadowStateUpdatesEnabled?: CT.WithDefault; } export default codegenNativeComponent('RNSModalScreen', { diff --git a/src/fabric/ScreenNativeComponent.ts b/src/fabric/ScreenNativeComponent.ts index 91d89f297c..fa037c9218 100644 --- a/src/fabric/ScreenNativeComponent.ts +++ b/src/fabric/ScreenNativeComponent.ts @@ -83,26 +83,22 @@ export interface NativeProps extends ViewProps { onSheetDetentChanged?: | CT.DirectEventHandler | undefined; - screenId?: CT.WithDefault | undefined; + screenId?: CT.WithDefault; sheetAllowedDetents?: number[] | undefined; - sheetLargestUndimmedDetent?: CT.WithDefault | undefined; - sheetGrabberVisible?: CT.WithDefault | undefined; - sheetCornerRadius?: CT.WithDefault | undefined; - sheetExpandsWhenScrolledToEdge?: CT.WithDefault | undefined; - sheetInitialDetent?: CT.WithDefault | undefined; - sheetElevation?: CT.WithDefault | undefined; - sheetShouldOverflowTopInset?: CT.WithDefault | undefined; - sheetDefaultResizeAnimationEnabled?: - | CT.WithDefault - | undefined; + sheetLargestUndimmedDetent?: CT.WithDefault; + sheetGrabberVisible?: CT.WithDefault; + sheetCornerRadius?: CT.WithDefault; + sheetExpandsWhenScrolledToEdge?: CT.WithDefault; + sheetInitialDetent?: CT.WithDefault; + sheetElevation?: CT.WithDefault; + sheetShouldOverflowTopInset?: CT.WithDefault; + sheetDefaultResizeAnimationEnabled?: CT.WithDefault; customAnimationOnSwipe?: boolean | undefined; - fullScreenSwipeEnabled?: - | CT.WithDefault - | undefined; - fullScreenSwipeShadowEnabled?: CT.WithDefault | undefined; + fullScreenSwipeEnabled?: CT.WithDefault; + fullScreenSwipeShadowEnabled?: CT.WithDefault; homeIndicatorHidden?: boolean | undefined; preventNativeDismiss?: boolean | undefined; - gestureEnabled?: CT.WithDefault | undefined; + gestureEnabled?: CT.WithDefault; statusBarColor?: ColorValue | undefined; statusBarHidden?: boolean | undefined; screenOrientation?: string | undefined; @@ -110,38 +106,27 @@ export interface NativeProps extends ViewProps { statusBarStyle?: string | undefined; statusBarTranslucent?: boolean | undefined; gestureResponseDistance?: GestureResponseDistanceType | undefined; - stackPresentation?: CT.WithDefault | undefined; - stackAnimation?: CT.WithDefault | undefined; - transitionDuration?: CT.WithDefault | undefined; - replaceAnimation?: CT.WithDefault | undefined; - swipeDirection?: CT.WithDefault | undefined; + stackPresentation?: CT.WithDefault; + stackAnimation?: CT.WithDefault; + transitionDuration?: CT.WithDefault; + replaceAnimation?: CT.WithDefault; + swipeDirection?: CT.WithDefault; hideKeyboardOnSwipe?: boolean | undefined; - activityState?: CT.WithDefault | undefined; + activityState?: CT.WithDefault; navigationBarColor?: ColorValue | undefined; navigationBarTranslucent?: boolean | undefined; navigationBarHidden?: boolean | undefined; nativeBackButtonDismissalEnabled?: boolean | undefined; - bottomScrollEdgeEffect?: - | CT.WithDefault - | undefined; - leftScrollEdgeEffect?: - | CT.WithDefault - | undefined; - rightScrollEdgeEffect?: - | CT.WithDefault - | undefined; - topScrollEdgeEffect?: - | CT.WithDefault - | undefined; - synchronousShadowStateUpdatesEnabled?: - | CT.WithDefault - | undefined; - androidResetScreenShadowStateOnOrientationChangeEnabled?: - | CT.WithDefault - | undefined; - ios26AllowInteractionsDuringTransition?: - | CT.WithDefault - | undefined; + bottomScrollEdgeEffect?: CT.WithDefault; + leftScrollEdgeEffect?: CT.WithDefault; + rightScrollEdgeEffect?: CT.WithDefault; + topScrollEdgeEffect?: CT.WithDefault; + synchronousShadowStateUpdatesEnabled?: CT.WithDefault; + androidResetScreenShadowStateOnOrientationChangeEnabled?: CT.WithDefault< + boolean, + true + >; + ios26AllowInteractionsDuringTransition?: CT.WithDefault; } export default codegenNativeComponent('RNSScreen', { diff --git a/src/fabric/ScreenStackHeaderConfigNativeComponent.ts b/src/fabric/ScreenStackHeaderConfigNativeComponent.ts index 82ffbe8d41..ba2479de0f 100644 --- a/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +++ b/src/fabric/ScreenStackHeaderConfigNativeComponent.ts @@ -47,9 +47,9 @@ export interface NativeProps extends ViewProps { backTitle?: string | undefined; backTitleFontFamily?: string | undefined; backTitleFontSize?: CT.Int32 | undefined; - backTitleVisible?: CT.WithDefault | undefined; + backTitleVisible?: CT.WithDefault; color?: ColorValue | undefined; - direction?: CT.WithDefault | undefined; + direction?: CT.WithDefault; hidden?: boolean | undefined; hideShadow?: boolean | undefined; largeTitle?: boolean | undefined; @@ -66,12 +66,10 @@ export interface NativeProps extends ViewProps { titleFontWeight?: string | undefined; titleColor?: ColorValue | undefined; disableBackButtonMenu?: boolean | undefined; - backButtonDisplayMode?: - | CT.WithDefault - | undefined; + backButtonDisplayMode?: CT.WithDefault; hideBackButton?: boolean | undefined; backButtonInCustomView?: boolean | undefined; - blurEffect?: CT.WithDefault | undefined; + blurEffect?: CT.WithDefault; // TODO: implement this props on iOS topInsetEnabled?: boolean | undefined; headerLeftBarButtonItems?: CT.UnsafeMixed[] | undefined; @@ -82,14 +80,10 @@ export interface NativeProps extends ViewProps { onPressHeaderBarButtonMenuItem?: | CT.DirectEventHandler | undefined; - synchronousShadowStateUpdatesEnabled?: - | CT.WithDefault - | undefined; + synchronousShadowStateUpdatesEnabled?: CT.WithDefault; // Experimental - userInterfaceStyle?: - | CT.WithDefault - | undefined; + userInterfaceStyle?: CT.WithDefault; consumeTopInset?: boolean | undefined; legacyTopInsetBehavior?: boolean | undefined; } diff --git a/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts b/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts index 91df5d6a1b..9b7832bff0 100644 --- a/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts +++ b/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts @@ -12,11 +12,9 @@ export type HeaderSubviewTypes = | 'searchBar'; export interface NativeProps extends ViewProps { - type?: CT.WithDefault | undefined; + type?: CT.WithDefault; hidesSharedBackground?: boolean | undefined; - synchronousShadowStateUpdatesEnabled?: - | CT.WithDefault - | undefined; + synchronousShadowStateUpdatesEnabled?: CT.WithDefault; } export default codegenNativeComponent( diff --git a/src/fabric/ScreenStackNativeComponent.ts b/src/fabric/ScreenStackNativeComponent.ts index 44da23978f..9bfaf3cf39 100644 --- a/src/fabric/ScreenStackNativeComponent.ts +++ b/src/fabric/ScreenStackNativeComponent.ts @@ -7,12 +7,8 @@ import type { CodegenTypes as CT, ViewProps, ColorValue } from 'react-native'; type FinishTransitioningEvent = Readonly<{}>; export interface NativeProps extends ViewProps { - iosPreventReattachmentOfDismissedScreens?: - | CT.WithDefault - | undefined; - iosPreventReattachmentOfDismissedModals?: - | CT.WithDefault - | undefined; + iosPreventReattachmentOfDismissedScreens?: CT.WithDefault; + iosPreventReattachmentOfDismissedModals?: CT.WithDefault; nativeContainerBackgroundColor?: ColorValue | undefined; diff --git a/src/fabric/SearchBarNativeComponent.ts b/src/fabric/SearchBarNativeComponent.ts index 8c7f4b5c4b..cb876835d0 100644 --- a/src/fabric/SearchBarNativeComponent.ts +++ b/src/fabric/SearchBarNativeComponent.ts @@ -48,15 +48,13 @@ export interface NativeProps extends ViewProps { | null | undefined; onChangeText?: CT.DirectEventHandler | null | undefined; - hideWhenScrolling?: CT.WithDefault | undefined; - autoCapitalize?: - | CT.WithDefault - | undefined; + hideWhenScrolling?: CT.WithDefault; + autoCapitalize?: CT.WithDefault; placeholder?: string | undefined; - placement?: CT.WithDefault | undefined; - allowToolbarIntegration?: CT.WithDefault | undefined; - obscureBackground?: CT.WithDefault | undefined; - hideNavigationBar?: CT.WithDefault | undefined; + placement?: CT.WithDefault; + allowToolbarIntegration?: CT.WithDefault; + obscureBackground?: CT.WithDefault; + hideNavigationBar?: CT.WithDefault; cancelButtonText?: string | undefined; // TODO: implement these on iOS barTintColor?: ColorValue | undefined; @@ -64,7 +62,7 @@ export interface NativeProps extends ViewProps { textColor?: ColorValue | undefined; // Android only - autoFocus?: CT.WithDefault | undefined; + autoFocus?: CT.WithDefault; disableBackButtonOverride?: boolean | undefined; // TODO: consider creating enum here inputType?: string | undefined; @@ -72,7 +70,7 @@ export interface NativeProps extends ViewProps { onOpen?: CT.DirectEventHandler | null | undefined; hintTextColor?: ColorValue | undefined; headerIconColor?: ColorValue | undefined; - shouldShowHintSearchIcon?: CT.WithDefault | undefined; + shouldShowHintSearchIcon?: CT.WithDefault; } type ComponentType = HostComponent; diff --git a/src/fabric/gamma/ScrollViewMarkerNativeComponent.ts b/src/fabric/gamma/ScrollViewMarkerNativeComponent.ts index d27694a8a8..e76a42042b 100644 --- a/src/fabric/gamma/ScrollViewMarkerNativeComponent.ts +++ b/src/fabric/gamma/ScrollViewMarkerNativeComponent.ts @@ -6,18 +6,10 @@ import { codegenNativeComponent } from 'react-native'; type ScrollEdgeEffect = 'automatic' | 'hard' | 'soft' | 'hidden'; interface NativeProps extends ViewProps { - leftScrollEdgeEffect?: - | CT.WithDefault - | undefined; - topScrollEdgeEffect?: - | CT.WithDefault - | undefined; - rightScrollEdgeEffect?: - | CT.WithDefault - | undefined; - bottomScrollEdgeEffect?: - | CT.WithDefault - | undefined; + leftScrollEdgeEffect?: CT.WithDefault; + topScrollEdgeEffect?: CT.WithDefault; + rightScrollEdgeEffect?: CT.WithDefault; + bottomScrollEdgeEffect?: CT.WithDefault; } export default codegenNativeComponent('RNSScrollViewMarker'); diff --git a/src/fabric/gamma/split/SplitHostNativeComponent.ts b/src/fabric/gamma/split/SplitHostNativeComponent.ts index 2ef2454d22..2a648bcfd6 100644 --- a/src/fabric/gamma/split/SplitHostNativeComponent.ts +++ b/src/fabric/gamma/split/SplitHostNativeComponent.ts @@ -50,59 +50,50 @@ type SplitViewTopColumnForCollapsing = | 'secondary'; interface ColumnMetrics { - minimumPrimaryColumnWidth?: CT.WithDefault | undefined; - maximumPrimaryColumnWidth?: CT.WithDefault | undefined; - preferredPrimaryColumnWidthOrFraction?: - | CT.WithDefault - | undefined; - minimumSupplementaryColumnWidth?: CT.WithDefault | undefined; - maximumSupplementaryColumnWidth?: CT.WithDefault | undefined; - preferredSupplementaryColumnWidthOrFraction?: - | CT.WithDefault - | undefined; + minimumPrimaryColumnWidth?: CT.WithDefault; + maximumPrimaryColumnWidth?: CT.WithDefault; + preferredPrimaryColumnWidthOrFraction?: CT.WithDefault; + minimumSupplementaryColumnWidth?: CT.WithDefault; + maximumSupplementaryColumnWidth?: CT.WithDefault; + preferredSupplementaryColumnWidthOrFraction?: CT.WithDefault; // iOS 26 only - minimumSecondaryColumnWidth?: CT.WithDefault | undefined; - preferredSecondaryColumnWidthOrFraction?: - | CT.WithDefault - | undefined; - minimumInspectorColumnWidth?: CT.WithDefault | undefined; - maximumInspectorColumnWidth?: CT.WithDefault | undefined; - preferredInspectorColumnWidthOrFraction?: - | CT.WithDefault - | undefined; + minimumSecondaryColumnWidth?: CT.WithDefault; + preferredSecondaryColumnWidthOrFraction?: CT.WithDefault; + minimumInspectorColumnWidth?: CT.WithDefault; + maximumInspectorColumnWidth?: CT.WithDefault; + preferredInspectorColumnWidthOrFraction?: CT.WithDefault; } interface NativeProps extends ViewProps { // Appearance - preferredDisplayMode?: - | CT.WithDefault - | undefined; - preferredSplitBehavior?: - | CT.WithDefault - | undefined; - primaryEdge?: CT.WithDefault | undefined; - showSecondaryToggleButton?: CT.WithDefault | undefined; - displayModeButtonVisibility?: - | CT.WithDefault - | undefined; + preferredDisplayMode?: CT.WithDefault; + preferredSplitBehavior?: CT.WithDefault; + primaryEdge?: CT.WithDefault; + showSecondaryToggleButton?: CT.WithDefault; + displayModeButtonVisibility?: CT.WithDefault< + SplitViewDisplayModeButtonVisibility, + 'automatic' + >; columnMetrics?: ColumnMetrics | undefined; - orientation?: CT.WithDefault | undefined; - primaryBackgroundStyle?: - | CT.WithDefault - | undefined; + orientation?: CT.WithDefault; + primaryBackgroundStyle?: CT.WithDefault< + SplitViewPrimaryBackgroundStyle, + 'default' + >; // Behavior - topColumnForCollapsing?: - | CT.WithDefault - | undefined; + topColumnForCollapsing?: CT.WithDefault< + SplitViewTopColumnForCollapsing, + 'default' + >; // Interactions - presentsWithGesture?: CT.WithDefault | undefined; - showInspector?: CT.WithDefault | undefined; + presentsWithGesture?: CT.WithDefault; + showInspector?: CT.WithDefault; // Custom events diff --git a/src/fabric/gamma/split/SplitScreenNativeComponent.ts b/src/fabric/gamma/split/SplitScreenNativeComponent.ts index dbd7c1af8c..14e3774161 100644 --- a/src/fabric/gamma/split/SplitScreenNativeComponent.ts +++ b/src/fabric/gamma/split/SplitScreenNativeComponent.ts @@ -10,7 +10,7 @@ type SplitScreenColumnType = 'column' | 'inspector'; interface NativeProps extends ViewProps { // Config - columnType?: CT.WithDefault | undefined; + columnType?: CT.WithDefault; // Events onWillAppear?: CT.DirectEventHandler | undefined; diff --git a/src/fabric/gamma/stack/StackScreenNativeComponent.ts b/src/fabric/gamma/stack/StackScreenNativeComponent.ts index d4c76efd78..5fa7ee2bfd 100644 --- a/src/fabric/gamma/stack/StackScreenNativeComponent.ts +++ b/src/fabric/gamma/stack/StackScreenNativeComponent.ts @@ -16,7 +16,7 @@ export interface NativeProps extends ViewProps { // Control // Codegen does not currently support non-optional enum. - activityMode?: CT.WithDefault | undefined; + activityMode?: CT.WithDefault; screenKey: string; // Events @@ -34,7 +34,7 @@ export interface NativeProps extends ViewProps { // Configuration - preventNativeDismiss?: CT.WithDefault | undefined; + preventNativeDismiss?: CT.WithDefault; } export default codegenNativeComponent('RNSStackScreen', { diff --git a/src/fabric/safe-area/SafeAreaViewNativeComponent.ts b/src/fabric/safe-area/SafeAreaViewNativeComponent.ts index c1bc416db2..b3d0d2d8b1 100644 --- a/src/fabric/safe-area/SafeAreaViewNativeComponent.ts +++ b/src/fabric/safe-area/SafeAreaViewNativeComponent.ts @@ -16,7 +16,7 @@ export interface NativeProps extends ViewProps { }> | undefined; // Android-only - insetType?: CT.WithDefault | undefined; + insetType?: CT.WithDefault; } export default codegenNativeComponent('RNSSafeAreaView', { diff --git a/src/fabric/tabs/TabsBottomAccessoryContentNativeComponent.ts b/src/fabric/tabs/TabsBottomAccessoryContentNativeComponent.ts index 6657c1c671..3646447be8 100644 --- a/src/fabric/tabs/TabsBottomAccessoryContentNativeComponent.ts +++ b/src/fabric/tabs/TabsBottomAccessoryContentNativeComponent.ts @@ -6,9 +6,7 @@ import type { CodegenTypes as CT, ViewProps } from 'react-native'; type BottomAccessoryEnvironment = 'regular' | 'inline'; export interface NativeProps extends ViewProps { - environment?: - | CT.WithDefault - | undefined; + environment?: CT.WithDefault; } export default codegenNativeComponent( diff --git a/src/fabric/tabs/TabsHostAndroidNativeComponent.ts b/src/fabric/tabs/TabsHostAndroidNativeComponent.ts index 64d08997f6..ebf4cf0122 100644 --- a/src/fabric/tabs/TabsHostAndroidNativeComponent.ts +++ b/src/fabric/tabs/TabsHostAndroidNativeComponent.ts @@ -43,7 +43,7 @@ type TabsHostColorScheme = 'inherit' | 'light' | 'dark'; export interface NativeProps extends ViewProps { // Control navState: NavigationState; - rejectStaleNavStateUpdates?: CT.WithDefault | undefined; + rejectStaleNavStateUpdates?: CT.WithDefault; // Events onTabSelected?: CT.DirectEventHandler | undefined; @@ -55,12 +55,12 @@ export interface NativeProps extends ViewProps { | undefined; // General - tabBarHidden?: CT.WithDefault | undefined; + tabBarHidden?: CT.WithDefault; nativeContainerBackgroundColor?: ColorValue | undefined; - colorScheme?: CT.WithDefault | undefined; + colorScheme?: CT.WithDefault; // Android-specific props - tabBarRespectsIMEInsets?: CT.WithDefault | undefined; + tabBarRespectsIMEInsets?: CT.WithDefault; } export default codegenNativeComponent('RNSTabsHostAndroid', { diff --git a/src/fabric/tabs/TabsHostIOSNativeComponent.ts b/src/fabric/tabs/TabsHostIOSNativeComponent.ts index ebf6e477d4..9778135482 100644 --- a/src/fabric/tabs/TabsHostIOSNativeComponent.ts +++ b/src/fabric/tabs/TabsHostIOSNativeComponent.ts @@ -58,7 +58,7 @@ type TabBarControllerMode = 'automatic' | 'tabBar' | 'tabSidebar'; export interface NativeProps extends ViewProps { // Control navState: NavigationState; - rejectStaleNavStateUpdates?: CT.WithDefault | undefined; + rejectStaleNavStateUpdates?: CT.WithDefault; // Events onTabSelected?: CT.DirectEventHandler | undefined; @@ -71,25 +71,21 @@ export interface NativeProps extends ViewProps { onMoreTabSelected?: CT.DirectEventHandler | undefined; // General - tabBarHidden?: CT.WithDefault | undefined; + tabBarHidden?: CT.WithDefault; nativeContainerBackgroundColor?: ColorValue | undefined; - colorScheme?: CT.WithDefault | undefined; + colorScheme?: CT.WithDefault; // We can't use `direction` name for this prop as it's also used by // direction style View prop. - layoutDirection?: CT.WithDefault | undefined; + layoutDirection?: CT.WithDefault; // Experimental support - controlNavigationStateInJS?: CT.WithDefault | undefined; + controlNavigationStateInJS?: CT.WithDefault; // iOS-specific props tabBarTintColor?: ColorValue | undefined; - tabBarMinimizeBehavior?: - | CT.WithDefault - | undefined; - tabBarControllerMode?: - | CT.WithDefault - | undefined; + tabBarMinimizeBehavior?: CT.WithDefault; + tabBarControllerMode?: CT.WithDefault; } export default codegenNativeComponent('RNSTabsHostIOS', { diff --git a/src/fabric/tabs/TabsScreenAndroidNativeComponent.ts b/src/fabric/tabs/TabsScreenAndroidNativeComponent.ts index 80c3a7c772..104117271d 100644 --- a/src/fabric/tabs/TabsScreenAndroidNativeComponent.ts +++ b/src/fabric/tabs/TabsScreenAndroidNativeComponent.ts @@ -36,9 +36,10 @@ export type Appearance = { tabBarItemRippleColor?: ProcessedColorValue | null | undefined; // TabBarItem - Label layout - tabBarItemLabelVisibilityMode?: - | CT.WithDefault - | undefined; + tabBarItemLabelVisibilityMode?: CT.WithDefault< + TabBarItemLabelVisibilityMode, + 'auto' + >; // TabBarItem - State-dependent appearance normal?: ItemStateAppearance | undefined; @@ -48,7 +49,7 @@ export type Appearance = { // TabBarItem - Active Indicator tabBarItemActiveIndicatorColor?: ProcessedColorValue | null | undefined; - tabBarItemActiveIndicatorEnabled?: CT.WithDefault | undefined; + tabBarItemActiveIndicatorEnabled?: CT.WithDefault; // TabBarItem - Label tabBarItemTitleFontFamily?: string | undefined; @@ -73,7 +74,7 @@ export interface NativeProps extends ViewProps { // Control screenKey: string; - preventNativeSelection?: CT.WithDefault | undefined; + preventNativeSelection?: CT.WithDefault; // General title?: string | undefined | null; @@ -88,8 +89,8 @@ export interface NativeProps extends ViewProps { | { repeatedTabSelection?: | { - popToRoot?: CT.WithDefault | undefined; - scrollToTop?: CT.WithDefault | undefined; + popToRoot?: CT.WithDefault; + scrollToTop?: CT.WithDefault; } | undefined; } diff --git a/src/fabric/tabs/TabsScreenIOSNativeComponent.ts b/src/fabric/tabs/TabsScreenIOSNativeComponent.ts index d861137c03..4a2f7e5c90 100644 --- a/src/fabric/tabs/TabsScreenIOSNativeComponent.ts +++ b/src/fabric/tabs/TabsScreenIOSNativeComponent.ts @@ -52,7 +52,7 @@ export type Appearance = { tabBarBackgroundColor?: ProcessedColorValue | null | undefined; tabBarShadowColor?: ProcessedColorValue | null | undefined; - tabBarBlurEffect?: CT.WithDefault | undefined; + tabBarBlurEffect?: CT.WithDefault; }; type BlurEffect = @@ -120,12 +120,12 @@ export interface NativeProps extends ViewProps { // Control screenKey: string; - preventNativeSelection?: CT.WithDefault | undefined; + preventNativeSelection?: CT.WithDefault; // General title?: string | undefined | null; badgeValue?: string | undefined; - orientation?: CT.WithDefault | undefined; + orientation?: CT.WithDefault; // Accessibility tabBarItemTestID?: string | undefined; @@ -136,8 +136,8 @@ export interface NativeProps extends ViewProps { | { repeatedTabSelection?: | { - popToRoot?: CT.WithDefault | undefined; - scrollToTop?: CT.WithDefault | undefined; + popToRoot?: CT.WithDefault; + scrollToTop?: CT.WithDefault; } | undefined; } @@ -145,41 +145,32 @@ export interface NativeProps extends ViewProps { // iOS-specific props // Tab config - isTitleUndefined?: CT.WithDefault | undefined; - systemItem?: CT.WithDefault | undefined; + isTitleUndefined?: CT.WithDefault; + systemItem?: CT.WithDefault; // Appearance standardAppearance?: UnsafeMixed | undefined; scrollEdgeAppearance?: UnsafeMixed | undefined; // Icons - iconType?: CT.WithDefault | undefined; + iconType?: CT.WithDefault; iconImageSource?: ImageSource | undefined; iconResourceName?: string | undefined; selectedIconImageSource?: ImageSource | undefined; selectedIconResourceName?: string | undefined; // ScrollView interactions - overrideScrollViewContentInsetAdjustmentBehavior?: - | CT.WithDefault - | undefined; - bottomScrollEdgeEffect?: - | CT.WithDefault - | undefined; - leftScrollEdgeEffect?: - | CT.WithDefault - | undefined; - rightScrollEdgeEffect?: - | CT.WithDefault - | undefined; - topScrollEdgeEffect?: - | CT.WithDefault - | undefined; + overrideScrollViewContentInsetAdjustmentBehavior?: CT.WithDefault< + boolean, + true + >; + bottomScrollEdgeEffect?: CT.WithDefault; + leftScrollEdgeEffect?: CT.WithDefault; + rightScrollEdgeEffect?: CT.WithDefault; + topScrollEdgeEffect?: CT.WithDefault; // Experimental - userInterfaceStyle?: - | CT.WithDefault - | undefined; + userInterfaceStyle?: CT.WithDefault; } export default codegenNativeComponent('RNSTabsScreenIOS', { From 166affb2877aa07d8c4ffac5e4c8fc22b112c7fe Mon Sep 17 00:00:00 2001 From: Yevhenii Date: Mon, 20 Apr 2026 14:20:15 +0300 Subject: [PATCH 4/4] chore(types): use NonNullable<> for ScrollViewMarker.children ScrollViewMarker is an experimental component (under gamma/) and semantically expects a ScrollView inside as its child. Using NonNullable makes that intent explicit in the type rather than relying on React.ReactNode's permissive undefined branch. --- .../gamma/scroll-view-marker/ScrollViewMarker.types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/gamma/scroll-view-marker/ScrollViewMarker.types.ts b/src/components/gamma/scroll-view-marker/ScrollViewMarker.types.ts index 26fe31eda5..025e6f6039 100644 --- a/src/components/gamma/scroll-view-marker/ScrollViewMarker.types.ts +++ b/src/components/gamma/scroll-view-marker/ScrollViewMarker.types.ts @@ -2,7 +2,7 @@ import type { ViewProps } from 'react-native'; import type { ScrollEdgeEffect } from '../../shared/types'; export interface ScrollViewMarkerProps { - children: ViewProps['children']; + children: NonNullable; style?: ViewProps['style'] | undefined; /**