Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [1.2.2-beta.1](https://github.com/JairajJangle/react-native-navigation-mode/compare/v1.2.1...v1.2.2-beta.1) (2025-09-01)


### Bug Fixes

* potential fix for missing import suggestion ([2fad6a4](https://github.com/JairajJangle/react-native-navigation-mode/commit/2fad6a427df4cdbf3b14328f7d343c7de5478085))

## [1.2.1](https://github.com/JairajJangle/react-native-navigation-mode/compare/v1.2.0...v1.2.1) (2025-08-02)


Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,17 @@ console.log('Navigation bar height:', height); // number (dp)

#### `NavigationModeInfo`

| Property | Type | Description |
| ------------------- | ----------------------------------------------------------- | --------------------------------------------------------- |
| type | `'3_button'` or `'2_button'` or `'gesture'` or `'unknown'` | 4 possible Android navigation modes that can be detected. |
| isGestureNavigation | `boolean` | Whether gesture navigation is active. |
| interactionMode | `number` or `undefined` | See [Interaction Mode Values](#interaction-mode-values) |
| navigationBarHeight | `number` or `undefined` | Navigation bar height in density-independent pixels (dp). |
| Property | Type | Description |
| ------------------- | ----------------------------------------------------------- | ------------------------------------------------------------ |
| type | `'3_button'` or `'2_button'` or `'gesture'` or `'unknown'` | 4 possible Android navigation modes that can be detected |
| isGestureNavigation | `boolean` | Whether gesture navigation is active |
| interactionMode | `number` or `undefined` | See [Interaction Mode Values](#interaction-mode-values) |
| navigationBarHeight | `number` | Navigation bar height in density-independent pixels (dp). 0 for iOS |

### Interaction Mode Values

Only available for Android 10 (API 29) or newer.

| Android Mode | Type | Description |
| ------------ | ---------- | --------------------------------------------------- |
| 0 | `3_button` | Traditional Android navigation (Back, Home, Recent) |
Expand Down
20 changes: 18 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"name": "react-native-navigation-mode",
"version": "1.2.1",
"version": "1.2.2-beta.1",
"description": "Detect Android navigation mode (3-button, 2-button, or gesture)",
"main": "./lib/module/index.js",
"react-native": "./lib/module/index.js",
"source": "src/index.tsx",
"types": "./lib/typescript/src/index.d.ts",
"files": [
"src",
Expand Down Expand Up @@ -176,5 +178,19 @@
"languages": "kotlin-objc",
"type": "turbo-module",
"version": "0.50.3"
}
},
"funding": [
{
"type": "individual",
"url": "https://www.paypal.com/paypalme/jairajjangle001/usd"
},
{
"type": "individual",
"url": "https://liberapay.com/FutureJJ/donate"
},
{
"type": "individual",
"url": "https://ko-fi.com/futurejj"
}
]
}
2 changes: 1 addition & 1 deletion src/NativeNavigationMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface NavigationModeInfo {
type: '3_button' | '2_button' | 'gesture' | 'unknown';
isGestureNavigation: boolean;
interactionMode?: number;
navigationBarHeight?: number;
navigationBarHeight: number;
}

export interface Spec extends TurboModule {
Expand Down
10 changes: 5 additions & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Platform } from 'react-native';
import React from 'react';
import { useEffect, useState } from 'react';
import NavigationModeModule, {
type NavigationModeInfo,
} from './NativeNavigationMode';
Expand Down Expand Up @@ -60,11 +60,11 @@ export function getNavigationBarHeight(): Promise<number> {
*/
export function useNavigationMode() {
const [navigationMode, setNavigationMode] =
React.useState<NavigationModeInfo | null>(null);
const [loading, setLoading] = React.useState(true);
const [error, setError] = React.useState<Error | null>(null);
useState<NavigationModeInfo | null>(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<Error | null>(null);

React.useEffect(() => {
useEffect(() => {
let mounted = true;

async function fetchNavigationMode() {
Expand Down
Loading