From 2fad6a427df4cdbf3b14328f7d343c7de5478085 Mon Sep 17 00:00:00 2001 From: Jairaj Jangle <25704330+JairajJangle@users.noreply.github.com> Date: Mon, 1 Sep 2025 16:09:07 +0530 Subject: [PATCH 1/3] fix: potential fix for missing import suggestion --- package.json | 18 +++++++++++++++++- src/NativeNavigationMode.ts | 4 ++-- src/index.tsx | 11 ++++++----- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 7645f9b..da5e2c8 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,8 @@ "version": "1.2.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", @@ -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" + } + ] } diff --git a/src/NativeNavigationMode.ts b/src/NativeNavigationMode.ts index bf367d6..b6ac959 100644 --- a/src/NativeNavigationMode.ts +++ b/src/NativeNavigationMode.ts @@ -4,8 +4,8 @@ import { TurboModuleRegistry, Platform } from 'react-native'; export interface NavigationModeInfo { type: '3_button' | '2_button' | 'gesture' | 'unknown'; isGestureNavigation: boolean; - interactionMode?: number; - navigationBarHeight?: number; + interactionMode: number; + navigationBarHeight: number; } export interface Spec extends TurboModule { diff --git a/src/index.tsx b/src/index.tsx index b8c697b..1555f2f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,5 +1,5 @@ import { Platform } from 'react-native'; -import React from 'react'; +import { useEffect, useState } from 'react'; import NavigationModeModule, { type NavigationModeInfo, } from './NativeNavigationMode'; @@ -17,6 +17,7 @@ export function getNavigationMode(): Promise { return Promise.resolve({ type: 'gesture', isGestureNavigation: true, + interactionMode: 2, navigationBarHeight: 0, // iOS doesn't have a navigation bar like Android }); } @@ -60,11 +61,11 @@ export function getNavigationBarHeight(): Promise { */ export function useNavigationMode() { const [navigationMode, setNavigationMode] = - React.useState(null); - const [loading, setLoading] = React.useState(true); - const [error, setError] = React.useState(null); + useState(null); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); - React.useEffect(() => { + useEffect(() => { let mounted = true; async function fetchNavigationMode() { From b0a0076f23935d6825a292f4ff6e2a10bace4b7b Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 1 Sep 2025 10:45:44 +0000 Subject: [PATCH 2/3] chore(release): 1.2.2-beta.1 [skip ci] ## [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)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a01dda0..25fc84b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/package.json b/package.json index da5e2c8..58692d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "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", From 8a8ce1088ab5562b76b07aeb413f9e887fd1d586 Mon Sep 17 00:00:00 2001 From: Jairaj Jangle <25704330+JairajJangle@users.noreply.github.com> Date: Mon, 1 Sep 2025 18:17:07 +0530 Subject: [PATCH 3/3] chore: updated incorrect interactionMode mode type --- README.md | 14 ++++++++------ src/NativeNavigationMode.ts | 2 +- src/index.tsx | 1 - 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c7d52e4..c5a77b0 100644 --- a/README.md +++ b/README.md @@ -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) | diff --git a/src/NativeNavigationMode.ts b/src/NativeNavigationMode.ts index b6ac959..847c19c 100644 --- a/src/NativeNavigationMode.ts +++ b/src/NativeNavigationMode.ts @@ -4,7 +4,7 @@ import { TurboModuleRegistry, Platform } from 'react-native'; export interface NavigationModeInfo { type: '3_button' | '2_button' | 'gesture' | 'unknown'; isGestureNavigation: boolean; - interactionMode: number; + interactionMode?: number; navigationBarHeight: number; } diff --git a/src/index.tsx b/src/index.tsx index 1555f2f..f793e1a 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -17,7 +17,6 @@ export function getNavigationMode(): Promise { return Promise.resolve({ type: 'gesture', isGestureNavigation: true, - interactionMode: 2, navigationBarHeight: 0, // iOS doesn't have a navigation bar like Android }); }