react-native-navigation-mode 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -10
- package/android/src/main/java/com/navigationmode/NavigationModeModule.kt +1 -22
- package/ios/NavigationMode.mm +1 -4
- package/lib/module/NativeNavigationMode.js.map +1 -1
- package/lib/module/index.js +1 -4
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NativeNavigationMode.d.ts +1 -4
- package/lib/typescript/src/NativeNavigationMode.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +11 -5
- package/src/NativeNavigationMode.ts +1 -4
- package/src/index.tsx +0 -3
package/README.md
CHANGED
|
@@ -107,8 +107,6 @@ import { getNavigationMode } from 'react-native-navigation-mode';
|
|
|
107
107
|
// Get comprehensive navigation info
|
|
108
108
|
const navInfo = await getNavigationMode();
|
|
109
109
|
console.log('Navigation type:', navInfo.type); // '3_button', '2_button', 'gesture', or 'unknown'
|
|
110
|
-
console.log('SDK version:', navInfo.sdkVersion);
|
|
111
|
-
console.log('Device model:', navInfo.deviceModel);
|
|
112
110
|
```
|
|
113
111
|
|
|
114
112
|
### React Hook (Recommended)
|
|
@@ -128,9 +126,6 @@ export default function NavigationInfo() {
|
|
|
128
126
|
<View>
|
|
129
127
|
<Text>Navigation Type: {navigationMode?.type}</Text>
|
|
130
128
|
<Text>Gesture Navigation: {navigationMode?.isGestureNavigation ? 'Yes' : 'No'}</Text>
|
|
131
|
-
<Text>Has Navigation Bar: {navigationMode?.hasNavigationBar ? 'Yes' : 'No'}</Text>
|
|
132
|
-
<Text>Android SDK: {navigationMode?.sdkVersion}</Text>
|
|
133
|
-
<Text>Device: {navigationMode?.deviceModel}</Text>
|
|
134
129
|
</View>
|
|
135
130
|
);
|
|
136
131
|
}
|
|
@@ -184,9 +179,6 @@ React hook for navigation mode detection with loading and error states.
|
|
|
184
179
|
| ------------------- | ---------------------------------------------- | ------------------------------------------------ |
|
|
185
180
|
| type | `'3_button' \| '2_button' \| 'gesture' \| 'unknown'` | Navigation mode type |
|
|
186
181
|
| isGestureNavigation | `boolean` | Whether gesture navigation is active |
|
|
187
|
-
| hasNavigationBar | `boolean` | Whether device has a navigation bar |
|
|
188
|
-
| sdkVersion | `number` | Android SDK version (iOS: iOS version) |
|
|
189
|
-
| deviceModel | `string` | Device model name |
|
|
190
182
|
| interactionMode | `number \| undefined` | Raw Android interaction mode (0, 1, 2, or -1) |
|
|
191
183
|
|
|
192
184
|
## Platform Support
|
|
@@ -275,5 +267,3 @@ MIT
|
|
|
275
267
|
- Readme is edited using [Typora](https://typora.io/)
|
|
276
268
|
|
|
277
269
|
---
|
|
278
|
-
|
|
279
|
-
Made with ❤️ by [JairajJangle](https://github.com/JairajJangle)
|
|
@@ -34,13 +34,7 @@ class NavigationModeModule(reactContext: ReactApplicationContext) :
|
|
|
34
34
|
|
|
35
35
|
val gestureNavEnabled = isGestureNavigationEnabled(context)
|
|
36
36
|
result.putBoolean("isGestureNavigation", gestureNavEnabled)
|
|
37
|
-
|
|
38
|
-
val hasNavigationBar = hasNavigationBar(context)
|
|
39
|
-
result.putBoolean("hasNavigationBar", hasNavigationBar)
|
|
40
|
-
|
|
41
|
-
result.putInt("sdkVersion", Build.VERSION.SDK_INT)
|
|
42
|
-
result.putString("deviceModel", Build.MODEL)
|
|
43
|
-
|
|
37
|
+
|
|
44
38
|
promise.resolve(result)
|
|
45
39
|
} catch (e: Exception) {
|
|
46
40
|
promise.reject("NAVIGATION_MODE_ERROR", "Failed to get navigation mode: ${e.message}", e)
|
|
@@ -99,19 +93,4 @@ class NavigationModeModule(reactContext: ReactApplicationContext) :
|
|
|
99
93
|
}
|
|
100
94
|
} else false
|
|
101
95
|
}
|
|
102
|
-
|
|
103
|
-
private fun hasNavigationBar(context: Context): Boolean {
|
|
104
|
-
return try {
|
|
105
|
-
val resources = context.resources
|
|
106
|
-
val resourceId = resources.getIdentifier("config_showNavigationBar", "bool", "android")
|
|
107
|
-
|
|
108
|
-
if (resourceId > 0) {
|
|
109
|
-
resources.getBoolean(resourceId)
|
|
110
|
-
} else {
|
|
111
|
-
!ViewConfiguration.get(context).hasPermanentMenuKey()
|
|
112
|
-
}
|
|
113
|
-
} catch (e: Exception) {
|
|
114
|
-
true
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
96
|
}
|
package/ios/NavigationMode.mm
CHANGED
|
@@ -9,10 +9,7 @@ RCT_EXPORT_MODULE()
|
|
|
9
9
|
// iOS always uses gesture navigation - handled in TypeScript
|
|
10
10
|
NSDictionary *result = @{
|
|
11
11
|
@"type": @"gesture",
|
|
12
|
-
@"isGestureNavigation": @YES
|
|
13
|
-
@"hasNavigationBar": @NO,
|
|
14
|
-
@"sdkVersion": @([[NSProcessInfo processInfo] operatingSystemVersion].majorVersion),
|
|
15
|
-
@"deviceModel": @"iOS"
|
|
12
|
+
@"isGestureNavigation": @YES
|
|
16
13
|
};
|
|
17
14
|
resolve(result);
|
|
18
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeNavigationMode.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeNavigationMode.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAalD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,gBAAgB,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -12,10 +12,7 @@ export function getNavigationMode() {
|
|
|
12
12
|
// iOS always uses gesture navigation (no 3-button navigation exists)
|
|
13
13
|
return Promise.resolve({
|
|
14
14
|
type: 'gesture',
|
|
15
|
-
isGestureNavigation: true
|
|
16
|
-
hasNavigationBar: false,
|
|
17
|
-
sdkVersion: parseInt(Platform.Version, 10),
|
|
18
|
-
deviceModel: 'iOS'
|
|
15
|
+
isGestureNavigation: true
|
|
19
16
|
});
|
|
20
17
|
}
|
|
21
18
|
return NavigationModeModule.getNavigationMode();
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","React","NavigationModeModule","getNavigationMode","OS","Promise","resolve","type","isGestureNavigation","
|
|
1
|
+
{"version":3,"names":["Platform","React","NavigationModeModule","getNavigationMode","OS","Promise","resolve","type","isGestureNavigation","useNavigationMode","navigationMode","setNavigationMode","useState","loading","setLoading","error","setError","useEffect","mounted","fetchNavigationMode","mode","err","Error"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,oBAAoB,MAEpB,2BAAwB;AAI/B;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAA,EAAgC;EAC/D,IAAIH,QAAQ,CAACI,EAAE,KAAK,KAAK,EAAE;IACzB;IACA,OAAOC,OAAO,CAACC,OAAO,CAAC;MACrBC,IAAI,EAAE,SAAS;MACfC,mBAAmB,EAAE;IACvB,CAAC,CAAC;EACJ;EAEA,OAAON,oBAAoB,CAACC,iBAAiB,CAAC,CAAC;AACjD;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASK,mBAAmBA,CAAA,EAAqB;EACtD,IAAIR,QAAQ,CAACI,EAAE,KAAK,KAAK,EAAE;IACzB;IACA,OAAOC,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC;EAC9B;EAEA,OAAOJ,oBAAoB,CAACM,mBAAmB,CAAC,CAAC;AACnD;;AAEA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAA,EAAG;EAClC,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GACvCV,KAAK,CAACW,QAAQ,CAA4B,IAAI,CAAC;EACjD,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGb,KAAK,CAACW,QAAQ,CAAC,IAAI,CAAC;EAClD,MAAM,CAACG,KAAK,EAAEC,QAAQ,CAAC,GAAGf,KAAK,CAACW,QAAQ,CAAe,IAAI,CAAC;EAE5DX,KAAK,CAACgB,SAAS,CAAC,MAAM;IACpB,IAAIC,OAAO,GAAG,IAAI;IAElB,eAAeC,mBAAmBA,CAAA,EAAG;MACnC,IAAI;QACF,MAAMC,IAAI,GAAG,MAAMjB,iBAAiB,CAAC,CAAC;QACtC,IAAIe,OAAO,EAAE;UACXP,iBAAiB,CAACS,IAAI,CAAC;UACvBJ,QAAQ,CAAC,IAAI,CAAC;QAChB;MACF,CAAC,CAAC,OAAOK,GAAG,EAAE;QACZ,IAAIH,OAAO,EAAE;UACXF,QAAQ,CAACK,GAAG,YAAYC,KAAK,GAAGD,GAAG,GAAG,IAAIC,KAAK,CAAC,eAAe,CAAC,CAAC;QACnE;MACF,CAAC,SAAS;QACR,IAAIJ,OAAO,EAAE;UACXJ,UAAU,CAAC,KAAK,CAAC;QACnB;MACF;IACF;IAEAK,mBAAmB,CAAC,CAAC;IAErB,OAAO,MAAM;MACXD,OAAO,GAAG,KAAK;IACjB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IAAER,cAAc;IAAEG,OAAO;IAAEE;EAAM,CAAC;AAC3C;AAEA,eAAe;EACbZ,iBAAiB;EACjBK,mBAAmB;EACnBC;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { TurboModule } from 'react-native';
|
|
2
2
|
export interface NavigationModeInfo {
|
|
3
|
-
interactionMode?: number;
|
|
4
3
|
type: '3_button' | '2_button' | 'gesture' | 'unknown';
|
|
5
4
|
isGestureNavigation: boolean;
|
|
6
|
-
|
|
7
|
-
sdkVersion: number;
|
|
8
|
-
deviceModel: string;
|
|
5
|
+
interactionMode?: number;
|
|
9
6
|
}
|
|
10
7
|
export interface Spec extends TurboModule {
|
|
11
8
|
getNavigationMode(): Promise<NavigationModeInfo>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeNavigationMode.d.ts","sourceRoot":"","sources":["../../../src/NativeNavigationMode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,kBAAkB;IACjC,
|
|
1
|
+
{"version":3,"file":"NativeNavigationMode.d.ts","sourceRoot":"","sources":["../../../src/NativeNavigationMode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IACtD,mBAAmB,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,iBAAiB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjD,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACzC;;AAED,wBAAwE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAA6B,EAC3B,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAA6B,EAC3B,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAU/D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAOtD;AAED;;GAEG;AACH,wBAAgB,iBAAiB;;;;EAmChC;;;;;;AAED,wBAIW"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-navigation-mode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Detect Android navigation mode (3-button, 2-button, or gesture)",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -58,14 +58,15 @@
|
|
|
58
58
|
"type": "git",
|
|
59
59
|
"url": "git+https://github.com/JairajJangle/react-native-navigation-mode.git"
|
|
60
60
|
},
|
|
61
|
-
"author": "
|
|
61
|
+
"author": "https://github.com/JairajJangle",
|
|
62
62
|
"license": "MIT",
|
|
63
63
|
"bugs": {
|
|
64
64
|
"url": "https://github.com/JairajJangle/react-native-navigation-mode/issues"
|
|
65
65
|
},
|
|
66
66
|
"homepage": "https://github.com/JairajJangle/react-native-navigation-mode#readme",
|
|
67
67
|
"publishConfig": {
|
|
68
|
-
"registry": "https://registry.npmjs.org/"
|
|
68
|
+
"registry": "https://registry.npmjs.org/",
|
|
69
|
+
"provenance": true
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
71
72
|
"@commitlint/config-conventional": "^19.6.0",
|
|
@@ -78,6 +79,10 @@
|
|
|
78
79
|
"@react-native/babel-preset": "0.79.2",
|
|
79
80
|
"@react-native/eslint-config": "^0.78.0",
|
|
80
81
|
"@release-it/conventional-changelog": "^9.0.2",
|
|
82
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
83
|
+
"@semantic-release/git": "^10.0.1",
|
|
84
|
+
"@semantic-release/github": "^11.0.1",
|
|
85
|
+
"@semantic-release/npm": "^12.0.1",
|
|
81
86
|
"@types/jest": "^29.5.5",
|
|
82
87
|
"@types/react": "^19.0.0",
|
|
83
88
|
"commitlint": "^19.6.1",
|
|
@@ -88,15 +93,16 @@
|
|
|
88
93
|
"jest": "^29.7.0",
|
|
89
94
|
"prettier": "^3.0.3",
|
|
90
95
|
"react": "19.0.0",
|
|
91
|
-
"react-native": "0.79.
|
|
96
|
+
"react-native": "0.79.3",
|
|
92
97
|
"react-native-builder-bob": "^0.40.11",
|
|
93
98
|
"release-it": "^17.10.0",
|
|
99
|
+
"semantic-release": "^24.1.0",
|
|
94
100
|
"turbo": "^1.10.7",
|
|
95
101
|
"typescript": "^5.8.3"
|
|
96
102
|
},
|
|
97
103
|
"peerDependencies": {
|
|
98
104
|
"react": "*",
|
|
99
|
-
"react-native": "
|
|
105
|
+
"react-native": ">=0.77.0"
|
|
100
106
|
},
|
|
101
107
|
"workspaces": [
|
|
102
108
|
"example"
|
|
@@ -2,12 +2,9 @@ import type { TurboModule } from 'react-native';
|
|
|
2
2
|
import { TurboModuleRegistry } from 'react-native';
|
|
3
3
|
|
|
4
4
|
export interface NavigationModeInfo {
|
|
5
|
-
interactionMode?: number;
|
|
6
5
|
type: '3_button' | '2_button' | 'gesture' | 'unknown';
|
|
7
6
|
isGestureNavigation: boolean;
|
|
8
|
-
|
|
9
|
-
sdkVersion: number;
|
|
10
|
-
deviceModel: string;
|
|
7
|
+
interactionMode?: number;
|
|
11
8
|
}
|
|
12
9
|
|
|
13
10
|
export interface Spec extends TurboModule {
|
package/src/index.tsx
CHANGED
|
@@ -16,9 +16,6 @@ export function getNavigationMode(): Promise<NavigationModeInfo> {
|
|
|
16
16
|
return Promise.resolve({
|
|
17
17
|
type: 'gesture',
|
|
18
18
|
isGestureNavigation: true,
|
|
19
|
-
hasNavigationBar: false,
|
|
20
|
-
sdkVersion: parseInt(Platform.Version as string, 10),
|
|
21
|
-
deviceModel: 'iOS',
|
|
22
19
|
});
|
|
23
20
|
}
|
|
24
21
|
|