mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
23 lines
463 B
TypeScript
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>
|
|
);
|
|
}
|
|
}
|