UNPKG

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

Version:

Applicaster Zapp React Native ui components for the Quick Brick App

38 lines (30 loc) 900 B
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" ) { 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; }