Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@
ref,
...props
}: Omit<LegacyBaseButtonProps, 'innerRef'> & {
ref?: React.ForwardedRef<React.ComponentType<any>> | undefined;

Check warning on line 155 in packages/react-native-gesture-handler/src/components/GestureButtons.tsx

View workflow job for this annotation

GitHub Actions / check

Unexpected any. Specify a different type
}) => <InnerBaseButton innerRef={ref} {...props} />;

const AnimatedBaseButton = ({
ref,
...props
}: Animated.AnimatedProps<BaseButtonWithRefProps> & {
ref?: React.ForwardedRef<React.ComponentType<any>> | undefined;

Check warning on line 162 in packages/react-native-gesture-handler/src/components/GestureButtons.tsx

View workflow job for this annotation

GitHub Actions / check

Unexpected any. Specify a different type
}) => <AnimatedInnerBaseButton innerRef={ref} {...props} />;

const btnStyles = StyleSheet.create({
Expand Down Expand Up @@ -187,7 +187,7 @@

private onActiveStateChange = (active: boolean) => {
if (Platform.OS !== 'android') {
this.opacity.setValue(active ? this.props.activeOpacity! : 0);

Check warning on line 190 in packages/react-native-gesture-handler/src/components/GestureButtons.tsx

View workflow job for this annotation

GitHub Actions / check

Forbidden non-null assertion
}

this.props.onActiveStateChange?.(active);
Expand Down Expand Up @@ -240,6 +240,7 @@
static defaultProps = {
activeOpacity: 0.3,
borderless: true,
foreground: true,
};

private opacity: Animated.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ export interface ButtonProps extends ViewProps, AccessibilityProps {
testOnly_onLongPress?: Function | null | undefined;
}

export default function GestureHandlerButton({ style, ...rest }: ButtonProps) {
export default function GestureHandlerButton({
borderless,
style,
...rest
}: ButtonProps) {
const flattenedStyle = useMemo(() => StyleSheet.flatten(style), [style]);

const {
Expand Down Expand Up @@ -273,11 +277,17 @@ export default function GestureHandlerButton({ style, ...rest }: ButtonProps) {
collapsable={false}
style={[
styles.contents,
(!overflow || overflow === 'hidden') && styles.overflowHidden,
!borderless &&
(!overflow || overflow === 'hidden') &&
styles.overflowHidden,
buttonRestingStyle,
restStyle,
]}>
<ButtonComponent {...rest} style={layoutStyle} />
<ButtonComponent
{...rest}
style={layoutStyle}
borderless={borderless}
/>
</View>
</RNGestureHandlerButtonWrapperNativeComponent>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ export const BorderlessButton = (props: BorderlessButtonProps) => {

return (
<AnimatedBaseButton
borderless
foreground
{...rest}
ref={ref ?? null}
onActiveStateChange={onActiveStateChange}
Expand Down
Loading