UNPKG

@applicaster/quick-brick-core

Version:

Core package for Applicaster's Quick Brick App

45 lines (38 loc) 1.16 kB
/** * zapp-react-native-app module * @module @applicaster/zapp-react-native-app/renderZappApp * this modules provides functions to start the zapp app */ /** * @typedef {Object} RenderOptions * @property {Object} AppRegistry - React Native's AppRegistry module. Will be used if provided * @property {Function} App - The App component to render * @property {string} appMountId - id of the node element to render */ /** * Renders the Zapp app * * @export * @param {RenderOptions} Options : Rendering module * @param {React.ComponentType<any>} App component to start */ export function renderZappApp(options) { const { App, AppRegistry, appMountId, mode } = options; if (!App) { throw new Error("No App Component provided, nothing to render"); } if (!AppRegistry) { throw new Error( "No Renderer provided - you need to pass React Native's AppRegistry module" ); } if (AppRegistry) { AppRegistry.registerComponent("QuickBrickApp", () => App); if (appMountId) { AppRegistry.runApplication("QuickBrickApp", { rootTag: document.getElementById(appMountId), mode, }); } } }