@texturehq/react-native-connect-sdk
v0.2.0
Published
React Native SDK for Texture Connect API
Downloads
3
Readme
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.