UNPKG

react-native-unit-components

Version:

Unit React Native components

37 lines (36 loc) 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.webViewId = exports.getHtmlBody = void 0; var _webComponent = require("../../types/internal/webComponent.types"); const webViewId = exports.webViewId = 'webViewContainer'; const getHtmlBody = (unitComponent, unitComponentProps, presentationMode) => { const currentComponent = `<${unitComponent} ${unitComponentProps || ''} }> </${unitComponent}>`; switch (presentationMode) { case _webComponent.PresentationMode.CoverInjectedHeight: return getCoverInjectedHeightBodyScript(currentComponent); case _webComponent.PresentationMode.Inherit: return getInheritParentSizeScript(currentComponent); default: return currentComponent; } }; exports.getHtmlBody = getHtmlBody; const getCoverInjectedHeightBodyScript = currentUnitScript => { return ` <div id=${webViewId}> <div style="height: 100%; display: block;"> ${currentUnitScript} </div> </div> `; }; const getInheritParentSizeScript = currentUnitScript => { return ` <div style="height: 100vh"> ${currentUnitScript} </div> `; }; //# sourceMappingURL=bodyHtml.js.map