Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/common-app/src/new_api/components/buttons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function ButtonWrapper({
<ButtonComponent
style={[styles.button, { backgroundColor: color }]}
onPress={() =>
feedback?.current?.showMessage(`[${ButtonComponent.name}] onLongPress`)
feedback?.current?.showMessage(`[${ButtonComponent.name}] onPress`)
}
onLongPress={() => {
feedback?.current?.showMessage(`[${ButtonComponent.name}] onLongPress`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export interface ButtonProps extends ViewProps, AccessibilityProps {
/**
* Invoked on mount and layout changes.
*/
onLayout?: (event: LayoutChangeEvent) => void;
onLayout?: ((event: LayoutChangeEvent) => void) | undefined;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is necessary because of #4012


/**
* Used for testing-library compatibility, not passed to the native component.
Expand Down Expand Up @@ -101,7 +101,7 @@ export interface ButtonProps extends ViewProps, AccessibilityProps {
testOnly_onLongPress?: Function | null | undefined;
}

const ButtonComponent =
export const ButtonComponent =
RNGestureHandlerButtonNativeComponent as HostComponent<ButtonProps>;

export default function GestureHandlerButton({ style, ...rest }: ButtonProps) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import * as React from 'react';
import { View } from 'react-native';
import { View, ViewProps } from 'react-native';

export default React.forwardRef<React.ComponentRef<typeof View>>(
(props, ref) => <View ref={ref} accessibilityRole="button" {...props} />
type ButtonProps = ViewProps & {
ref?: React.Ref<React.ComponentRef<typeof View>>;
};

export const ButtonComponent = (props: ButtonProps) => (
<View accessibilityRole="button" {...props} />
);

Comment thread
m-bert marked this conversation as resolved.
export default ButtonComponent;
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
StyleProp,
ViewStyle,
} from 'react-native';
import NativeButton from '../GestureHandlerButton';
import { ButtonComponent as NativeButton } from '../GestureHandlerButton';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a remark, you don't have to change it if you don't think it's necessary: I think it would be sensible to simply change the name of the ButtonComponent to NativeButton. Also after changes in the ../GestureHandlerButton, the Button imported in the v3 version is the wrapped one, thus aliasing it as PureNativeButton seems weird, we can just remove the alias.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can leave it as it is for now and leave those renames for other PRs. This one already grew bigger than I expected 😅

import {
gestureToPressableEvent,
addInsets,
Expand Down
Loading