All Projects → iineva → react-native-gdt

iineva / react-native-gdt

Licence: other
Tencent GDT SDK for react-native. 腾讯广点通SDK

Programming Languages

objective c
16641 projects - #2 most used programming language
java
68154 projects - #9 most used programming language
javascript
184084 projects - #8 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to react-native-gdt

30daymakeos
《30天自制操作系统》源码中文版。自己制作一个操作系统(OSASK)的过程
Stars: ✭ 4,127 (+25693.75%)
Mutual labels:  gdt

react-native-gdt

Getting started

$ npm install react-native-gdt --save

Mostly automatic installation

$ react-native link react-native-gdt

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-gdt and add RNGdt.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNGdt.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactlibrary.RNGdtPackage; to the imports at the top of the file
  • Add new RNGdtPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-gdt'
    project(':react-native-gdt').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-gdt/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-gdt')
    

Usage

import React from 'react'
import {View, Platform} from 'react-native'
import {Banner} from 'react-native-gdt'

class App extends React.Component {

  state = {
    adHeight: 0,
  }

  render = ()=>(
    <View>
      <Banner
        style={{height: this.state.adHeight}}
        appInfo={Platform.select({
          ios: {appId: '1106150743', placementId: '9020922393993042'},
          android: {appId: '1106224940', placementId: '8020023303787286'},
        })}
        onReceived={()=>this.setState({adHeight: 50})}
        onFailToReceived={(err)=>console.error(err)}
      />
    </View>
  )
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].