Skip to content

Commit

Permalink
fix: disable tab switching animation by default in bottom navigation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 authored Jun 26, 2020
1 parent b367993 commit 5636e41
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/BottomNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ class BottomNavigation extends React.Component<Props, State> {
static defaultProps = {
labeled: true,
keyboardHidesNavigationBar: true,
sceneAnimationEnabled: false,
};

static getDerivedStateFromProps(nextProps: any, prevState: State) {
Expand Down Expand Up @@ -710,8 +711,11 @@ class BottomNavigation extends React.Component<Props, State> {
}
const focused = navigationState.index === index;

const opacity =
sceneAnimationEnabled !== false ? tabs[index] : focused ? 1 : 0;
const opacity = sceneAnimationEnabled
? tabs[index]
: focused
? 1
: 0;

const top = offsets[index].interpolate({
inputRange: [0, 1],
Expand Down

0 comments on commit 5636e41

Please sign in to comment.