bubjavier / react-native-dfp

A react-native bridge for Google Mobile Ads' DFP libraries
13 stars 12 forks source link

Error with the export #9

Open davidcort opened 5 years ago

davidcort commented 5 years ago

I will try many times but without success

React Native Environment Info: System: OS: macOS 10.14.2 CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz Memory: 342.36 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 11.1.0 - /usr/local/bin/node Yarn: 1.12.3 - /usr/local/bin/yarn npm: 6.5.0 - /usr/local/bin/npm SDKs: iOS SDK: Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1 IDEs: Android Studio: 3.2 AI-181.5540.7.32.5056338 Xcode: 10.1/10B61 - /usr/bin/xcodebuild npmPackages: react: 16.5.0 => 16.5.0 react-native: https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz => 0.57.1 npmGlobalPackages: react-native-cli: 2.0.1 react-native-git-upgrade: 0.2.7

`import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import { RNBanner } from 'react-native-dfp';

export default class App extends React.Component { render() { return (

texto de prueba didFailToReceiveAdWithError(event.nativeEvent.error)} // onAdViewWillPresentScreen={this.props.adViewWillPresentScreen} // onAdViewWillDismissScreen={this.props.adViewWillDismissScreen} // onAdViewDidDismissScreen={this.props.adViewDidDismissScreen} // onAdViewWillLeaveApplication={this.props.adViewWillLeaveApplication} // onAdmobDispatchAppEvent={(event) => admobDispatchAppEvent(event)} //testDeviceID={testDeviceID} adUnitID={"176028412"} dimensions={{ height: 300, width: 500 }} bannerSize="mediumRectangle" />
);

} }

const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'center', }, }); ` Display always this error:

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s%s, undefined, You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

minigopher17 commented 5 years ago

Changing index.js to be like this works for me:

import {
  NativeModules,
} from 'react-native';

module.exports = {
  get RNBanner() {
    return require('./RNDFPBanner').default;
  },
  get Interstitial() {
    return require('./RNDFPInterstitial').default;
  }
};