Skip to content

Commit b19d66c

Browse files
Remove extra wrapper view from GenericTouchable
1 parent 36b622d commit b19d66c

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/components/touchables/GenericTouchable.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { Component } from 'react';
33
import {
44
Animated,
55
Platform,
6-
StyleProp,
7-
ViewStyle,
86
TouchableWithoutFeedbackProps,
97
} from 'react-native';
108

@@ -18,6 +16,8 @@ import {
1816
import { NativeViewGestureHandlerPayload } from '../../handlers/NativeViewGestureHandler';
1917
import { TouchableNativeFeedbackExtraProps } from './TouchableNativeFeedback.android';
2018

19+
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
20+
2121
/**
2222
* Each touchable is a states' machine which preforms transitions.
2323
* On very beginning (and on the very end or recognition) touchable is
@@ -46,8 +46,6 @@ export interface GenericTouchableProps extends TouchableWithoutFeedbackProps {
4646
nativeID?: string;
4747
shouldActivateOnStart?: boolean;
4848
disallowInterruption?: boolean;
49-
50-
containerStyle?: StyleProp<ViewStyle>;
5149
}
5250

5351
interface InternalProps {
@@ -263,8 +261,8 @@ export default class GenericTouchable extends Component<
263261
};
264262

265263
return (
266-
<BaseButton
267-
style={this.props.containerStyle}
264+
<AnimatedBaseButton
265+
style={this.props.style}
268266
onHandlerStateChange={
269267
// TODO: not sure if it can be undefined instead of null
270268
this.props.disabled ? undefined : this.onHandlerStateChange
@@ -274,11 +272,10 @@ export default class GenericTouchable extends Component<
274272
shouldActivateOnStart={this.props.shouldActivateOnStart}
275273
disallowInterruption={this.props.disallowInterruption}
276274
testID={this.props.testID}
275+
{...coreProps}
277276
{...this.props.extraButtonProps}>
278-
<Animated.View {...coreProps} style={this.props.style}>
279-
{this.props.children}
280-
</Animated.View>
281-
</BaseButton>
277+
{this.props.children}
278+
</AnimatedBaseButton>
282279
);
283280
}
284281
}

0 commit comments

Comments
 (0)