diff --git a/babel.config.js b/babel.config.js index 80ce241fcc..cafccd5f22 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,3 @@ module.exports = { - presets: ['module:metro-react-native-babel-preset'], + presets: ['module:@react-native/babel-preset'], }; diff --git a/package.json b/package.json index 73a6beabd5..da59acc85a 100644 --- a/package.json +++ b/package.json @@ -98,19 +98,19 @@ "@types/tar": "6.1.5", "@typescript-eslint/eslint-plugin": "^5.4.0", "@typescript-eslint/parser": "^5.4.0", - "babel-jest": "29.2.1", + "babel-jest": "29.6.3", "babel-plugin-module-resolver": "^5.0.0", "deepmerge": "3.2.0", "eslint": "8.19.0", "eslint-config-prettier": "8.8.0", "eslint-plugin-react": "7.33.2", "husky": "^7.0.0", - "jest": "29.2.1", + "jest": "^29.6.3", "jest-environment-jsdom": "29.7.0", "lerna": "^6.6.2", "lint-staged": "12.3.4", "madge": "6.1.0", - "prettier": "2.3.1", + "prettier": "2.8.8", "rimraf": "5.0.5", "ts-jest": "^27.0.7", "ts-node": "^10.9.1", diff --git a/packages/app-harness/Gemfile b/packages/app-harness/Gemfile index 286387f326..c63d554a93 100644 --- a/packages/app-harness/Gemfile +++ b/packages/app-harness/Gemfile @@ -3,7 +3,7 @@ source 'https://rubygems.org' # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version ruby ">= 2.6.10" -gem 'cocoapods', '~> 1.12', '< 1.15' +gem 'cocoapods', '~> 1.13', '< 1.15' gem 'activesupport', '~> 7.0', '<= 7.0.8' gem 'cocoapods-user-defined-build-types' diff --git a/packages/app-harness/Gemfile.lock b/packages/app-harness/Gemfile.lock index 4aede4616d..515700a78a 100644 --- a/packages/app-harness/Gemfile.lock +++ b/packages/app-harness/Gemfile.lock @@ -92,7 +92,7 @@ PLATFORMS DEPENDENCIES activesupport (~> 7.0, <= 7.0.8) - cocoapods (~> 1.12, < 1.15) + cocoapods (~> 1.13, < 1.15) cocoapods-user-defined-build-types RUBY VERSION diff --git a/packages/app-harness/appConfigs/harness/builds/android/app/src/main/java/rnv_template/MyAppPackage.kt b/packages/app-harness/appConfigs/harness/builds/android/app/src/main/java/rnv_template/MyAppPackage.kt new file mode 100644 index 0000000000..6164e71797 --- /dev/null +++ b/packages/app-harness/appConfigs/harness/builds/android/app/src/main/java/rnv_template/MyAppPackage.kt @@ -0,0 +1,19 @@ +package {{APPLICATION_ID}} + +import android.view.View +import com.facebook.react.ReactPackage +import com.facebook.react.bridge.NativeModule +import com.facebook.react.bridge.ReactApplicationContext +import com.facebook.react.uimanager.ReactShadowNode +import com.facebook.react.uimanager.ViewManager + +class MyAppPackage : ReactPackage { + + override fun createViewManagers( + reactContext: ReactApplicationContext + ): MutableList>> = mutableListOf() + + override fun createNativeModules( + reactContext: ReactApplicationContext + ): MutableList = listOf(TestNativeModule(reactContext)).toMutableList() +} \ No newline at end of file diff --git a/packages/app-harness/appConfigs/harness/builds/android/app/src/main/java/rnv_template/TestNativeModule.kt b/packages/app-harness/appConfigs/harness/builds/android/app/src/main/java/rnv_template/TestNativeModule.kt new file mode 100644 index 0000000000..e690fd9c30 --- /dev/null +++ b/packages/app-harness/appConfigs/harness/builds/android/app/src/main/java/rnv_template/TestNativeModule.kt @@ -0,0 +1,20 @@ +package {{APPLICATION_ID}} + +import com.facebook.react.bridge.NativeModule +import com.facebook.react.bridge.ReactApplicationContext +import com.facebook.react.bridge.ReactContext +import com.facebook.react.bridge.ReactContextBaseJavaModule +import com.facebook.react.bridge.ReactMethod +import com.facebook.react.bridge.Callback + + +class TestNativeModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) { +override fun getName() = "TestNativeModule" + +@ReactMethod +fun createTestEvent(name: String, location: String, callback:Callback) { + var result = "Event called with name: $name and location: $location" + callback.invoke(null, result) +} + +} \ No newline at end of file diff --git a/packages/app-harness/package.json b/packages/app-harness/package.json index a7f148b8aa..618458ef79 100644 --- a/packages/app-harness/package.json +++ b/packages/app-harness/package.json @@ -42,18 +42,19 @@ "@lightningjs/sdk": "^5.4.1", "@react-native-firebase/app": "18.6.1", "@rnv/renative": "1.0.0-rc.11", - "next": "14.0.4", + "next": "14.1.0", "raf": "3.4.1", "react": "18.2.0", "react-art": "18.2.0", "react-dom": "18.2.0", - "react-native": "0.72.4", + "react-native": "0.73.4", "react-native-carplay": "2.3.0", - "react-native-gesture-handler": "2.13.1", + "react-native-gesture-handler": "2.14.1", "react-native-permissions": "3.10.1", "react-native-photo-editor": "1.0.13", "react-native-splash-screen": "3.3.0", - "react-native-tvos": "0.72.4-0", + "react-native-orientation-locker": "1.5.0", + "react-native-tvos": "0.73.1-3", "react-native-web": "0.19.9" }, "devDependencies": { @@ -67,10 +68,10 @@ "@rnv/engine-rn-tvos": "1.0.0-rc.11", "@rnv/engine-rn-web": "1.0.0-rc.11", "@rnv/template-starter": "1.0.0-rc.11", - "@types/react": "18.2.22", - "@types/react-dom": "18.2.7", + "@types/react": "18.2.52", + "@types/react-dom": "18.2.18", "@types/react-native": "0.72.2", - "babel-jest": "29.2.1", + "babel-jest": "29.6.3", "babel-loader": "9.1.3", "detox": "18.20.2", "jetifier": "2.0.0", diff --git a/packages/app-harness/renative.json b/packages/app-harness/renative.json index cd63ee2763..1ad8b40164 100644 --- a/packages/app-harness/renative.json +++ b/packages/app-harness/renative.json @@ -10,12 +10,8 @@ "android": { "templateAndroid": { "MainActivity_java": { - "createMethods": [ - "SplashScreen.show(this)" - ], - "imports": [ - "org.devio.rn.splashscreen.SplashScreen" - ] + "createMethods": ["SplashScreen.show(this)"], + "imports": ["org.devio.rn.splashscreen.SplashScreen"] } }, "package": "org.devio.rn.splashscreen.SplashScreenReactPackage" @@ -23,14 +19,10 @@ "ios": { "templateXcode": { "AppDelegate_mm": { - "appDelegateImports": [ - "RNSplashScreen.h" - ], + "appDelegateImports": ["RNSplashScreen.h"], "appDelegateMethods": { "application": { - "didFinishLaunchingWithOptions": [ - "[RNSplashScreen show]" - ] + "didFinishLaunchingWithOptions": ["[RNSplashScreen show]"] } } } @@ -42,30 +34,31 @@ }, "version": "3.3.0" }, + "TestNativeModule": { + "android": { + "templateAndroid": { + "MainApplication_java": { + "packages": ["MyAppPackage"] + } + }, + "forceLinking": true + } + }, "react-native-carplay": { "ios": { "templateXcode": { "AppDelegate_h": { - "appDelegateImports": [ - "CarPlay/CarPlay.h" - ], - "appDelegateExtensions": [ - "UIApplicationDelegate", - "CPApplicationDelegate" - ] + "appDelegateImports": ["CarPlay/CarPlay.h"], + "appDelegateExtensions": ["UIApplicationDelegate", "CPApplicationDelegate"] }, "AppDelegate_mm": { - "appDelegateImports": [ - "RNCarPlay.h" - ], + "appDelegateImports": ["RNCarPlay.h"], "appDelegateMethods": { "application": { "didConnectCarInterfaceController": [ "[RNCarPlay connectWithInterfaceController:interfaceController window:window]" ], - "didDisconnectCarInterfaceController": [ - "[RNCarPlay disconnect]" - ] + "didDisconnectCarInterfaceController": ["[RNCarPlay disconnect]"] } } } @@ -92,9 +85,7 @@ ], "templateXcode": { "Podfile": { - "header": [ - "$RNFirebaseAsStaticFramework = true" - ] + "header": ["$RNFirebaseAsStaticFramework = true"] } } } @@ -159,4 +150,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/app-harness/src/app/NewModuleButton.tsx b/packages/app-harness/src/app/NewModuleButton.tsx new file mode 100644 index 0000000000..8e489125eb --- /dev/null +++ b/packages/app-harness/src/app/NewModuleButton.tsx @@ -0,0 +1,19 @@ +import React from 'react'; +import { NativeModules, Button } from 'react-native'; + +const NewModuleButton = () => { + const { TestNativeModule } = NativeModules; + const callback = (error: any, result: string) => { + if (error) { + console.log(error); + } else { + console.log(result); + } + }; + const onPress = () => { + TestNativeModule.createTestEvent('testName', 'testLocation', callback); + }; + return