react-native-ui-lib 8.3.2 → 8.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@ import _filter from "lodash/filter";
|
|
|
2
2
|
import _noop from "lodash/noop"; // TODO: support commented props
|
|
3
3
|
import React, { useMemo, useEffect, useState, useCallback } from 'react';
|
|
4
4
|
import { useAnimatedReaction, useSharedValue, withTiming, runOnJS } from 'react-native-reanimated';
|
|
5
|
-
import { SafeAreaContextPackage } from "../../optionalDependencies";
|
|
6
5
|
import { useOrientation, useThemeProps } from "../../hooks";
|
|
7
6
|
import { Constants } from "../../commons/new";
|
|
8
7
|
import TabBarContext from "./TabBarContext";
|
|
@@ -12,9 +11,12 @@ import TabPage from "./TabPage";
|
|
|
12
11
|
import PageCarousel from "./PageCarousel";
|
|
13
12
|
import useImperativeTabControllerHandle, { TabControllerImperativeMethods } from "./useImperativeTabControllerHandle";
|
|
14
13
|
export { TabControllerBarProps, TabControllerItemProps, TabControllerImperativeMethods };
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
14
|
+
const getScreenWidth = useSafeArea => {
|
|
15
|
+
const {
|
|
16
|
+
left,
|
|
17
|
+
right
|
|
18
|
+
} = Constants.getSafeAreaInsets();
|
|
19
|
+
return Constants.windowWidth - (useSafeArea && Constants.isIphoneX ? left + right : 0);
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
/**
|
|
@@ -35,17 +37,13 @@ const TabController = React.forwardRef((props, ref) => {
|
|
|
35
37
|
useSafeArea = false,
|
|
36
38
|
children
|
|
37
39
|
} = themeProps;
|
|
38
|
-
const
|
|
39
|
-
left,
|
|
40
|
-
right
|
|
41
|
-
} = useSafeAreaInsets();
|
|
42
|
-
const [screenWidth, setScreenWidth] = useState(getScreenWidth(useSafeArea, left, right));
|
|
40
|
+
const [screenWidth, setScreenWidth] = useState(getScreenWidth(useSafeArea));
|
|
43
41
|
if (items?.length < 2) {
|
|
44
42
|
console.warn('TabController component expect a minimum of 2 items');
|
|
45
43
|
}
|
|
46
44
|
useOrientation({
|
|
47
45
|
onOrientationChange: () => {
|
|
48
|
-
setScreenWidth(getScreenWidth(useSafeArea
|
|
46
|
+
setScreenWidth(getScreenWidth(useSafeArea));
|
|
49
47
|
}
|
|
50
48
|
});
|
|
51
49
|
const pageWidth = useMemo(() => {
|