UNPKG

@tamagui/react-native-web-lite

Version:
63 lines (62 loc) 3.27 kB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: !0 }); }, __copyProps = (to, from, except, desc) => { if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target, mod )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod); var ImageBackground_exports = {}; __export(ImageBackground_exports, { default: () => ImageBackground_default }); module.exports = __toCommonJS(ImageBackground_exports); var import_react = require("react"), import_react_native_web_internals = require("@tamagui/react-native-web-internals"), import_Image = __toESM(require("../Image/index")), import_View = __toESM(require("../View/index")), import_jsx_runtime = require("react/jsx-runtime"); const emptyObject = {}, ImageBackground = (0, import_react.forwardRef)( (props, forwardedRef) => { const { children, style = emptyObject, imageStyle, imageRef, ...rest } = props, { height, width } = import_react_native_web_internals.StyleSheet.flatten(style); return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_View.default, { ref: forwardedRef, style, children: [ /* @__PURE__ */ (0, import_jsx_runtime.jsx)( import_Image.default, { ...rest, ref: imageRef, style: [ { // Temporary Workaround: // Current (imperfect yet) implementation of <Image> overwrites width and height styles // (which is not quite correct), and these styles conflict with explicitly set styles // of <ImageBackground> and with our internal layout model here. // So, we have to proxy/reapply these styles explicitly for actual <Image> component. // This workaround should be removed after implementing proper support of // intrinsic content size of the <Image>. width, height, zIndex: -1 }, import_react_native_web_internals.StyleSheet.absoluteFill, imageStyle ] } ), children ] }); } ); ImageBackground.displayName = "ImageBackground"; var ImageBackground_default = ImageBackground; //# sourceMappingURL=index.js.map