@applicaster/zapp-react-native-utils
Version:
Applicaster Zapp React Native utilities package
40 lines (28 loc) • 1.12 kB
text/typescript
const GROUP = "group-qb";
const GROUP_INFO = "group-info-qb";
const GROUP_INFO_OLD = "group-info";
const EMPTY_GROUP_COMPONENT = "empty_group_component";
const GALLERY = "gallery-qb";
const SCREEN_PICKER = "screen-picker-qb-tv";
const HORIZONTAL_LIST = "horizontal_list_qb";
export const isGallery = (item): boolean => item?.component_type === GALLERY;
export const isHorizontalList = (item): boolean =>
item?.component_type === HORIZONTAL_LIST;
export const isScreenPicker = (item): boolean =>
item?.component_type === SCREEN_PICKER;
export const isFirstComponentScreenPicker = (
components: ZappUIComponent[]
): boolean => {
return isScreenPicker(components?.[0]);
};
export const isFirstComponentGallery = (
components: ZappUIComponent[]
): boolean => {
return isGallery(components?.[0]);
};
export const isGroup = (item): boolean => item?.component_type === GROUP;
export const isEmptyGroup = (item): boolean =>
item?.component_type === EMPTY_GROUP_COMPONENT;
export const isGroupInfo = (item): boolean =>
item?.component_type === GROUP_INFO ||
item?.component_type === GROUP_INFO_OLD;