@applicaster/zapp-react-native-utils 12.0.0-alpha.6602834797 → 12.0.0-alpha.7539319320

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.
@@ -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.6602834797",
3
+ "version": "12.0.0-alpha.7539319320",
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.6602834797",
31
+ "@applicaster/applicaster-types": "12.0.0-alpha.7539319320",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",
@@ -1,6 +1,5 @@
1
1
  export { useOrientation } from "./useOrientation";
2
2
 
3
- // @ts-ignore
4
3
  export { useIsTablet } from "./useIsTablet";
5
4
 
6
5
  export { useMemoizedIsTablet } from "./useMemoizedIsTablet";
@@ -1,3 +1,28 @@
1
- // Template function for TS to correctly compile.
2
- // The RN app will use files with platform suffixes
3
- export const useIsTablet = (): boolean => false;
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 "./index";
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
- export const useOrientation = (): string => {
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
 
@@ -39,6 +39,8 @@ export const useFeedLoader = ({
39
39
  mapping,
40
40
  pipesOptions = {},
41
41
  }: Props): FeedLoaderResponse => {
42
+ console.log("debug_2", "useFeedLoader", { feedUrl, mapping, pipesOptions });
43
+
42
44
  useEffect(() => {
43
45
  if (!feedUrl) {
44
46
  logger.warning({
@@ -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
- import { useSafeAreaInsets } from "react-native-safe-area-context";
7
+
7
8
  import { isTablet } from "./isTablet";
8
9
 
9
10
  export { isTablet } from "./isTablet";
@@ -2,6 +2,9 @@ import * as R from "ramda";
2
2
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
3
3
  import { useMemoizedIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device";
4
4
 
5
+ import { LogBox } from "react-native";
6
+ LogBox.ignoreAllLogs();
7
+
5
8
  import { useMobileOrientationEffect } from "./useMobileOrientationEffect";
6
9
  import { noop } from "./utils";
7
10
 
@@ -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
- };
@@ -1,7 +0,0 @@
1
- import { Platform, PlatformIOSStatic } from "react-native";
2
-
3
- export const useIsTablet = (): boolean => {
4
- const { isPad } = Platform as PlatformIOSStatic;
5
-
6
- return isPad;
7
- };
@@ -1,3 +0,0 @@
1
- export const useIsTablet = (): boolean => {
2
- return false;
3
- };