react-native-flex-grid
Version:
🎨 A react-native flexbox grid similar to bootstap's web grid.
61 lines (56 loc) • 2.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const AD_CLIENT = 'ca-pub-5266987079964279';
const AD_SLOT = '2268797420';
const styles = _reactNative.StyleSheet.create({
adContainer: {
width: '100%',
minHeight: 50,
// Minimum height for the ad container
alignItems: 'center',
justifyContent: 'center',
marginTop: 32,
marginBottom: 8,
alignSelf: 'center',
textAlign: 'center'
// backgroundColor: 'rgba(0,0,0,0.05)', // Optional: for debugging layout
}
});
// Extend the Window interface to include adsbygoogle
const WebAd = () => {
(0, _react.useEffect)(() => {
// The main adsbygoogle.js script is now loaded globally via preview-body.html
// We still need to push an ad request for this specific ad unit.
try {
(window.adsbygoogle = window.adsbygoogle || []).push({});
} catch (e) {
console.error('AdSense push error:', e);
}
}, []); // Empty dependency array ensures this effect runs once on mount
const adStyle = (0, _react.useMemo)(() => ({
display: 'block',
width: '100%'
}), []);
// Render the ad unit container and the <ins> tag for the ad
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
style: styles.adContainer
}, /*#__PURE__*/_react.default.createElement("ins", {
className: "adsbygoogle",
style: adStyle,
"data-ad-client": AD_CLIENT,
"data-ad-slot": AD_SLOT,
"data-ad-format": "auto",
"data-full-width-responsive": "true",
key: `${AD_CLIENT}-${AD_SLOT}`
}));
};
var _default = WebAd;
exports.default = _default;
//# sourceMappingURL=WebAd.web.js.map