Skip to content

Commit 9efecb6

Browse files
committed
fix: Type error breaking RN 0.77 build due to Kotlin v2
- Verified compatibility with Old & New Architecture.
1 parent ef001e4 commit 9efecb6

9 files changed

Lines changed: 327 additions & 137 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/
1414
- This library shouldn't care about where the media comes from and the fact that `StorageVolumesDirectoryPaths` might not return everything.
1515
- Will be removed in `v1.0.0`.
1616

17+
### 🛠️ Fixes
18+
19+
- Fixed type errors breaking React Native 0.77 builds caused by upgrading Kotlin to v2.0 from v1.9.
20+
1721
### Other
1822

1923
- Validate that the New Architecture works in the example app.

android/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
MetadataRetriever_kotlinVersion=1.9.25
1+
MetadataRetriever_kotlinVersion=2.0.21
22
MetadataRetriever_minSdkVersion=24
33
MetadataRetriever_targetSdkVersion=34
44
MetadataRetriever_compileSdkVersion=35
5-
MetadataRetriever_ndkversion=26.1.10909125
5+
MetadataRetriever_ndkversion=27.1.12297006

android/src/main/java/com/cyanchill/missingcore/metadataretriever/MetadataRetrieverModule.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class MetadataRetrieverModule internal constructor(reactContext: ReactApplicatio
4040
// Populate return object with default values based on input.
4141
val metadataMap = Arguments.createMap()
4242
for (i in 0 until options.size()) {
43-
metadataMap.putNull(options.getString(i))
43+
metadataMap.putNull(options.getString(i) as String)
4444
}
4545

4646
try {
@@ -60,7 +60,7 @@ class MetadataRetrieverModule internal constructor(reactContext: ReactApplicatio
6060
var recheckBitRate = false
6161
// Populate return object with the metadata we found.
6262
for (i in 0 until options.size()) {
63-
val field = options.getString(i)
63+
val field = options.getString(i) as String
6464
val fieldData = when (mmrMetadata) {
6565
null -> readMediaMetadataField(mediaMetadata, field, uri)
6666
else -> readMMRField(mmrMetadata, field)

examples/benchmarking-demo/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ buildscript {
66
minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '24')
77
compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '35')
88
targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')
9-
kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.25'
9+
kotlinVersion = findProperty('android.kotlinVersion') ?: '2.0.21'
1010

11-
ndkVersion = "26.1.10909125"
11+
ndkVersion = "27.1.12297006"
1212
}
1313
repositories {
1414
google()

examples/benchmarking-demo/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
3535
# your application. You should enable this flag either if you want
3636
# to write custom TurboModules/Fabric components OR use libraries that
3737
# are providing them.
38-
newArchEnabled=true
38+
newArchEnabled=false
3939

4040
# Use this property to enable or disable the Hermes JS engine.
4141
# If set to false, you will be using JSC instead.

examples/benchmarking-demo/app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
}
3030
]
3131
],
32-
"newArchEnabled": true
32+
"newArchEnabled": false
3333
}
3434
}

examples/benchmarking-demo/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
"@shopify/flash-list": "^1.8.0",
1515
"@tanstack/react-query": "^5.76.2",
1616
"expo": "~52.0.46",
17-
"expo-build-properties": "^0.13.3",
18-
"expo-image": "^2.0.7",
19-
"expo-media-library": "^17.0.6",
20-
"expo-status-bar": "^2.0.0",
21-
"react": "18.3.1",
22-
"react-native": "0.76.9",
17+
"expo-build-properties": "~0.13.3",
18+
"expo-image": "~2.0.7",
19+
"expo-media-library": "~17.0.6",
20+
"expo-status-bar": "~2.0.0",
21+
"react": "^18.3.1",
22+
"react-native": "^0.77.2",
2323
"react-native-safe-area-context": "^5.4.1"
2424
},
2525
"devDependencies": {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
},
5656
"homepage": "https://github.com/MissingCore/react-native-metadata-retriever#readme",
5757
"devDependencies": {
58-
"@react-native/eslint-config": "^0.76.9",
58+
"@react-native/eslint-config": "^0.77.2",
5959
"@release-it/keep-a-changelog": "^7.0.0",
6060
"@types/jest": "^29.5.14",
6161
"@types/react": "^18.3.22",
@@ -65,8 +65,8 @@
6565
"eslint-plugin-prettier": "^5.4.0",
6666
"jest": "^29.7.0",
6767
"prettier": "^3.5.3",
68-
"react": "18.3.1",
69-
"react-native": "0.76.9",
68+
"react": "^18.3.1",
69+
"react-native": "^0.77.2",
7070
"react-native-builder-bob": "^0.40.11",
7171
"release-it": "^19.0.2",
7272
"release-it-pnpm": "^4.6.5",

pnpm-lock.yaml

Lines changed: 306 additions & 120 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)