UNPKG

piral-native

Version:

The Piral framework for use in React Native.

26 lines 940 B
import { __rest } from "tslib"; import { AppRegistry } from 'react-native'; import { getAppInstance } from './app'; function noChange(config) { return config; } /** * Sets up a new Piral instance and renders it using the provided options. * Can be used as simple as calling the function directly without any * arguments. * @param appName The name of the application. * @param options The options to use when setting up the Piral instance. * @example ```ts import { renderInstance } from 'piral-native'; renderInstance(); ``` */ export function renderInstance(appName, options) { const { layout, errors, middleware = noChange } = options, config = __rest(options, ["layout", "errors", "middleware"]); const { app, instance } = getAppInstance(middleware(config), { layout, errors }); const App = () => app; AppRegistry.registerComponent(appName, () => App); return instance; } //# sourceMappingURL=render.js.map