DefinitelyTyped/types/react-native-bluetooth-serial/react-native-bluetooth-serial-tests.tsx
2018-04-11 11:39:29 -07:00

23 lines
463 B
TypeScript

import * as React from 'react';
import { View, Text } from 'react-native';
import { BluetoothSerial } from 'react-native-bluetooth-serial';
class Example extends React.Component {
async componentDidMount() {
const devices = await BluetoothSerial.list();
await BluetoothSerial.connect(devices[0].id);
BluetoothSerial.write("Hello");
await BluetoothSerial.disconnect();
}
render() {
return (
<View>
<Text>Printer</Text>
</View>
);
}
}