0.3.14 • Published 7 months ago

@getoptimal/react-native v0.3.14

Weekly downloads
-
License
-
Repository
-
Last release
7 months ago

Optimal React Native SDK

Quick Start

Installation

Install the package with your package manager of choice:

# npm
npm install @getoptimal/react-native

# yarn
yarn add @getoptimal/react-native

# pnpm
pnpm add @getoptimal/react-native

Then simply include OptimalProvider in the root of your app:

<OptimalProvider>
  <MyApp />
</OptimalProvider>;

Usage

See the following example for a quick start. GetAdOpts can be obtained from the Optimal team.

Following example will render the ad automatically, if you would like to have more control, check the next example.

Automatic

import { OptimalAd } from "@getoptimal/react-native";

const opts = {
  publisher: "publisher",
  adTypes: ["ad type"],
  viewerData: {
    wallets: ["1:wallet"],
  },
};

export const MyComponent = () => {
  return (
    <OptimalAd
      renderLoading={() => {
        return <Text>i am loading</Text>;
      }}
      containerStyle={{ width: "100%" }}
      opts={opts}
    />
  );
};

Manual

You can also use the following example for custom ads:

import { Text } from 'react-native';
import { type OptimalPredefinedAdProps, OptimalCustomAd } from "@getoptimal/react-native";

export const MyAd = (props: OptimalPredefinedAdProps) => {
  return (
    <OptimalCustomAd
      {...props}
      renderAd={(decision) => {
        return <Text>your custom component</Text>
      }
    />
  );
};

Typings

Typescript typings are included in the package.

More Examples

See the example app stories for more examples.

0.3.14

7 months ago

0.3.13

7 months ago

0.3.12

7 months ago

0.3.11

7 months ago

0.3.10

7 months ago

0.3.9

12 months ago

0.3.8

12 months ago

0.3.7

12 months ago

0.3.6

12 months ago

0.3.4

12 months ago

0.3.3

12 months ago

0.3.2

12 months ago

0.3.1

12 months ago

0.3.0

12 months ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago