@azerion/bluestack-sdk-react-native
Version:
BlueStack provides functionalities for monetizing your mobile application: from premium sales with rich media, video and innovative formats, it facilitates inserting native mobile ads as well all standard display formats. BlueStack SDK is a library that a
83 lines (81 loc) • 2.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BluestackModuleView = exports.BannerModuleView = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactNative = require("react-native");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
const sizeForType = {
standard: {
width: 320,
height: 50
},
large: {
width: 320,
height: 100
},
full: {
width: 468,
height: 60
},
mediumRectangle: {
width: 300,
height: 250
},
leaderboard: {
width: 728,
height: 90
},
dynamic: {
width: -1,
height: 50
},
dynamicLeaderboard: {
width: -1,
height: 90
}
};
const getSizeForType = type => sizeForType[type];
const LINKING_ERROR = `The package 'react-native-bluestack--module' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
ios: "- You have run 'pod install'\n",
default: ''
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
const ComponentName = 'BluestackModuleView';
const BluestackModuleView = exports.BluestackModuleView = _reactNative.UIManager.getViewManagerConfig(ComponentName) != null ? (0, _reactNative.requireNativeComponent)(ComponentName) : () => {
throw new Error(LINKING_ERROR);
};
// export const BannerModuleView = (props: BannerViewProps) => {
const BannerModuleView = props => {
const {
onBannerAdLoaded,
onBannerAdFailedToLoad,
onBannerAdRefreshed,
onBannerAdFailedToRefresh,
onBannerAdClicked,
type,
visible,
...restProps
} = props;
let adType = type;
if (adType === undefined) {
adType = 'standard';
}
const size = getSizeForType(adType);
return /*#__PURE__*/_react.default.createElement(BluestackModuleView, _extends({}, restProps, {
style: [{
width: size.width,
height: size.height
}],
adSize: adType.toString(),
visible: visible,
onAdLoaded: onBannerAdLoaded,
onAdFailedToLoad: onBannerAdFailedToLoad,
onAdRefreshed: onBannerAdRefreshed,
onAdFailedToRefresh: onBannerAdFailedToRefresh,
onAdClicked: onBannerAdClicked
}));
};
exports.BannerModuleView = BannerModuleView;
//# sourceMappingURL=BannerViewManager.js.map