Native-first React Native module that reports whether a physical (hardware) keyboard is connected, and emits an event whenever that connection state changes — on iOS and Android.
- 🔌 Connection status — one-shot
isKeyboardConnected()query - 📡 Live updates — subscribe to connect / disconnect events
- ⚛️ Hook —
useIsKeyboardConnected()for drop-in React state - ⚡ New Architecture · Old Architecture · Bridgeless
Tip
Need more than connection status? This module is also bundled — alongside screen-reader
focus order, physical-keyboard support, and iOS accessibility containers — into the
all-in-one react-native-a11y
toolkit. Install the focused package for just this capability, or react-native-a11y
for the complete set.
yarn add react-native-is-keyboard-connected
cd ios && pod installThat's it — on iOS the GameController framework is linked automatically via the podspec. No manual "Link Binary With Libraries" step is required.
Why GameController?
GameController is the only App Store–safe way to obtain hardware keyboard connection
status (GCKeyboard, iOS 14+). Other approaches are workarounds that risk rejection
during App Store review.
Backed by the native module (GameController on iOS, Configuration on Android).
import {
isKeyboardConnected,
keyboardStatusListener,
useIsKeyboardConnected,
useIsKeyboardConnectedRef,
} from 'react-native-is-keyboard-connected';
// Hook — re-renders when a keyboard connects or disconnects
const connected = useIsKeyboardConnected();
// Ref hook — same live value without re-rendering (read `ref.current` in callbacks)
const connectedRef = useIsKeyboardConnectedRef();
// Or drive it yourself:
// one-shot query
isKeyboardConnected().then((isConnected) => setResult(isConnected));
// subscribe to changes — returns an unsubscribe function
const removeListener = keyboardStatusListener((e) => setResult(e.status));Note: These helpers only wrap React Native's default
AccessibilityInfoAPI — no native module and no extra linking. They're syntax sugar that mirrors the keyboard API (same{ status }listener payload) so both can be used the same way.
import {
isScreenReaderEnabled,
screenReaderStatusListener,
useIsScreenReaderEnabled,
useIsScreenReaderEnabledRef,
} from 'react-native-is-keyboard-connected';
// Hook — re-renders when VoiceOver / TalkBack is toggled
const enabled = useIsScreenReaderEnabled();
// Ref hook — same live value without re-rendering
const enabledRef = useIsScreenReaderEnabledRef();
// Or drive it yourself:
isScreenReaderEnabled().then((isEnabled) => setResult(isEnabled));
const removeListener = screenReaderStatusListener((e) => setResult(e.status));| Export | Purpose |
|---|---|
useIsKeyboardConnected() |
Hook returning the current connection state, updated on change. |
useIsKeyboardConnectedRef() |
Ref variant — .current holds the latest state without re-rendering. |
isKeyboardConnected() |
Promise<boolean> — one-shot query of the current state. |
keyboardStatusListener(cb) |
Subscribe to { status: boolean } change events; returns an unsubscribe function. |
| Export | Purpose |
|---|---|
useIsScreenReaderEnabled() |
Hook returning whether a screen reader is enabled, updated on change. |
useIsScreenReaderEnabledRef() |
Ref variant — .current holds the latest state without re-rendering. |
isScreenReaderEnabled() |
Promise<boolean> — one-shot query of the current state. |
screenReaderStatusListener(cb) |
Subscribe to { status: boolean } change events; returns an unsubscribe function. |
| Capability | Supported |
|---|---|
| New Architecture (Fabric / Turbo Modules) | ✅ |
| Old Architecture (Bridge) | ✅ |
| Bridgeless mode | ✅ |
1.1.0 is backward compatible — no breaking changes. isKeyboardConnected,
keyboardStatusListener, and useIsKeyboardConnected keep the same signatures,
so existing code needs no changes.
New in 1.1.0 (all additive):
useIsKeyboardConnectedRef— ref variant ofuseIsKeyboardConnected.isScreenReaderEnabled/screenReaderStatusListener/useIsScreenReaderEnabled/useIsScreenReaderEnabledRef— screen-reader helpers over RN'sAccessibilityInfo(see the note above).
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library

