Skip to content

v0.2.0

Latest

Choose a tag to compare

@github-actions github-actions released this 25 Oct 16:29
· 2 commits to main since this release
4985080

Highlights

react-native-tinode is now a thin React layer over the official tinode-sdk.
The in-repo TypeScript port of the SDK is gone. This became possible when
tinode/tinode-js#103 was merged: the official SDK now accepts
storage, netInfo and network in new Tinode(config) and ships the storage adapters that this package used to
carry. SDK fixes now come from upstream, and this package keeps only the React providers and hooks, the TypeScript
types and two Hermes polyfills. See #2.

Breaking

  • netInfo moves from a TinodeProvider / TinodeStoresProvider prop into the config:
    createTinode({ ...config, netInfo: NetInfo }) or <TinodeProvider config={{ ...config, netInfo }}>. The SDK
    then reconnects at once when the network comes back. The provider still reconnects on an AppState change.
  • Topic, TopicMe, TopicFnd, CommError, MetaGetBuilder and LargeFileHelper are types only, because
    upstream does not export the classes. Use isCommError(error) instead of instanceof CommError.

Added

  • tinode-sdk is a dependency. Until its next npm release, it is installed from a pinned commit of the tinode-js
    devel branch, so installing needs git and access to github.com.
  • TypeScript declarations for the tinode-sdk surface, one file per area. The emitted types do not refer to
    tinode-sdk, so your app does not need its types.
  • Hermes polyfills for Intl.Segmenter (grapheme level) and TextDecoder (UTF-8). They are installed only when
    missing, before the SDK loads. Without them the SDK crashes on Hermes with Intl.Segmenter is not a constructor.
  • createTinode passes storage, netInfo and network to the SDK.

Fixed

  • The TextDecoder polyfill decodes malformed UTF-8 and skips a leading BOM like the WHATWG TextDecoder.
  • The Intl.Segmenter polyfill rejects granularities other than grapheme and supports containing().

Changed

  • fromMMKV is a typed const.
  • The grapheme fallback tables are removed. Hermes supports \p{} Unicode property escapes now.
  • CreateTinodeOptions is derived from TinodeConfig, so the two cannot drift apart.

Removed

  • src/core (the SDK port and its 14 test suites), src/react/netinfo.ts and the fake-indexeddb dev dependency.

Known limits

  • LargeFileHelper.download() works on the web only, because the current tinode-sdk needs a DOM for it. Until
    the fix is released upstream, download attachments yourself with fetch and the auth token. upload() works on
    native.
  • Not checked: signing in against a local Tinode server. The example app loads the SDK on Hermes and shows the
    sign-in screen in Expo Go on the iOS simulator.

Docs

  • README: the package is a React layer over tinode-sdk, the GitHub install, and why the AppState reconnect stays
    in the provider.
  • Design decisions, NOTICE and
    the auth token guide are updated.

Contributors