@beletsky/react-native-yandex-ads
Version:
61 lines (59 loc) • 3.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AdNative = void 0;
var _react = _interopRequireWildcard(require("react"));
var _components = require("../components");
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; }
// @ts-nocheck
const AdNative = /*#__PURE__*/(0, _react.memo)(_ref => {
let {
adUnitId,
style,
width = 100,
height = 100,
onCloseAd,
onDidLoad,
requestParams = {}
} = _ref;
// if (!adUnitId) {
// throw Error(
// '[YandexAdsNative]\nThe adUnitId parameter is not set. It is mandatory. Perhaps you forgot to specify the adUnitId of the block?'
// )
// }
if (!(style !== null && style !== void 0 && style.width)) {
throw Error('[YandexAdsNative]\nThe ad block width parameter is not set. It is mandatory. Perhaps you forgot to specify the width of the block?');
}
// if (!style?.height) {
// throw Error(
// '[YandexAdsNative]\nThe ad block height parameter is not set. It is mandatory. Perhaps you forgot to specify the height of the block?'
// )
// }
const ref = (0, _react.useRef)(null);
return /*#__PURE__*/_react.default.createElement(_components.AdNative, {
adUnitId: adUnitId ?? 'undefined',
style: {
flexDirection: 'row',
display: 'flex',
width
},
height: height,
width: width,
onDidLoad: d => onDidLoad === null || onDidLoad === void 0 ? void 0 : onDidLoad(d.nativeEvent),
onWillLoad: () => console.log('The ad block has been prepared for loading'),
onDidTrackImpression: () => console.log('onDidTrackImpression'),
onWillPresent: () => console.log('onWillPresent'),
onWillLeaveApp: () => console.log('onWillLeaveApp'),
onDidDismiss: () => console.log('onDidDismiss'),
onClick: () => console.log('onClick'),
onClose: onCloseAd,
onTouchEnd: () => console.log('A click on an ad block has been registered'),
onDidFailLoading: e => console.log('error: ', e.nativeEvent),
requestParams: requestParams,
ref: ref
});
});
exports.AdNative = AdNative;
//# sourceMappingURL=index.ios.js.map