react-native-legal 1.6.2 → 1.6.4

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.
@@ -2,13 +2,17 @@ package com.reactnativelegal
2
2
 
3
3
  import android.content.pm.PackageManager
4
4
  import android.content.res.Configuration
5
+ import android.graphics.Color
6
+ import android.os.Build
5
7
  import android.os.Bundle
6
8
  import android.view.MenuItem
7
9
  import android.view.View
10
+ import android.view.WindowManager
8
11
  import androidx.appcompat.app.AppCompatActivity
9
12
  import androidx.appcompat.widget.Toolbar
10
13
  import androidx.core.view.WindowCompat
11
14
  import androidx.core.view.WindowInsetsCompat
15
+ import androidx.core.view.WindowInsetsControllerCompat
12
16
  import androidx.core.view.updatePadding
13
17
  import com.mikepenz.aboutlibraries.LibsBuilder.Companion.BUNDLE_TITLE
14
18
  import com.mikepenz.aboutlibraries.ui.LibsSupportFragment
@@ -25,14 +29,7 @@ class ReactNativeLegalActivity : AppCompatActivity() {
25
29
  super.onCreate(savedInstanceState)
26
30
  setContentView(R.layout.activity_licenses)
27
31
 
28
- val isLightTheme =
29
- resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK !=
30
- Configuration.UI_MODE_NIGHT_YES
31
-
32
- WindowCompat.getInsetsController(window, window.decorView).apply {
33
- isAppearanceLightStatusBars = isLightTheme
34
- isAppearanceLightNavigationBars = isLightTheme
35
- }
32
+ setupEdgeToEdge()
36
33
 
37
34
  val bundle = intent.extras
38
35
  fragment = LibsSupportFragment().apply { arguments = bundle }
@@ -83,9 +80,9 @@ class ReactNativeLegalActivity : AppCompatActivity() {
83
80
  WindowInsetsCompat.toWindowInsetsCompat(insets)
84
81
  .getInsets(WindowInsetsCompat.Type.systemBars())
85
82
  v.updatePadding(
86
- left = v.paddingLeft + systemInsets.left,
87
- top = v.paddingTop + systemInsets.top,
88
- right = v.paddingRight + systemInsets.right,
83
+ left = systemInsets.left,
84
+ top = systemInsets.top,
85
+ right = systemInsets.right,
89
86
  )
90
87
 
91
88
  insets
@@ -106,4 +103,46 @@ class ReactNativeLegalActivity : AppCompatActivity() {
106
103
  )
107
104
  }
108
105
  }
106
+
107
+ /**
108
+ * Based on React Native's edge-to-edge util
109
+ * https://github.com/facebook/react-native/blob/6e7797d5ab1af6bab8d94b1c1ad62dddc1ec5474/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/WindowUtil.kt#L106
110
+ */
111
+ private fun setupEdgeToEdge() {
112
+ WindowCompat.setDecorFitsSystemWindows(window, false)
113
+
114
+ val isLightTheme =
115
+ resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK !=
116
+ Configuration.UI_MODE_NIGHT_YES
117
+
118
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
119
+ window.isStatusBarContrastEnforced = false
120
+ window.isNavigationBarContrastEnforced = true
121
+ }
122
+
123
+ window.statusBarColor = Color.TRANSPARENT
124
+ window.navigationBarColor =
125
+ when {
126
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q -> Color.TRANSPARENT
127
+ // https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/com/android/internal/policy/DecorView.java;drc=6ef0f022c333385dba2c294e35b8de544455bf19;l=142
128
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && isLightTheme ->
129
+ Color.argb(0xe6, 0xFF, 0xFF, 0xFF)
130
+ // https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/res/remote_color_resources_res/values/colors.xml;l=67
131
+ else -> Color.argb(0x80, 0x1b, 0x1b, 0x1b)
132
+ }
133
+
134
+ WindowInsetsControllerCompat(window, window.decorView).apply {
135
+ isAppearanceLightStatusBars = isLightTheme
136
+ isAppearanceLightNavigationBars = isLightTheme
137
+ }
138
+
139
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
140
+ window.attributes.layoutInDisplayCutoutMode =
141
+ when {
142
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.R ->
143
+ WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
144
+ else -> WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
145
+ }
146
+ }
147
+ }
109
148
  }
@@ -13,7 +13,7 @@ const utils_1 = require("./utils");
13
13
  async function addListActivity(androidProjectPath) {
14
14
  const androidManifestPath = path_1.default.join(androidProjectPath, 'app', 'src', 'main', 'AndroidManifest.xml');
15
15
  await (0, utils_1.modifyXMLFileContent)(androidManifestPath, (manifestObj) => {
16
- if (manifestObj.manifest.application?.[0].activity) {
16
+ if (manifestObj.manifest.application?.[0]?.activity) {
17
17
  manifestObj.manifest.application[0].activity = (0, android_1.addListActivityUtil)(manifestObj.manifest.application?.[0].activity);
18
18
  }
19
19
  return manifestObj;
@@ -9,7 +9,7 @@ exports.addToAllPbxResourcesBuildPhases = addToAllPbxResourcesBuildPhases;
9
9
  exports.getIOSProjectName = getIOSProjectName;
10
10
  exports.getIOSPbxProj = getIOSPbxProj;
11
11
  const node_path_1 = __importDefault(require("node:path"));
12
- const glob_1 = __importDefault(require("glob"));
12
+ const glob_1 = require("glob");
13
13
  const xcode_1 = __importDefault(require("xcode"));
14
14
  const ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];
15
15
  /**
@@ -68,7 +68,7 @@ function addToAllPbxResourcesBuildPhases(pbxproj, pbxFile) {
68
68
  * Returns the name of the main group in the project (the main folder where `AppDelegate` usually lives)
69
69
  */
70
70
  function getIOSProjectName(iosProjectPath) {
71
- const [appDelegatePath] = glob_1.default.sync('*/AppDelegate.@(m|mm|swift)', {
71
+ const [appDelegatePath] = glob_1.glob.sync('*/AppDelegate.@(m|mm|swift)', {
72
72
  cwd: iosProjectPath,
73
73
  absolute: true,
74
74
  nocase: true,
@@ -81,7 +81,7 @@ function getIOSProjectName(iosProjectPath) {
81
81
  * Used to grab the XcodeProject instance
82
82
  */
83
83
  function getIOSPbxProj(iosProjectPath) {
84
- const [xcodeprojPath] = glob_1.default.sync('*.xcodeproj', {
84
+ const [xcodeprojPath] = glob_1.glob.sync('*.xcodeproj', {
85
85
  cwd: iosProjectPath,
86
86
  absolute: true,
87
87
  nocase: true,
@@ -11,7 +11,7 @@ export async function addListActivity(androidProjectPath: string) {
11
11
  const androidManifestPath = path.join(androidProjectPath, 'app', 'src', 'main', 'AndroidManifest.xml');
12
12
 
13
13
  await modifyXMLFileContent(androidManifestPath, (manifestObj) => {
14
- if (manifestObj.manifest.application?.[0].activity) {
14
+ if (manifestObj.manifest.application?.[0]?.activity) {
15
15
  manifestObj.manifest.application[0].activity = addListActivityUtil(
16
16
  manifestObj.manifest.application?.[0].activity,
17
17
  );
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path';
2
2
 
3
- import glob from 'glob';
3
+ import { glob } from 'glob';
4
4
  import type { XcodeProject } from 'xcode';
5
5
  import xcode from 'xcode';
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-legal",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "Acknowledge OSS libraries used in your React Native app",
5
5
  "keywords": [
6
6
  "react-native",
@@ -50,16 +50,17 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/glob": "^8.1.0",
53
+ "@types/node": "^24",
53
54
  "@types/xml2js": "^0.4.11",
54
- "expo": "^54.0.0",
55
- "expo-module-scripts": "^5.0.7",
56
- "react": "19.1.0",
57
- "react-native": "0.81.4",
58
- "react-native-builder-bob": "0.40.13"
55
+ "expo": "^56.0.0",
56
+ "expo-module-scripts": "^56.0.0",
57
+ "react": "19.2.3",
58
+ "react-native": "0.85.3",
59
+ "react-native-builder-bob": "0.42.1"
59
60
  },
60
61
  "dependencies": {
61
- "@callstack/licenses": "^0.3.1",
62
- "glob": "^7.1.3",
62
+ "@callstack/licenses": "^0.3.3",
63
+ "glob": "^13.0.0",
63
64
  "xcode": "^3.0.1",
64
65
  "xml2js": "^0.6.2"
65
66
  },
@@ -8,7 +8,7 @@ const android_1 = require("../../../plugin-utils/build/android");
8
8
  */
9
9
  function addListActivity(config) {
10
10
  return (0, config_plugins_1.withAndroidManifest)(config, (exportedConfig) => {
11
- if (exportedConfig.modResults.manifest.application?.[0].activity) {
11
+ if (exportedConfig.modResults.manifest.application?.[0]?.activity) {
12
12
  exportedConfig.modResults.manifest.application[0].activity = (0, android_1.addListActivityUtil)(exportedConfig.modResults.manifest.application[0].activity);
13
13
  }
14
14
  return exportedConfig;
@@ -8,7 +8,7 @@ import { addListActivityUtil } from '../../../plugin-utils/build/android';
8
8
  */
9
9
  export function addListActivity(config: ExpoConfig): ExpoConfig {
10
10
  return withAndroidManifest(config, (exportedConfig) => {
11
- if (exportedConfig.modResults.manifest.application?.[0].activity) {
11
+ if (exportedConfig.modResults.manifest.application?.[0]?.activity) {
12
12
  exportedConfig.modResults.manifest.application[0].activity = addListActivityUtil(
13
13
  exportedConfig.modResults.manifest.application[0].activity,
14
14
  );
@@ -2,7 +2,8 @@
2
2
  "extends": "expo-module-scripts/tsconfig.plugin",
3
3
  "compilerOptions": {
4
4
  "outDir": "build",
5
- "rootDir": "src"
5
+ "rootDir": "src",
6
+ "types": ["node"]
6
7
  },
7
8
  "include": ["./src"],
8
9
  "exclude": ["**/__mocks__/*", "**/__tests__/*"]