diff --git a/README.md b/README.md index 8767947..9bde0fa 100644 --- a/README.md +++ b/README.md @@ -1122,6 +1122,24 @@ triggerPinOrBiometricAuthentication: ({ is less than the number of seconds specified here authentication will succeed without requesting it again. +### focusNavbar + +App version >= 24.9 + +Sets the screen reader focus on the native navigation bar. If the webview +doesn't have a native navbar, the native app will respond with +`{focused: false}`. + +This is useful for accessibility purposes. We need the focus to be set in the +navbar when we navigate to a new screen using client side navigation (React +Router). + +```ts +focusNavbar: () => Promise<{ + focused: boolean, +}>; +``` + ## Error handling If an uncontrolled error occurs, promise will be rejected with an error object: diff --git a/index.ts b/index.ts index 8610d8d..b34bc88 100644 --- a/index.ts +++ b/index.ts @@ -43,6 +43,7 @@ export { getPincodeInfo, onNavigationBarIconClicked, triggerPinOrBiometricAuthentication, + focusNavbar, } from './src/utils'; export type {ShareOptions, NavigationBarIcon} from './src/utils'; diff --git a/src/post-message.ts b/src/post-message.ts index fabae97..1e4584f 100644 --- a/src/post-message.ts +++ b/src/post-message.ts @@ -321,6 +321,13 @@ export type ResponsesFromNativeApp = { | 'LAST_AUTHENTICATION_STILL_VALID'; }; }; + FOCUS_NAVBAR: { + type: 'FOCUS_NAVBAR'; + id: string; + payload: { + focused: boolean; + }; + }; SHARE_BASE64: { type: 'SHARE_BASE64'; id: string; diff --git a/src/utils.ts b/src/utils.ts index 606fe6b..62918d5 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -320,3 +320,6 @@ export const triggerPinOrBiometricAuthentication = ( type: 'TRIGGER_PIN_OR_BIOMETRIC_AUTHENTICATION', payload: {maxSecondsSinceLastValidation}, }); + +export const focusNavbar = (): Promise<{focused: boolean}> => + postMessageToNativeApp({type: 'FOCUS_NAVBAR'});