@applicaster/zapp-react-native-ui-components
Version:
Applicaster Zapp React Native ui components for the Quick Brick App
29 lines (27 loc) • 1.02 kB
text/typescript
import { DefaultCell } from "./DefaultCell/index.android";
import { HeroCell } from "./HeroCell/index.android";
/**
* Return a view tree ready to be injected with styles etc. Mapping is done
* via switch/case/default since some components share the same cell.
* TAKE CARE: the cell for the screen_picker is an anomaly! After a proper
* breaking down of the screen_picker to UI elements, the mapping should change
* to "screen_selector_label" as component type.
* @param {string} component_type Usually comes from the layout.json,
* but it could be any type supported by this plugin,
* like the internally-used "label".
* @return {Object} view tree function, ready to be injected with styles object
*/
export function viewTreeResolver({
component_type,
}: {
component_type: string;
}) {
switch (component_type) {
case "hero":
return HeroCell;
case "grid":
case "horizontal_list":
default:
return DefaultCell;
}
}