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
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## [1.2.1](https://github.com/JairajJangle/react-native-navigation-mode/compare/v1.2.0...v1.2.1) (2025-08-02)


### Bug Fixes

* add null check for Android WindowInsets.getInsets() result ([7d18ab5](https://github.com/JairajJangle/react-native-navigation-mode/commit/7d18ab5d0cf12fe45a1639ecb8c624733777003e))

# [1.2.0](https://github.com/JairajJangle/react-native-navigation-mode/compare/v1.1.1...v1.2.0) (2025-07-21)


### Bug Fixes

* expo managed workflow incorrectly loading es module from common js context ([29d171f](https://github.com/JairajJangle/react-native-navigation-mode/commit/29d171f3ce9fd818340ecb0d8d6bfb82042fed0d))


### Features

* added support for expo managed workflows ([b60fc17](https://github.com/JairajJangle/react-native-navigation-mode/commit/b60fc17bbfb8d2682d5bc4c3840ce085c1d94a0a))

# [1.2.0-beta.2](https://github.com/JairajJangle/react-native-navigation-mode/compare/v1.2.0-beta.1...v1.2.0-beta.2) (2025-07-21)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class NavigationModeModule(reactContext: ReactApplicationContext) :
if (activity != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
val insets = activity.window.decorView.rootWindowInsets
if (insets != null) {
val navBar = insets.getInsets(WindowInsets.Type.navigationBars())
val navBar = insets.getInsets(WindowInsets.Type.navigationBars()) ?: return 0
return (navBar.bottom / density).toInt() // Convert pixels to dp
}
}
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.0-beta.2",
"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",
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"
}
]
}
4 changes: 2 additions & 2 deletions src/NativeNavigationMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 6 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 All @@ -17,6 +17,7 @@ export function getNavigationMode(): Promise<NavigationModeInfo> {
return Promise.resolve({
type: 'gesture',
isGestureNavigation: true,
interactionMode: 2,
navigationBarHeight: 0, // iOS doesn't have a navigation bar like Android
});
}
Expand Down Expand Up @@ -60,11 +61,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
Loading