зеркало из https://github.com/microsoft/rnx-kit.git
fix: migrate away from deprecated `TurboReactPackage` (#3430)
This commit is contained in:
Родитель
e6ff3a43f0
Коммит
dd56196b7c
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
"@react-native-webapis/battery-status": minor
|
||||
"@react-native-webapis/web-storage": minor
|
||||
"@rnx-kit/react-native-test-app-msal": major
|
||||
---
|
||||
|
||||
Migrate away from deprecated `TurboReactPackage`. This is a requirement for
|
||||
supporting 0.77 and above.
|
|
@ -1,30 +1,28 @@
|
|||
package org.reactnativewebapis.batterystatus
|
||||
|
||||
import com.facebook.react.TurboReactPackage
|
||||
import com.facebook.react.BaseReactPackage
|
||||
import com.facebook.react.bridge.NativeModule
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.module.model.ReactModuleInfo
|
||||
import com.facebook.react.module.model.ReactModuleInfoProvider
|
||||
|
||||
class BatteryStatusPackage : TurboReactPackage() {
|
||||
override fun getModule(name: String?, reactContext: ReactApplicationContext?): NativeModule {
|
||||
return when (name) {
|
||||
class BatteryStatusPackage : BaseReactPackage() {
|
||||
override fun getModule(name: String?, reactContext: ReactApplicationContext?): NativeModule =
|
||||
when (name) {
|
||||
BatteryStatusModule.NAME -> BatteryStatusModule(reactContext)
|
||||
else -> throw IllegalArgumentException("No module named '$name'")
|
||||
}
|
||||
}
|
||||
|
||||
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider =
|
||||
ReactModuleInfoProvider {
|
||||
val info = ReactModuleInfo(
|
||||
BatteryStatusModule.NAME,
|
||||
BatteryStatusModule::class.java.name,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
)
|
||||
mapOf(info.name() to info).toMutableMap()
|
||||
}
|
||||
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider {
|
||||
val info = ReactModuleInfo(
|
||||
BatteryStatusModule.NAME,
|
||||
BatteryStatusModule::class.java.name,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
)
|
||||
mapOf(info.name() to info).toMutableMap()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=18.2.0",
|
||||
"react-native": ">=0.71.0-0"
|
||||
"react-native": ">=0.74.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.0",
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
package org.reactnativewebapis.webstorage
|
||||
|
||||
import com.facebook.react.TurboReactPackage
|
||||
import com.facebook.react.BaseReactPackage
|
||||
import com.facebook.react.bridge.NativeModule
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.module.model.ReactModuleInfo
|
||||
import com.facebook.react.module.model.ReactModuleInfoProvider
|
||||
|
||||
class WebStoragePackage : TurboReactPackage() {
|
||||
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule {
|
||||
return when (name) {
|
||||
class WebStoragePackage : BaseReactPackage() {
|
||||
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule =
|
||||
when (name) {
|
||||
WebStorageModule.NAME -> WebStorageModule(reactContext)
|
||||
else -> throw IllegalArgumentException("No module named '$name'")
|
||||
}
|
||||
}
|
||||
|
||||
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider {
|
||||
val info = ReactModuleInfo(
|
||||
|
|
|
@ -35,11 +35,11 @@
|
|||
"lint:kt": "ktlint --relative 'android/src/**/*.kt'"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@callstack/react-native-visionos": ">=0.73",
|
||||
"@callstack/react-native-visionos": ">=0.74",
|
||||
"react": ">=18.2.0",
|
||||
"react-native": ">=0.72",
|
||||
"react-native-macos": ">=0.72",
|
||||
"react-native-windows": ">=0.72"
|
||||
"react-native": ">=0.74",
|
||||
"react-native-macos": ">=0.74",
|
||||
"react-native-windows": ">=0.74"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@callstack/react-native-visionos": {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.microsoft.reacttestapp.msal
|
||||
|
||||
import com.facebook.react.TurboReactPackage
|
||||
import com.facebook.react.BaseReactPackage
|
||||
import com.facebook.react.bridge.NativeModule
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.module.model.ReactModuleInfoProvider
|
||||
|
||||
class MsalPackage : TurboReactPackage() {
|
||||
class MsalPackage : BaseReactPackage() {
|
||||
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule {
|
||||
val info = ReactNativeAuthModuleProvider.info()
|
||||
?: throw IllegalArgumentException("No modules were ever registered")
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -3274,7 +3274,7 @@ __metadata:
|
|||
typescript: "npm:^5.0.0"
|
||||
peerDependencies:
|
||||
react: ">=18.2.0"
|
||||
react-native: ">=0.71.0-0"
|
||||
react-native: ">=0.74.0"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
|
@ -3296,11 +3296,11 @@ __metadata:
|
|||
react-native-windows: "npm:^0.75.0"
|
||||
typescript: "npm:^5.0.0"
|
||||
peerDependencies:
|
||||
"@callstack/react-native-visionos": ">=0.73"
|
||||
"@callstack/react-native-visionos": ">=0.74"
|
||||
react: ">=18.2.0"
|
||||
react-native: ">=0.72"
|
||||
react-native-macos: ">=0.72"
|
||||
react-native-windows: ">=0.72"
|
||||
react-native: ">=0.74"
|
||||
react-native-macos: ">=0.74"
|
||||
react-native-windows: ">=0.74"
|
||||
peerDependenciesMeta:
|
||||
"@callstack/react-native-visionos":
|
||||
optional: true
|
||||
|
|
Загрузка…
Ссылка в новой задаче