Skip to content

Commit 915da37

Browse files
authored
fix(#124): developers field in Android getLibrariesAsync to be incorrectly serialized (#131)
1 parent f3a8d1f commit 915da37

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

.changeset/small-flowers-sin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-native-legal": patch
3+
---
4+
5+
Fix "developers" field returned on Android platform to be stringified in a non reversible way, instead of being returned as an array

packages/react-native-legal/android/src/main/java/com/reactnativelegal/ReactNativeLegalModuleImpl.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ object ReactNativeLegalModuleImpl {
4747
"version" to library.artifactVersion,
4848
"description" to library.description,
4949
"website" to library.website,
50-
"developers" to library.developers.joinToString(),
50+
"developers" to
51+
library.developers.map { developer ->
52+
bundleOf(
53+
"name" to developer.name,
54+
"organisationUrl" to developer.organisationUrl,
55+
)
56+
},
5157
"organization" to library.organization?.name,
5258
"licenses" to
5359
library.licenses.map { license ->

packages/react-native-legal/src/NativeReactNativeLegal.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import type { TurboModule } from 'react-native';
22
import { TurboModuleRegistry } from 'react-native';
33

4+
export interface Developer {
5+
name?: string;
6+
organisationUrl?: string;
7+
}
8+
49
export interface License {
510
licenseContent: string;
611
/**
@@ -29,7 +34,7 @@ export interface Library {
2934
/**
3035
* @platform Android
3136
*/
32-
developers?: string;
37+
developers?: Developer[];
3338
/**
3439
* @platform Android
3540
*/

0 commit comments

Comments
 (0)