Skip to content

Commit bf2d7f3

Browse files
satya164Trancever
authored andcommitted
fix: pass route prop to the touchable (#1904)
1 parent 3c8a339 commit bf2d7f3

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

src/components/BottomNavigation.tsx

+26-14
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type TabPressEvent = {
4747

4848
type TouchableProps = TouchableWithoutFeedbackProps & {
4949
key: string;
50+
route: Route;
5051
children: React.ReactNode;
5152
borderless?: boolean;
5253
centered?: boolean;
@@ -277,20 +278,30 @@ const MAX_TAB_WIDTH = 168;
277278
const BAR_HEIGHT = 56;
278279
const FAR_FAR_AWAY = 9999;
279280

280-
const Touchable = TouchableRipple.supported
281-
? TouchableRipple
282-
: ({
283-
style,
284-
children,
285-
borderless: _0,
286-
centered: _1,
287-
rippleColor: _2,
288-
...rest
289-
}: TouchableProps) => (
290-
<TouchableWithoutFeedback {...rest}>
291-
<View style={style}>{children}</View>
292-
</TouchableWithoutFeedback>
293-
);
281+
const Touchable = ({
282+
route: _0,
283+
style,
284+
children,
285+
borderless,
286+
centered,
287+
rippleColor,
288+
...rest
289+
}: TouchableProps) =>
290+
TouchableRipple.supported ? (
291+
<TouchableRipple
292+
{...rest}
293+
borderless={borderless}
294+
centered={centered}
295+
rippleColor={rippleColor}
296+
style={style}
297+
>
298+
{children}
299+
</TouchableRipple>
300+
) : (
301+
<TouchableWithoutFeedback {...rest}>
302+
<View style={style}>{children}</View>
303+
</TouchableWithoutFeedback>
304+
);
294305

295306
class SceneComponent extends React.PureComponent<any> {
296307
render() {
@@ -842,6 +853,7 @@ class BottomNavigation extends React.Component<Props, State> {
842853

843854
return renderTouchable({
844855
key: route.key,
856+
route,
845857
borderless: true,
846858
centered: true,
847859
rippleColor: touchColor,

0 commit comments

Comments
 (0)