@applicaster/zapp-react-native-utils 12.0.0-alpha.6602834797 → 12.0.0-alpha.6631650374
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/appUtils/orientationHelper.ts +1 -1
- package/package.json +2 -2
- package/reactHooks/device/index.ts +0 -1
- package/reactHooks/device/useIsTablet.tsx +28 -3
- package/reactHooks/device/useMemoizedIsTablet.ts +1 -1
- package/reactHooks/device/useOrientation.tsx +3 -1
- package/reactHooks/layout/index.ts +2 -1
- package/reactHooks/device/useIsTablet.android.tsx +0 -14
- package/reactHooks/device/useIsTablet.ios.tsx +0 -7
- package/reactHooks/device/useIsTablet.web.tsx +0 -3
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import * as ReactNative from "react-native";
|
|
3
3
|
import { isTV, platformSelect } from "../reactUtils";
|
|
4
4
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
5
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
5
6
|
|
|
6
7
|
import {
|
|
7
8
|
QUICK_BRICK_EVENTS,
|
|
@@ -9,7 +10,6 @@ import {
|
|
|
9
10
|
sendQuickBrickEvent,
|
|
10
11
|
} from "@applicaster/zapp-react-native-bridge/QuickBrick";
|
|
11
12
|
import { utilsLogger } from "../logger";
|
|
12
|
-
import { useIsTablet } from "../reactHooks/device/useIsTablet";
|
|
13
13
|
|
|
14
14
|
const { DeviceEventEmitter, NativeModules, NativeEventEmitter } = ReactNative;
|
|
15
15
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "12.0.0-alpha.
|
|
3
|
+
"version": "12.0.0-alpha.6631650374",
|
|
4
4
|
"description": "Applicaster Zapp React Native utilities package",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "12.0.0-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "12.0.0-alpha.6631650374",
|
|
32
32
|
"buffer": "^5.2.1",
|
|
33
33
|
"camelize": "^1.0.0",
|
|
34
34
|
"create-react-context": "^0.2.3",
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/* eslint react-native/split-platform-components: off */
|
|
2
|
+
|
|
3
|
+
import { Platform, PlatformIOSStatic, NativeModules } from "react-native";
|
|
4
|
+
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
|
+
import { F as alwaysFalse } from "ramda";
|
|
6
|
+
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
7
|
+
|
|
8
|
+
const useIsTabletIos = (): boolean => {
|
|
9
|
+
const { isPad } = Platform as PlatformIOSStatic;
|
|
10
|
+
|
|
11
|
+
return isPad;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const useIsTabletAndroid = (): boolean => {
|
|
15
|
+
const { initialProps } = NativeModules.QuickBrickCommunicationModule;
|
|
16
|
+
|
|
17
|
+
return toBooleanWithDefaultFalse(initialProps?.is_tablet);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const useIsTablet = platformSelect({
|
|
21
|
+
ios: useIsTabletIos,
|
|
22
|
+
android: useIsTabletAndroid,
|
|
23
|
+
lg_tv: alwaysFalse,
|
|
24
|
+
samsung_tv: alwaysFalse,
|
|
25
|
+
android_tv: alwaysFalse,
|
|
26
|
+
tvos: alwaysFalse,
|
|
27
|
+
default: alwaysFalse,
|
|
28
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
3
|
-
import { useIsTablet } from "./
|
|
3
|
+
import { useIsTablet } from "./useIsTablet";
|
|
4
4
|
|
|
5
5
|
export const useMemoizedIsTablet = () => {
|
|
6
6
|
const isTablet = useIsTablet();
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useWindowDimensions } from "react-native";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type Return = "landscape" | "portrait";
|
|
4
|
+
|
|
5
|
+
export const useOrientation = (): Return => {
|
|
4
6
|
const { width, height } = useWindowDimensions();
|
|
5
7
|
const isLandscape = width > height;
|
|
6
8
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
import { StatusBar, Platform } from "react-native";
|
|
3
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
3
4
|
|
|
4
5
|
import { platformSelect, isTV } from "../../reactUtils";
|
|
5
6
|
import { useIsNavBarVisible } from "../navigation";
|
|
6
|
-
|
|
7
|
+
|
|
7
8
|
import { isTablet } from "./isTablet";
|
|
8
9
|
|
|
9
10
|
export { isTablet } from "./isTablet";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useWindowDimensions } from "react-native";
|
|
2
|
-
import { useOrientation } from "./useOrientation";
|
|
3
|
-
import { isTablet } from "../layout";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Determines weather the given device is a tablet based on dimensions, orientation, and platform
|
|
7
|
-
* @returns {Boolean} isTablet - returns whether the given device is a tablet
|
|
8
|
-
*/
|
|
9
|
-
export const useIsTablet = (): boolean => {
|
|
10
|
-
const dimensions = useWindowDimensions();
|
|
11
|
-
const orientation = useOrientation();
|
|
12
|
-
|
|
13
|
-
return isTablet(dimensions, orientation);
|
|
14
|
-
};
|