UNPKG

@applicaster/zapp-react-native-ui-components

Version:

Applicaster Zapp React Native ui components for the Quick Brick App

44 lines (35 loc) 1.13 kB
import { sendTapCellEvent, sendTapMenuItem } from "../Analytics"; import { getItemType } from "@applicaster/zapp-react-native-utils/navigationUtils"; import { SCREEN_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/itemTypes"; import * as R from "ramda"; export function onCellPress( entry, navigator, component, headerTitle, itemIndex, layoutVersion = "v1" ) { sendTapCellEvent(entry, component, headerTitle, itemIndex); const componentScreenType = screenTypeFromComponent(component); const entryScreenType = screenTypeFromEntry(entry); const itemType = getItemType(entry, layoutVersion); if ( itemType !== SCREEN_TYPES.PLAYABLE && componentScreenType && !entryScreenType ) { navigator.push(R.merge(entry, { screen_type: componentScreenType })); return; } navigator.push(entry); } function screenTypeFromComponent(component) { return R.path(["data", "target"], component); } function screenTypeFromEntry(entry) { return entry && entry.screen_type; } export function onMenuItemFocus({ item, index, isHome }) { sendTapMenuItem({ item, index, isHome }); }