UNPKG

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

Version:

Applicaster Zapp React Native ui components for the Quick Brick App

43 lines (36 loc) 1.05 kB
import React from "react"; import { getAnalyticsFunctions } from "@applicaster/zapp-react-native-utils/analyticsUtils"; import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks"; type ComponentProps = { component: { id: string; rules: { item_limit: number; component_cells_selectable: boolean }; component_type: string; styles: { cell_style: string; header: { visible: boolean }; component_cells_selectable: boolean; }; }; zappPipesData: { url: string; data: { title: string } }; selected: boolean; assets: { menu_button: string }; }; function withAnalytics(Component) { return function WithAnalytics(props: ComponentProps) { const { appData } = usePickFromState(["appData"]); const analyticsFunctions = React.useMemo( () => getAnalyticsFunctions({ props, appData }), [props, appData] ); return ( <Component {...{ ...props, ...analyticsFunctions, }} /> ); }; } export default withAnalytics;