diff --git a/src/components/Tabbar/CustomTabBar.js b/src/components/Tabbar/CustomTabBar.js index 98d0d02..1d4d7a8 100644 --- a/src/components/Tabbar/CustomTabBar.js +++ b/src/components/Tabbar/CustomTabBar.js @@ -65,6 +65,17 @@ class CustomTabBar extends React.Component { } } + onItemLongPress(route: Object) { + const event = this.props.navigation.emit({ + type: 'tabLongPress', + target: route.key, + canPreventDefault: true, + }); + if (route.name === "home" && !event.defaultPrevented) { + this.props.navigation.navigate('tetris'); + } + } + tabBarIcon = (route, focused) => { let icon = TAB_ICONS[route.name]; icon = focused ? icon : icon + ('-outline'); @@ -93,12 +104,8 @@ class CustomTabBar extends React.Component { const onPress = () => this.onItemPress(route, state.index, index); - const onLongPress = () => { - this.props.navigation.emit({ - type: 'tabLongPress', - target: route.key, - }); - }; + const onLongPress = () => this.onItemLongPress(route); + if (isFocused) { const stackState = route.state; const stackRoute = route.state ? stackState.routes[stackState.index] : undefined; diff --git a/src/components/Tabbar/TabHomeIcon.js b/src/components/Tabbar/TabHomeIcon.js index 439d6f6..7c2b848 100644 --- a/src/components/Tabbar/TabHomeIcon.js +++ b/src/components/Tabbar/TabHomeIcon.js @@ -4,6 +4,8 @@ import * as React from 'react'; import {Image, View} from "react-native"; import {FAB, withTheme} from 'react-native-paper'; import * as Animatable from "react-native-animatable"; +import TouchableRipple from "react-native-paper/src/components/TouchableRipple/index"; +import CustomTabBar from "./CustomTabBar"; type Props = { focused: boolean, @@ -65,23 +67,39 @@ class TabHomeIcon extends React.Component { render(): React$Node { const props = this.props; return ( - - + + position: 'absolute', + bottom: 0, + left: 0, + width: '100%', + height: CustomTabBar.TAB_BAR_HEIGHT + 30, + marginBottom: -15, + }} + > + + + ); } diff --git a/src/components/Tabbar/TabIcon.js b/src/components/Tabbar/TabIcon.js index f8fdf86..f01a634 100644 --- a/src/components/Tabbar/TabIcon.js +++ b/src/components/Tabbar/TabIcon.js @@ -69,6 +69,9 @@ class TabIcon extends React.Component {