Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing events #2095

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/components/Screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,8 @@
import ScreenNativeComponent from '../fabric/ScreenNativeComponent';
import ModalScreenNativeComponent from '../fabric/ModalScreenNativeComponent';

// @ts-ignore - its taken straight from RN
// eslint-disable-next-line import/namespace
import { customDirectEventTypes } from 'react-native/Libraries/Renderer/shims/ReactNativeViewConfigRegistry';

customDirectEventTypes.topInsetsChange = {
registrationName: 'topInsetsChange',
};
customDirectEventTypes.topAttached = {
registrationName: 'topAttached',
};
customDirectEventTypes.topDetached = {
registrationName: 'topDetached',
};

export const NativeScreen: React.ComponentType<ScreenProps> =
ScreenNativeComponent as any;

Check warning on line 20 in src/components/Screen.tsx

View workflow job for this annotation

GitHub Actions / install-and-lint

Unexpected any. Specify a different type
const AnimatedNativeScreen = Animated.createAnimatedComponent(NativeScreen);
const AnimatedNativeModalScreen = Animated.createAnimatedComponent(
ModalScreenNativeComponent as React.ComponentType<ScreenProps>
Expand Down
22 changes: 11 additions & 11 deletions src/fabric/ModalScreenNativeComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type { ViewProps, ColorValue } from 'react-native';
import type {
BubblingEventHandler,
DirectEventHandler,
WithDefault,
Int32,
Float,
Expand Down Expand Up @@ -60,16 +60,16 @@ type ReplaceAnimation = 'pop' | 'push';
type SheetDetentTypes = 'large' | 'medium' | 'all';

export interface NativeProps extends ViewProps {
onAppear?: BubblingEventHandler<ScreenEvent>;
onDisappear?: BubblingEventHandler<ScreenEvent>;
onDismissed?: BubblingEventHandler<ScreenDismissedEvent>;
onNativeDismissCancelled?: BubblingEventHandler<ScreenDismissedEvent>;
onWillAppear?: BubblingEventHandler<ScreenEvent>;
onWillDisappear?: BubblingEventHandler<ScreenEvent>;
onHeaderHeightChange?: BubblingEventHandler<HeaderHeightChangeEvent>;
onTransitionProgress?: BubblingEventHandler<TransitionProgressEvent>;
onGestureCancel?: BubblingEventHandler<ScreenEvent>;
onHeaderBackButtonClicked?: BubblingEventHandler<ScreenEvent>;
onAppear?: DirectEventHandler<ScreenEvent>;
onDisappear?: DirectEventHandler<ScreenEvent>;
onDismissed?: DirectEventHandler<ScreenDismissedEvent>;
onNativeDismissCancelled?: DirectEventHandler<ScreenDismissedEvent>;
onWillAppear?: DirectEventHandler<ScreenEvent>;
onWillDisappear?: DirectEventHandler<ScreenEvent>;
onHeaderHeightChange?: DirectEventHandler<HeaderHeightChangeEvent>;
onTransitionProgress?: DirectEventHandler<TransitionProgressEvent>;
onGestureCancel?: DirectEventHandler<ScreenEvent>;
onHeaderBackButtonClicked?: DirectEventHandler<ScreenEvent>;
sheetAllowedDetents?: WithDefault<SheetDetentTypes, 'large'>;
sheetLargestUndimmedDetent?: WithDefault<SheetDetentTypes, 'all'>;
sheetGrabberVisible?: WithDefault<boolean, false>;
Expand Down
22 changes: 11 additions & 11 deletions src/fabric/ScreenNativeComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type { ViewProps, ColorValue } from 'react-native';
import type {
BubblingEventHandler,
DirectEventHandler,
WithDefault,
Int32,
Float,
Expand Down Expand Up @@ -60,16 +60,16 @@ type ReplaceAnimation = 'pop' | 'push';
type SheetDetentTypes = 'large' | 'medium' | 'all';

export interface NativeProps extends ViewProps {
onAppear?: BubblingEventHandler<ScreenEvent>;
onDisappear?: BubblingEventHandler<ScreenEvent>;
onDismissed?: BubblingEventHandler<ScreenDismissedEvent>;
onNativeDismissCancelled?: BubblingEventHandler<ScreenDismissedEvent>;
onWillAppear?: BubblingEventHandler<ScreenEvent>;
onWillDisappear?: BubblingEventHandler<ScreenEvent>;
onHeaderHeightChange?: BubblingEventHandler<HeaderHeightChangeEvent>;
onTransitionProgress?: BubblingEventHandler<TransitionProgressEvent>;
onGestureCancel?: BubblingEventHandler<ScreenEvent>;
onHeaderBackButtonClicked?: BubblingEventHandler<ScreenEvent>;
onAppear?: DirectEventHandler<ScreenEvent>;
onDisappear?: DirectEventHandler<ScreenEvent>;
onDismissed?: DirectEventHandler<ScreenDismissedEvent>;
onNativeDismissCancelled?: DirectEventHandler<ScreenDismissedEvent>;
onWillAppear?: DirectEventHandler<ScreenEvent>;
onWillDisappear?: DirectEventHandler<ScreenEvent>;
onHeaderHeightChange?: DirectEventHandler<HeaderHeightChangeEvent>;
onTransitionProgress?: DirectEventHandler<TransitionProgressEvent>;
onGestureCancel?: DirectEventHandler<ScreenEvent>;
onHeaderBackButtonClicked?: DirectEventHandler<ScreenEvent>;
sheetAllowedDetents?: WithDefault<SheetDetentTypes, 'large'>;
sheetLargestUndimmedDetent?: WithDefault<SheetDetentTypes, 'all'>;
sheetGrabberVisible?: WithDefault<boolean, false>;
Expand Down
8 changes: 8 additions & 0 deletions src/fabric/ScreenStackHeaderConfigNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ import type { ViewProps, ColorValue } from 'react-native';
import type {
Int32,
WithDefault,
DirectEventHandler,
} from 'react-native/Libraries/Types/CodegenTypes';

type DirectionType = 'rtl' | 'ltr';

// eslint-disable-next-line @typescript-eslint/ban-types
type OnAttachedEvent = Readonly<{}>;
// eslint-disable-next-line @typescript-eslint/ban-types
type OnDetachedEvent = Readonly<{}>;

export interface NativeProps extends ViewProps {
onAttached?: DirectEventHandler<OnAttachedEvent>;
onDetached?: DirectEventHandler<OnDetachedEvent>;
backgroundColor?: ColorValue;
backTitle?: string;
backTitleFontFamily?: string;
Expand Down
16 changes: 8 additions & 8 deletions src/fabric/SearchBarNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNati
import type { ViewProps, ColorValue, HostComponent } from 'react-native';
import type {
WithDefault,
BubblingEventHandler,
DirectEventHandler,
} from 'react-native/Libraries/Types/CodegenTypes';
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';

Expand All @@ -22,11 +22,11 @@ type SearchBarPlacement = 'automatic' | 'inline' | 'stacked';
type AutoCapitalizeType = 'none' | 'words' | 'sentences' | 'characters';

interface NativeProps extends ViewProps {
onFocus?: BubblingEventHandler<SearchBarEvent> | null;
onBlur?: BubblingEventHandler<SearchBarEvent> | null;
onSearchButtonPress?: BubblingEventHandler<SearchButtonPressedEvent> | null;
onCancelButtonPress?: BubblingEventHandler<SearchBarEvent> | null;
onChangeText?: BubblingEventHandler<ChangeTextEvent> | null;
onFocus?: DirectEventHandler<SearchBarEvent> | null;
onBlur?: DirectEventHandler<SearchBarEvent> | null;
onSearchButtonPress?: DirectEventHandler<SearchButtonPressedEvent> | null;
onCancelButtonPress?: DirectEventHandler<SearchBarEvent> | null;
onChangeText?: DirectEventHandler<ChangeTextEvent> | null;
hideWhenScrolling?: boolean;
autoCapitalize?: WithDefault<AutoCapitalizeType, 'none'>;
placeholder?: string;
Expand All @@ -43,8 +43,8 @@ interface NativeProps extends ViewProps {
disableBackButtonOverride?: boolean;
// TODO: consider creating enum here
inputType?: string;
onClose?: BubblingEventHandler<SearchBarEvent> | null;
onOpen?: BubblingEventHandler<SearchBarEvent> | null;
onClose?: DirectEventHandler<SearchBarEvent> | null;
onOpen?: DirectEventHandler<SearchBarEvent> | null;
hintTextColor?: ColorValue;
headerIconColor?: ColorValue;
shouldShowHintSearchIcon?: WithDefault<boolean, true>;
Expand Down