Skip to content

Commit 4c8c472

Browse files
committed
chore: fix formatting
1 parent 7db68c9 commit 4c8c472

File tree

1 file changed

+46
-46
lines changed
  • packages/react-native-bluetooth-state-manager

1 file changed

+46
-46
lines changed

packages/react-native-bluetooth-state-manager/README.md

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ cd ios && bunx pod-install
2727
## Setup
2828

2929
```tsx
30-
import { BluetoothStateManager } from "react-native-bluetooth-state-manager";
30+
import { BluetoothStateManager } from 'react-native-bluetooth-state-manager'
3131
```
3232

3333
**iOS**
@@ -73,35 +73,35 @@ import {
7373
useBluetoothState,
7474
BluetoothStateManager,
7575
BluetoothState,
76-
} from "react-native-bluetooth-state-manager";
76+
} from 'react-native-bluetooth-state-manager'
7777

7878
// Get bluetooth state
7979

8080
// hook
81-
const bluetoothState = useBluetoothState();
81+
const bluetoothState = useBluetoothState()
8282
// synchronous
83-
const bluetoothState = BluetoothStateManager.getStateSync();
83+
const bluetoothState = BluetoothStateManager.getStateSync()
8484
// asynchronous
85-
const bluetoothState = await BluetoothStateManager.getState();
85+
const bluetoothState = await BluetoothStateManager.getState()
8686
// Event listener
87-
const [bluetoothState, setBluetoothState] = useState<BluetoothState>();
87+
const [bluetoothState, setBluetoothState] = useState<BluetoothState>()
8888
useEffect(() => {
8989
const remove = BluetoothStateManager.addListener((state) => {
90-
setBluetoothState(state);
91-
});
92-
return remove;
93-
}, []);
90+
setBluetoothState(state)
91+
})
92+
return remove
93+
}, [])
9494

9595
// Open settings page
96-
await BluetoothStateManager.openSettings();
96+
await BluetoothStateManager.openSettings()
9797

9898
// Android only
9999

100100
// Ask user to enable bluetooth
101-
await BluetoothStateManager.requestToEnable();
101+
await BluetoothStateManager.requestToEnable()
102102

103103
// Ask user to disable bluetooth
104-
await BluetoothStateManager.requestToDisable();
104+
await BluetoothStateManager.requestToDisable()
105105
```
106106

107107
## API
@@ -125,19 +125,19 @@ An example is under `example/App.tsx`
125125
Hook that returns the current state of the bluetooth service.
126126

127127
```tsx
128-
import { useBluetoothState } from "react-native-bluetooth-state-manager";
128+
import { useBluetoothState } from 'react-native-bluetooth-state-manager'
129129

130-
const enabled = true; // default true
131-
const bluetoothState = useBluetoothState(enabled);
130+
const enabled = true // default true
131+
const bluetoothState = useBluetoothState(enabled)
132132
switch (bluetoothState) {
133-
case "Unknown":
134-
case "Resetting":
135-
case "Unsupported":
136-
case "Unauthorized":
137-
case "PoweredOff":
138-
case "PoweredOn":
133+
case 'Unknown':
134+
case 'Resetting':
135+
case 'Unsupported':
136+
case 'Unauthorized':
137+
case 'PoweredOff':
138+
case 'PoweredOn':
139139
default:
140-
break;
140+
break
141141
}
142142
```
143143

@@ -146,17 +146,17 @@ switch (bluetoothState) {
146146
Returns the current state of the bluetooth service.
147147

148148
```tsx
149-
import { BluetoothStateManager } from "react-native-bluetooth-state-manager";
150-
const bluetoothState = await BluetoothStateManager.getState();
149+
import { BluetoothStateManager } from 'react-native-bluetooth-state-manager'
150+
const bluetoothState = await BluetoothStateManager.getState()
151151
switch (bluetoothState) {
152-
case "Unknown":
153-
case "Resetting":
154-
case "Unsupported":
155-
case "Unauthorized":
156-
case "PoweredOff":
157-
case "PoweredOn":
152+
case 'Unknown':
153+
case 'Resetting':
154+
case 'Unsupported':
155+
case 'Unauthorized':
156+
case 'PoweredOff':
157+
case 'PoweredOn':
158158
default:
159-
break;
159+
break
160160
}
161161
```
162162

@@ -165,17 +165,17 @@ switch (bluetoothState) {
165165
Returns the current state synchronous of the bluetooth service.
166166

167167
```tsx
168-
import { BluetoothStateManager } from "react-native-bluetooth-state-manager";
169-
const bluetoothState = BluetoothStateManager.getStateSync();
168+
import { BluetoothStateManager } from 'react-native-bluetooth-state-manager'
169+
const bluetoothState = BluetoothStateManager.getStateSync()
170170
switch (bluetoothState) {
171-
case "Unknown":
172-
case "Resetting":
173-
case "Unsupported":
174-
case "Unauthorized":
175-
case "PoweredOff":
176-
case "PoweredOn":
171+
case 'Unknown':
172+
case 'Resetting':
173+
case 'Unsupported':
174+
case 'Unauthorized':
175+
case 'PoweredOff':
176+
case 'PoweredOn':
177177
default:
178-
break;
178+
break
179179
}
180180
```
181181

@@ -184,10 +184,10 @@ switch (bluetoothState) {
184184
Listen for bluetooth state changes.
185185

186186
```tsx
187-
import { BluetoothStateManager } from "react-native-bluetooth-state-manager";
187+
import { BluetoothStateManager } from 'react-native-bluetooth-state-manager'
188188
BluetoothStateManager.addListener((bluetoothState) => {
189189
// do something...
190-
}, true /*=emitCurrentState*/);
190+
}, true /*=emitCurrentState*/)
191191
```
192192

193193
### openSettings()
@@ -207,7 +207,7 @@ Tested:
207207
Opens the settings page of the app. Please see [here](https://developer.apple.com/documentation/uikit/uiapplicationopensettingsurlstring).
208208

209209
```tsx
210-
BluetoothStateManager.openSettings();
210+
BluetoothStateManager.openSettings()
211211
```
212212

213213
### requestToEnable()
@@ -218,7 +218,7 @@ Show a dialog that allows the user to turn on Bluetooth. More here: [Android doc
218218

219219
```tsx
220220
try {
221-
await BluetoothStateManager.requestToEnable();
221+
await BluetoothStateManager.requestToEnable()
222222
} catch (error) {
223223
// Failed
224224
}
@@ -232,7 +232,7 @@ Show a dialog that allows the user to turn off Bluetooth.
232232

233233
```tsx
234234
try {
235-
await BluetoothStateManager.requestToDisable();
235+
await BluetoothStateManager.requestToDisable()
236236
} catch (error) {
237237
// Failed
238238
}

0 commit comments

Comments
 (0)