Watch status
Check whether a Watch is paired, has your Watch app installed, and is reachable right now.
These properties tell you what the Session can do right now. Each read returns the current value, and they never throw.
| Property | Type | true when |
|---|---|---|
isWatchSupported | boolean | This iPhone supports WatchConnectivity. |
isWatchPaired | boolean | An Apple Watch is paired with this iPhone. |
isWatchAppInstalled | boolean | Your Watch app is installed on the paired Watch. |
isWatchReachable | boolean | Your Watch app can receive a Message right now. |
watchActivationState | WatchActivationState | (A string, not a boolean.) Whether the Session is ready to carry data. |
Three of them have an event that fires when the value changes: onReachabilityChanged, onWatchPairedChanged and onWatchAppInstallChanged.
Events fire only on a real change
A new listener isn't called with the current value. Read the property for the starting value, then
listen for changes. With useEvent, pass the property as the initial value:
import { } from "expo";
import from "rn-watch-connect";
export function () {
const { } = (, "onReachabilityChanged", {
: .,
});
return ? "Watch reachable" : "Watch not reachable";
}isWatchSupported
readonly isWatchSupported: booleantrue when this iPhone supports WatchConnectivity. It's false on an iPad, and on platforms other than iOS. Check it before showing any Watch features.
Example
import from "rn-watch-connect";
if (!.) {
// Hide your Watch features.
}isWatchPaired
readonly isWatchPaired: booleantrue when an Apple Watch is paired with this iPhone. Listen to onWatchPairedChanged for changes. It's false on platforms other than iOS.
isWatchAppInstalled
readonly isWatchAppInstalled: booleantrue when your Watch app is installed on the paired Watch. Listen to onWatchAppInstallChanged for changes. It's false on platforms other than iOS.
isWatchReachable
readonly isWatchReachable: booleantrue when your Watch app can receive a Message right now, because it's running and in range. Only Messages and Data Messages need it: sending one while it's false fails with ERR_WATCH_NOT_REACHABLE. Application Context, User Info and File Transfers are delivered later instead. Listen to onReachabilityChanged for changes. It's false on platforms other than iOS.
Example
import from "rn-watch-connect";
if (.) {
await .({ : true });
} else {
.({ : true });
}watchActivationState
readonly watchActivationState: WatchActivationState
// "notActivated" | "inactive" | "activated" | "unknown"Whether the Session is ready to carry data.
| Value | Meaning |
|---|---|
"activated" | The Session is ready. |
"inactive" | The Session is finishing up, for example while the iPhone switches to another Watch. |
"notActivated" | The Session isn't activated yet. |
"unknown" | WatchConnectivity isn't supported: on an iPhone without it, and on platforms other than iOS. |
The Session activates when the library loads. There's no event for a failed activation: if watchActivationState still isn't "activated" shortly after launch, activation failed.
Example
import from "rn-watch-connect";
(() => {
if (. !== "activated") {
.("The Session didn't activate:", .);
}
}, 2000);onReachabilityChanged
onReachabilityChanged: (event: { isWatchReachable: boolean }) => voidFires when isWatchReachable changes. It fires only on a real change, so read the property for the starting value.
Event
| Field | Type | Description |
|---|---|---|
isWatchReachable | boolean | The new value of isWatchReachable. |
Example
import { } from "expo";
import from "rn-watch-connect";
export function () {
(, "onReachabilityChanged", ({ }) => {
.("Watch reachable:", );
});
return null;
}onWatchPairedChanged
onWatchPairedChanged: (event: { isWatchPaired: boolean }) => voidFires when isWatchPaired changes. It fires only on a real change, so read the property for the starting value.
Event
| Field | Type | Description |
|---|---|---|
isWatchPaired | boolean | The new value of isWatchPaired. |
Example
import { } from "expo";
import from "rn-watch-connect";
export function () {
const { } = (, "onWatchPairedChanged", {
: .,
});
return ? "Watch paired" : "No Watch paired";
}onWatchAppInstallChanged
onWatchAppInstallChanged: (event: { isWatchAppInstalled: boolean }) => voidFires when isWatchAppInstalled changes. It fires only on a real change, so read the property for the starting value.
Event
| Field | Type | Description |
|---|---|---|
isWatchAppInstalled | boolean | The new value of isWatchAppInstalled. |
Example
import { } from "expo";
import from "rn-watch-connect";
export function () {
const { } = (, "onWatchAppInstallChanged", {
: .,
});
return ? "Watch app installed" : "Install the Watch app";
}