Skip to content

Commit 2cbbf29

Browse files
chore: update android method signatures, example
1 parent f0732ee commit 2cbbf29

File tree

3 files changed

+15
-37
lines changed

3 files changed

+15
-37
lines changed

android/src/main/java/com/mendixnative/MendixNativeModule.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ class MendixNativeModule(reactContext: ReactApplicationContext) : NativeMendixNa
169169
NativeErrorHandler(reactApplicationContext).handle(message, stackTrace)
170170
}
171171

172-
override fun navigationModeIsNavigationBarActive(): Boolean {
173-
return NavigationModeModule(reactApplicationContext).isNavigationBarActive()
174-
}
172+
override fun navigationModeIsNavigationBarActive(): Boolean {
173+
return NavigationModeModule(reactApplicationContext).isNavigationBarActive()
174+
}
175175

176-
override fun navigationModeGetNavigationBarHeight(): Double {
177-
return NavigationModeModule(reactApplicationContext).getNavigationBarHeight()
178-
}
176+
override fun navigationModeGetNavigationBarHeight(): Double {
177+
return NavigationModeModule(reactApplicationContext).getNavigationBarHeight()
178+
}
179179

180180
companion object {
181181
const val NAME = "MendixNative"

example/src/App.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { Text, View, StyleSheet } from 'react-native';
2+
import { AndroidNavigationBar } from 'mendix-native';
23

34
export default function App() {
45
const runtime = (global as any).nativeFabricUIManager
56
? 'New Architecture'
67
: 'Legacy Architecture';
78

9+
console.log('Navigation Bar Height:', AndroidNavigationBar.height);
10+
console.log('Is Navigation Bar Active:', AndroidNavigationBar.isActive);
11+
812
return (
913
<View style={styles.container}>
1014
<View style={styles.archContainer}>

src/navigation-mode.ts

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,6 @@
1-
import NativeMendixNative from './specs/NativeMendixNative';
1+
import Mx from './specs/NativeMendixNative';
22

3-
/**
4-
* Navigation Mode Module
5-
*
6-
* Provides information about Android navigation bar state.
7-
* These methods are synchronous and Android-only.
8-
* On iOS, they always return false/0.
9-
*/
10-
11-
/**
12-
* Checks if the navigation bar is active on Android.
13-
* Returns true for three-button and two-button navigation modes.
14-
* Returns false for gesture navigation mode.
15-
* On iOS, always returns false.
16-
*
17-
* @returns {boolean} true if navigation bar is active, false otherwise
18-
*/
19-
export function isNavigationBarActive(): boolean {
20-
return NativeMendixNative.navigationModeIsNavigationBarActive();
21-
}
22-
23-
/**
24-
* Gets the navigation bar height in density-independent pixels (dp).
25-
* On Android, returns the actual navigation bar height.
26-
* On iOS, always returns 0.
27-
*
28-
* @returns {number} Navigation bar height in dp
29-
*/
30-
export function getNavigationBarHeight(): number {
31-
return NativeMendixNative.navigationModeGetNavigationBarHeight();
32-
}
3+
export const AndroidNavigationBar = {
4+
height: Mx.navigationModeGetNavigationBarHeight(),
5+
isActive: Mx.navigationModeIsNavigationBarActive(),
6+
};

0 commit comments

Comments
 (0)