import * as React from "react"; import * as R from "ramda"; import { ConfigurationProvider } from "@applicaster/zapp-react-native-ui-components/Contexts/ConfigutaionContext"; import { keysMap } from "./const"; type Props = { screenData: { styles: Record; general: Record; data: { target?: string; source?: string; }; }; [key: string]: any; }; const prepareConfiguration = ( configuration: Record, keys: [string] ) => R.compose(R.evolve(keysMap), R.pickAll(keys))(configuration); const configurationKeys = R.keys(keysMap); export function withConfigurationProvider(Component: React.ComponentType) { return function WithConfigurationProvider(props: Props) { const styles = props?.screenData?.styles; const general = props?.screenData?.general; const configuration = React.useMemo( () => prepareConfiguration({ ...general, ...styles }, configurationKeys), [] ); return ( ); }; }