# @dittolive/react-native

> React Native SDK to integrate Ditto.

Latest version **4.5.0-alpha7** (published 2023-09-12) · SEE LICENSE IN LICENSE.md license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @dittolive/react-native
pnpm add @dittolive/react-native
yarn add @dittolive/react-native
bun add @dittolive/react-native
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 4.5.0-alpha7 |
| Published | 2023-09-12 |
| First published | 2023-09-11 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE.md |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 16.0.0 |
| Dependencies | 3 |
| Unpacked size | 3.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Author | Teodor Ciuraru |
| Maintainers | pvditto, teodor.ditto, phatblat, craigatallahfrost, aaronleopold, jreyes33, mbalex99, hamditto, bigfish24, connorpower, konstantinbe, kndoshn, jon-ditto, sinhditto |
| Keywords | react-native, ditto, dittolive, db, database, sync, p2p, ios, android, jsi |

## Links

- npm: https://www.npmjs.com/package/@dittolive/react-native
- Repository: https://www.ditto.live
- Issues: https://www.ditto.com/issues
- npm.io page: https://npm.io/package/@dittolive/react-native

## Dependencies (3)

- [cbor-js](https://npm.io/package/cbor-js.md) ^0.1.0
- [@ungap/weakrefs](https://npm.io/package/@ungap/weakrefs.md) ^0.2.0
- [fastestsmallesttextencoderdecoder](https://npm.io/package/fastestsmallesttextencoderdecoder.md) ^1.0.22

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 4.5.0-alpha7 (latest) — 2023-09-12
- 4.5.0-alpha6 — 2023-09-11
- 4.5.0-alpha5 — 2023-09-11
- 4.5.0-alpha4 — 2023-09-11
- 4.5.0-alpha3 — 2023-09-11
- 4.5.0-alpha2 — 2023-09-11
- 4.5.0-alpha1 — 2023-09-11

## README

# Ditto React Native SDK

---

**Disclaimer**: This package is in <i>alpha</i> stage. While it is feature-rich and stable for many use cases, expect some rough edges and API changes before the official release.

Please note that the current version of this SDK has been validated exclusively on ARM-based iOS simulators using the `aarch64` architecture and Android emulators running the `arm64-v8a` architecture and supports syncing data only with Ditto Portal's online playground.

---

## Table of Contents

- [Introduction](#introduction)
- [Features](#features)
- [Installation](#installation)
- [Android Configuration](#android-configuration)
- [Getting Started](#getting-started)
- [Examples](#example)
- [License](#license)

## Introduction

Ditto is a real-time database for mobile, web, IoT, and server apps that can magically sync data without the internet. This SDK allows React Native developers to integrate Ditto into their apps.

## Features

- 📱 Cross-platform support (iOS, Android).
- 🚀 High performance and optimized for low latency (TurboModules & JSI).
- 🌐 DQL (Ditto Query Language) ready.

## Installation

To install the alpha version of `@dittolive/react-native`, run the following command:

```bash
npm install @dittolive/react-native
```

or

```bash
yarn add @dittolive/react-native
```

## Android Configuration

<b>Important</b>: This SDK’s required `minSdkVersion` is 24.

To update, modify your `android/build.gradle`:

```groovy
buildscript {
    ext {
        // ... existing configuration

        minSdkVersion = 24  // Modify version to 24
    }
    // ... rest of the buildscript
}
```

### Resolving Native Library Conflicts

If you encounter an issue related to duplicate native libraries (`libjsi.so` or others), you can resolve it by adding the following `packagingOptions` in your `android/app/build.gradle` file:

```groovy
android {
    // ... existing configuration

    packagingOptions {
        pickFirst 'lib/arm64-v8a/libjsi.so'
        pickFirst 'lib/armeabi-v7a/libjsi.so'
        pickFirst 'lib/x86/libjsi.so'
        pickFirst 'lib/x86_64/libjsi.so'
    }
}
```

## Getting Started

1. Import the SDK in your React Native project:

```js
import { Ditto } from '@dittolive/react-native';
```

2. Initialize the SDK with Ditto Portal values:

```js
const ditto = new Ditto({
  appID: '<YOUR_APP_ID>',
  token: '<YOUR_TOKEN>',
});
```

3. You're all set! You can now use the SDK.

## Example

We've provided an example application to showcase the capabilities of Ditto React Native SDK. You can find practical implementations in the `App.tsx` file of the example app (`/example/src/App.tsx`). Be sure to replace your `appID` and `token` with values from the [Ditto Portal](https://portal.ditto.live).

## License

_Ditto React Native SDK_ is a commercial product. Please consult `LICENSE.md` within this package for license details.

Copyright © 2023 DittoLive Incorporated. All rights reserved.

---
_Source: https://npm.io/package/@dittolive/react-native · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
