Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
React Native Rewarded intersticial Ads: indefinido no es un objeto

Actualmente, estoy aprendiendo a mostrar anuncios en React Native. Si bien los anuncios dentro de la aplicación siempre me molestaron, pensé en probarlo. Pasado a fuente abierta. termine de configurar firebase y admob. Después de completar cada parte con cuidado, al hacer clic en 'ver anuncio' aparece el siguiente error:

 TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[6], "../components/Ads").Ads.showRewarded')

Mis códigos se proporcionan a continuación:

Anuncios.js

 import { RewardedAd, RewardedAdEventType } from "@react-native-firebase/admob"; const showRewarded = async () => { const rewarded = RewardedAd.createForAdRequest(UNIT_ID, { requestNonPersonalizedAdsOnly: false, }); let loaded = false; let gotReward = false; const eventListener = rewarded.onAdEvent((type, error, reward) => { if (type === RewardedAdEventType.LOADED) { rewarded.show(); loaded = true; } else if (type === RewardedAdEventType.EARNED_REWARD) { gotReward = true; } else if (error) { console.warn(error); } }); rewarded.load(); while (!loaded) { await new Promise((resolve, reject) => setTimeout(resolve, 1000)); } return gotReward; };

button.js o evento onclick

 import React from 'react'; import { View, Text, TouchableOpacity } from 'react-native'; import { Ads } from '../components'; function showAd() { // Wait while user has not been get a reward (or skiped the ad) const reward = Ads.showRewarded(); console.log(`The reward is ${reward}`); } TouchableOpacity style={styles.item} onPress={() => showAd()}> <Text>Watch Ads</Text> </TouchableOpacity>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!