// `rnx get keyboard` — prints the current iOS keyboard's full state. // // shows visibility, keyboardType, returnKeyType, autoCapitalize policy, // active QWERTY sub-mode, shift + capsLock, and the mounted accessory bar // id (if any). reads from `__sootsimKeyboard.getLayout()`, which is // populated by shell-worker `keyboard.layout` broadcasts. import { rnxExit } from '../../run-rnx' import { inspectKeyboard } from './core' import type { WsBridge } from '../../ws-bridge' export async function runKeyboardSubcommand( bridge: WsBridge, opts: { json?: boolean } = {}, ): Promise { const result = await inspectKeyboard(bridge) if ('error' in result) { console.error(result.error) rnxExit(1) } if (opts.json) { console.log(JSON.stringify(result, null, 2)) return } const { visible, spec, mode, shifted, capsLock, accessoryBarId } = result const lines: string[] = [] lines.push(`keyboard: ${visible ? 'visible' : 'hidden'}`) if (spec) { lines.push(` type: ${spec.keyboardType}`) lines.push(` returnKey: ${spec.returnKeyType}`) lines.push(` autoCap: ${spec.autoCapitalize}`) lines.push(` autoCorrect: ${spec.autoCorrect ? 'on' : 'off'}`) lines.push(` spellCheck: ${spec.spellCheck ? 'on' : 'off'}`) lines.push(` appearance: ${spec.keyboardAppearance}`) if (spec.secureTextEntry) lines.push(` secureTextEntry: true`) if (spec.enablesReturnKeyAutomatically) { lines.push( ` return: ${spec.currentTextIsEmpty ? 'disabled (empty)' : 'enabled'}`, ) } } else { lines.push(` spec: (shown via dev-tools with no TextInput)`) } lines.push( ` mode: ${mode}${shifted ? ' (shifted)' : ''}${capsLock ? ' (caps)' : ''}`, ) if (accessoryBarId) { lines.push(` accessoryBar: ${accessoryBarId}`) } console.log(lines.join('\n')) }