@applicaster/zapp-react-native-ui-components
Version:
Applicaster Zapp React Native ui components for the Quick Brick App
26 lines (23 loc) • 859 B
text/typescript
import { Platform } from "react-native";
import { viewTreeResolver as tvResolver } from "./tv";
import { viewTreeResolver as mobileResolver } from "./mobile";
/**
* Returns the matching viewTreeResolver import according to the device type.
* Currently available types: tv and mobile only.
* IMPORTANT: web OS is treated as tv, since so far the web platform is used
* for HTML5 apps in Samsung & LG.
* ---
* The drill-down into OS separation is done deeper inside the matching imports.
* @param {string} component_type
* @return {Function} resolver for the matching platform / device
*/
export function viewTreeResolver({
component_type,
}: {
component_type: string;
}) {
if (Platform.isTV || ["web", "samsung_tv", "lg_tv"].includes(Platform.OS)) {
return tvResolver({ component_type });
}
return mobileResolver({ component_type });
}