@beletsky/react-native-yandex-ads
Version:
43 lines (41 loc) • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.prepareChildForNativeAd = void 0;
var _resources = require("../resources");
// @ts-nocheck
const prepareChildForNativeAd = suffix => {
return child => {
if (child) {
const snapShot = child;
const PROP_KEY = 'uniqYandexId';
const props = snapShot === null || snapShot === void 0 ? void 0 : snapShot.props;
if (PROP_KEY in props) {
if (Object.values(_resources.YA_NATIVE_COMPONENTS).includes(props[PROP_KEY])) {
const YaNativeIdEntries = Object.entries(_resources.YA_NATIVE_COMPONENTS);
const foundIndexOfNativeIds = Object.values(_resources.YA_NATIVE_COMPONENTS).findIndex(el => el === props[PROP_KEY]);
if (YaNativeIdEntries && foundIndexOfNativeIds) {
const foundEntries = YaNativeIdEntries[foundIndexOfNativeIds];
if (foundEntries) {
const key = YaNativeIdEntries[foundIndexOfNativeIds][0];
if (key) {
const nativeID = _resources.YA_NATIVE_ID[key] + suffix;
if (snapShot !== null && snapShot !== void 0 && snapShot.props) {
snapShot.props = {
...snapShot.props,
nativeID
};
return snapShot;
}
}
}
}
}
}
}
return child;
};
};
exports.prepareChildForNativeAd = prepareChildForNativeAd;
//# sourceMappingURL=prepareChildForNativeAd.js.map