> For the complete documentation index, see [llms.txt](https://sdk-doc.tyrads.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sdk-doc.tyrads.com/react-native/initialization/premium-offers.md).

# Premium Offers

Tyrads SDK  introduces native React components that allow you to render premium offers directly within your application's UI, providing a more integrated and seamless user experience compared to the traditional modal offerwall.

***

### Components Overview

The SDK exports two primary components for native widget implementation:

* **`PremiumOffersWidget`**: The main component that fetches and displays premium offers.
* **`PremiumOffersWidgetLoading`**: A placeholder component that provides a skeleton/shimmer effect during data fetching.

***

### Basic Usage

To use the premium widget, simply import it and place it anywhere in your JSX tree.

```jsx
import React from 'react';
import { View, ScrollView } from 'react-native';
import { PremiumOffersWidget, PremiumWidgetStyles } from '@tyrads.com/tyrads-sdk';

const MyGameScreen = () => {
  return (
    <ScrollView>
      {/* Other game content */}
      
      <PremiumOffersWidget 
        widgetStyle={PremiumWidgetStyles.list} 
        launchMode={2}
      />
      
      {/* Other game content */}
    </ScrollView>
  );
};
```

***

### Widget Styles

The `PremiumWidgetStyles` enum allows you to choose between two distinct layouts:

| Style                             | Description                                                                                |
| --------------------------------- | ------------------------------------------------------------------------------------------ |
| `PremiumWidgetStyles.list`        | Renders offers in a vertical list format (Best for dedicated offer screens).               |
| `PremiumWidgetStyles.sliderCards` | Renders offers in a horizontal swipeable carousel (Best for home screens or small spaces). |

**Available Widget Style options**

<figure><img src="/files/pmkTkVXEfP8BjgHKJ7SK" alt=""><figcaption><p>Option 1</p></figcaption></figure>

<figure><img src="/files/zMADmZXKS3LZtzT4sJkN" alt=""><figcaption><p>Option 2 </p></figcaption></figure>

**Example (Slider Style):**

```jsx
<PremiumOffersWidget widgetStyle={PremiumWidgetStyles.sliderCards} />
```

***

### Prop Reference

#### `PremiumOffersWidget`

| Prop          | Type                  | Default | Description                                                             |
| ------------- | --------------------- | ------- | ----------------------------------------------------------------------- |
| `widgetStyle` | `PremiumWidgetStyles` | `list`  | Determines the layout of the widget.                                    |
| `launchMode`  | `number`              | `2`     | Determines presentation style on iOS (2: Embedded, 3: External Safari). |

#### `PremiumOffersWidgetLoading`

| Prop          | Type                  | Default | Description                                                |
| ------------- | --------------------- | ------- | ---------------------------------------------------------- |
| `widgetStyle` | `PremiumWidgetStyles` | `list`  | Matches the skeleton layout to your intended widget style. |

***

### Handling Loading States

For the best user experience, it's recommended to show the loading placeholder while the SDK is initializing or fetching data.

```jsx
import React, { useState, useEffect } from 'react';
import Tyrads, { PremiumOffersWidget, PremiumOffersWidgetLoading } from '@tyrads.com/tyrads-sdk';

const MyScreen = () => {
  const [isReady, setReady] = useState(false);

  useEffect(() => {
    Tyrads.init('KEY', 'SECRET').then(() => {
      Tyrads.loginUser('USER_ID').then(() => {
        setReady(true);
      });
    });
  }, []);

  return (
    <View style={{ flex: 1 }}>
      {isReady ? (
        <PremiumOffersWidget />
      ) : (
        <PremiumOffersWidgetLoading />
      )}
    </View>
  );
};
```

***

### Best Practices

1. **Container Sizing**: The `PremiumOffersWidget` is designed to be flexible. If using the `list` style inside a `ScrollView`, ensure it doesn't have a fixed height unless intended.
2. **Launch Mode Compatibility**: Remember that `launchMode` only affects iOS presenting behavior. On Android, the offer details always open in the standard view.
3. **Key Management**: If your app supports multiple configurations or user switching, you can use the `key` prop on the widget to force a re-render when initialization data changes.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sdk-doc.tyrads.com/react-native/initialization/premium-offers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
