<AdropBanner/>

Banner view component๋Š” ๋ฐฐ๋„ˆ ๊ด‘๊ณ ๋ฅผ ์š”์ฒญํ•˜๊ณ  ์‚ฌ์šฉ์ž์—๊ฒŒ ํ‘œ์‹œํ•˜๋Š” ์—ญํ• ์„ ๋‹ด๋‹นํ•ฉ๋‹ˆ๋‹ค.


Constructors

AdropBanner

AdropBanner({
    super.key,
    required this.unitId
})

๊ด‘๊ณ  ์œ ๋‹› ID๋ฅผ ํ•„์ˆ˜๋กœ ์ž…๋ ฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.


Props

Required Props

  • unitId: string

๊ด‘๊ณ  ์œ ๋‹› ID

  • style: { height: number; width: number | string }

๊ด‘๊ณ  ์œ ๋‹› ํฌ๊ธฐ

Optional Props

  • autoLoad: boolean

AdropBanner ๊ตฌ์„ฑ์š”์†Œ๋Š” ์ž๋™์œผ๋กœ ๊ด‘๊ณ ๋ฅผ ์š”์ฒญํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ๋ณธ๊ฐ’์€ true์ž…๋‹ˆ๋‹ค.

  • onAdReceived: (unitId: string) -> void

Adrop์€ AdropBanner๊ฐ€ ๊ด‘๊ณ ๋ฅผ ์ˆ˜์‹ ํ•˜๋ฉด ๊ด‘๊ณ  ์œ ๋‹› ID๋กœ onAdReceived ์ฝœ๋ฐฑ์„ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.

  • onAdClicked: (unitId: string) -> void

Adrop์€ AdropBanner๊ฐ€ ํด๋ฆญ๋˜๋ฉด ๊ด‘๊ณ  ์œ ๋‹› ID๋กœ onAdClicked ์ฝœ๋ฐฑ์„ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.

  • onAdFailedToReceive: (unitId: string, errorCode?: any) -> void

AdropBanner๊ฐ€ ๊ด‘๊ณ  ์ˆ˜์‹ ์— ์‹คํŒจํ•˜๋ฉด Adrop์€ ๊ด‘๊ณ  ์œ ๋‹› ID ๋ฐ AdropErrorCode์™€ ํ•จ๊ป˜ onAdFailedToReceive ์ฝœ๋ฐฑ์„ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.


Usage

Display AdropBanner

<AdropBanner
    unitId={unitId}
    style={{
        width: Dimensions.get('window').width,
        height: 80,
    }}
    onAdClicked={(unitId) => console.log("ad clicked", unitId)}
    onAdReceived={(unitId) => console.log("ad received", unitId)}
    onAdFailedToReceive={(unitId, error) => console.log("ad failed to receive, ", unitId, error)}
/>

Reload Ads using Ref

const ref = useRef(null)

const reload = () => {
    ref.current?.load()
}

// ..
<AdropBanner
    ref={ref}
    unitId={unitId}
    style={{ width: Dimensions.get('window').width, height: 80, }}
/>

Last updated