0.2.3 • Published 10 months ago

rn-yandex-ads v0.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Yandex Ads Integration based on Expo Modules (https://docs.expo.dev/modules/overview/)

Installation

npm install rn-yandex-ads

Usage

import { FC, useState, useEffect } from 'react'
import { Text, TouchableOpacity } from 'react-native';
import * as YandexAds from 'rn-yandex-ads'

const YANDEX_INTERSTITIAL_ID = "R-M-2085336-2"
const YANDEX_BANNER_ID = "R-M-2085336-1"

interface Props {
  width: number,
  height: number
}

const SmallBanner: FC<Props> = ({ width, height }) => {
  const onPress = () => {
    YandexAds.showInterstitial(YANDEX_INTERSTITIAL_ID)
  }

  return (
    <>
      <TouchableOpacity onPress={onPress}>
        <Text>Show Interstitial</Text>
      </TouchableOpacity>

      <YandexAds.RnYandexAdsView
        adUnitId={YANDEX_BANNER_ID}
        width={width}
        maxHeight={height}
        onAdViewDidFailLoading={event => console.log(event)}
      />
    </>
  )
}

export default function App() {
  const [ready, setReady] = useState(false)

  useEffect(() => {
    YandexAds.initialize({
      userConsent: false,
      locationConsent: false
    }).then(() => setReady(true))
  }, [])

  if (! ready) {
    return null
  }

  return (
    <SmallBanner width={310} height={310} />
  )
}

Contributing

Contributions are very welcome! Please refer to guidelines described in the contributing guide.

0.2.3

10 months ago

0.2.2

10 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.13

1 year ago

0.1.12

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.8

1 year ago

0.1.9

1 year ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago