Skip to content

Commit

Permalink
chore: allow user to override safeAreaInsets
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhom committed Jun 7, 2020
1 parent 8d85da2 commit 20b2141
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/AnimatedTabBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useMemo, useCallback } from 'react';
import { Insets } from 'react-native';
import { useSafeArea } from 'react-native-safe-area-context';
import { AnimatedTabBarView } from './AnimatedTabBarView';
import Presets, { PresetEnum } from './presets';
Expand All @@ -22,6 +23,7 @@ interface AnimatedTabBarProps<T extends PresetEnum>
descriptors?: any;
onTabPress?: any;
onTabLongPress?: any;
safeAreaInsets?: Insets;
}

interface Route {
Expand All @@ -41,11 +43,16 @@ export function AnimatedTabBar<T extends PresetEnum>(
onTabPress,
onTabLongPress,
style: overrideStyle,
safeAreaInsets: overrideSafeAreaInsets,
...rest
} = props;

//#region styles
const { bottom: safeBottomArea } = useSafeArea();
const { bottom: _safeBottomArea } = useSafeArea();
const safeBottomArea = useMemo(
() => overrideSafeAreaInsets?.bottom ?? _safeBottomArea,
[overrideSafeAreaInsets, _safeBottomArea]
);
const style = useMemo(
() => ({
// @ts-ignore
Expand Down

0 comments on commit 20b2141

Please sign in to comment.