@texturehq/react-native-connect-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

React Native Connect SDK

The React Native SDK for Texture Connect API is a JavaScript library that allows you to easily integrate the Texture Connect flow into your React Native applications.

It works by opening a popover dialog that houses the Texture Connect flow and allows the user to authorize access to devices. After a successful connection is established it then returns control back to your application along with a scoped key that can be used to make requests to the Texture API to retrieve data related to the newly connected account.

Installation

npm install @texturehq/react-native-connect-sdk

Usage

import { TextureConnect } from '@texturehq/react-native-connect-sdk';

// ...

  return (
    <GestureHandlerRootView style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <TextureConnect
          connectApiKey="<YOUR_CONNECT_API_KEY>"
          connectOptions={{
            clientName: 'Texture Connect',
            referenceId: '123',
            redirectUrl: 'example://',
            manufacturerFilters: { manufacturers: ['honeywell', 'daikin'] },
          }}
          onError={(type, reason) => console.log(type, reason)}
          onSuccess={(scopedKey) => console.log("Texture Scoped Key", scopedKey)}
        >
            <Text>Tap here to connect a device.</Text>
        </TextureConnect>
    </GestureHandlerRootView>
  );
}

License

MIT

See the license to learn more.

Package Sidebar

Install

npm i @texturehq/react-native-connect-sdk

Weekly Downloads

3

Version

0.2.0

License

MIT

Unpacked Size

286 kB

Total Files

78

Last publish

Collaborators

  • texture-sam
  • wlaeri
  • rcasto
  • victorquinn