piral-native
Version:
The Piral framework for use in React Native.
26 lines (25 loc) • 959 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAppInstance = void 0;
const api_1 = require("./api");
const instance_1 = require("./instance");
/**
* Gets a new instantiated native Piral instance using the provided options.
* @param config The configuration to use when creating the Piral instance.
* @param options The options to use when rendering the Piral instance.
* @example
```ts
import { AppRegistry } from 'react-native';
import { getAppInstance } from 'piral-native';
const { app } = getAppInstance();
AppRegistry.registerComponent(appName, () => () => app);
```
*/
function getAppInstance(config = {}, options = {}) {
const { layout, errors } = options;
const instance = (0, api_1.createNativePiral)(config);
const app = (0, instance_1.createInstanceElement)(instance, layout, errors);
return { instance, app };
}
exports.getAppInstance = getAppInstance;
//# sourceMappingURL=app.js.map