Skip to content

Commit

Permalink
Merge pull request #1349 from flexn-io/feat/upgrade_to_rn73
Browse files Browse the repository at this point in the history
Upgrade to RN 73
  • Loading branch information
mihaiblaga89 authored Feb 8, 2024
2 parents b01c7b5 + ec37194 commit 191f0cc
Show file tree
Hide file tree
Showing 110 changed files with 5,826 additions and 6,138 deletions.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
presets: ['module:@react-native/babel-preset'],
};
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-harness/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'

2 changes: 1 addition & 1 deletion packages/app-harness/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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<ViewManager<View, ReactShadowNode<*>>> = mutableListOf()

override fun createNativeModules(
reactContext: ReactApplicationContext
): MutableList<NativeModule> = listOf(TestNativeModule(reactContext)).toMutableList()
}
Original file line number Diff line number Diff line change
@@ -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)
}

}
15 changes: 8 additions & 7 deletions packages/app-harness/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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",
Expand Down
49 changes: 20 additions & 29 deletions packages/app-harness/renative.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,19 @@
"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"
},
"ios": {
"templateXcode": {
"AppDelegate_mm": {
"appDelegateImports": [
"RNSplashScreen.h"
],
"appDelegateImports": ["RNSplashScreen.h"],
"appDelegateMethods": {
"application": {
"didFinishLaunchingWithOptions": [
"[RNSplashScreen show]"
]
"didFinishLaunchingWithOptions": ["[RNSplashScreen show]"]
}
}
}
Expand All @@ -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]"]
}
}
}
Expand All @@ -92,9 +85,7 @@
],
"templateXcode": {
"Podfile": {
"header": [
"$RNFirebaseAsStaticFramework = true"
]
"header": ["$RNFirebaseAsStaticFramework = true"]
}
}
}
Expand Down Expand Up @@ -159,4 +150,4 @@
}
}
}
}
}
19 changes: 19 additions & 0 deletions packages/app-harness/src/app/NewModuleButton.tsx
Original file line number Diff line number Diff line change
@@ -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 <Button title="Click to invoke native module!" color="#841584" onPress={onPress} />;
};

export default NewModuleButton;
32 changes: 27 additions & 5 deletions packages/app-harness/src/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
import React, { useEffect } from 'react';
import { Text, View } from 'react-native';
import { testProps } from '../config';
import React, { useEffect, useState } from 'react';
import { Button, Text, View } from 'react-native';
import SplashScreen from 'react-native-splash-screen';
import NewModuleButton from './NewModuleButton';
import { OrientationLocker, PORTRAIT, LANDSCAPE } from 'react-native-orientation-locker';
import { isPlatformAndroid } from '@rnv/renative';

const App = () => {
const [showVideo, setShowVideo] = useState(false);
useEffect(() => {
SplashScreen.hide();
}, []);
return (
<View>
<Text {...testProps('app-harness-home-screen-intro-text')}>ReNative Harness</Text>
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>ReNative Harness</Text>
<Text>{`hermes: ${typeof HermesInternal === 'object' && HermesInternal !== null ? 'yes' : 'no'}`}</Text>
{isPlatformAndroid ? (
<>
<NewModuleButton />
<OrientationLocker
orientation={PORTRAIT}
onChange={(orientation) => console.log('onChange', orientation)}
onDeviceChange={(orientation) => console.log('onDeviceChange', orientation)}
/>
<Button title="Toggle Video" onPress={() => setShowVideo(!showVideo)} />
{showVideo && (
<View>
<OrientationLocker orientation={LANDSCAPE} />
<View style={{ width: 320, height: 180, backgroundColor: '#ccc' }}>
<Text>Landscape video goes here</Text>
</View>
</View>
)}
</>
) : null}
</View>
);
};
Expand Down
43 changes: 22 additions & 21 deletions packages/app-harness/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"extends": "@flexn/typescript-config/tsconfig.app.json",
"compilerOptions": {
"outDir": "./lib",
"rootDir": ".",
"noImplicitAny": false,
// "resolveJsonModule": false
"plugins": [
{
"name": "next"
}
"extends": "@flexn/typescript-config/tsconfig.app.json",
"compilerOptions": {
"outDir": "./lib",
"rootDir": ".",
"noImplicitAny": false,
// "resolveJsonModule": false
"plugins": [
{
"name": "next"
}
],
"strictNullChecks": true
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"platformBuilds/template_web/.next/types/**/*.ts",
"platformBuilds/harness_web/.next/types/**/*.ts",
".next/types/**/*.ts",
"platformBuilds/harness_web/output/types/**/*.ts"
],
"strictNullChecks": true
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"platformBuilds/template_web/.next/types/**/*.ts",
"platformBuilds/harness_web/.next/types/**/*.ts",
".next/types/**/*.ts",
"platformBuilds/harness_web/output/types/**/*.ts"
]
"exclude": ["**/rn_modules"]
}
13 changes: 12 additions & 1 deletion packages/core/jsonSchema/rnv.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@
},
"buildToolsVersion": {
"type": "string",
"default": "30.0.0",
"default": "34.0.0",
"description": "Override android build tools version"
},
"disableSigning": {
Expand Down Expand Up @@ -3359,6 +3359,11 @@
"default": false,
"description": "Marks plugin platform disabled"
},
"forceLinking": {
"type": "boolean",
"default": false,
"description": "Packages that cannot be autolinked yet can still be added to MainApplication PackageList dynamically by setting this to true"
},
"path": {
"type": "string",
"description": "Enables you to pass custom path to plugin. If undefined, the default `node_modules/[plugin-name]` will be used."
Expand Down Expand Up @@ -3452,6 +3457,9 @@
"disabled": {
"$ref": "#/definitions/rnv.app/properties/plugins/additionalProperties/anyOf/0/properties/android/properties/disabled"
},
"forceLinking": {
"$ref": "#/definitions/rnv.app/properties/plugins/additionalProperties/anyOf/0/properties/android/properties/forceLinking"
},
"path": {
"$ref": "#/definitions/rnv.app/properties/plugins/additionalProperties/anyOf/0/properties/android/properties/path"
},
Expand Down Expand Up @@ -3529,6 +3537,9 @@
"disabled": {
"$ref": "#/definitions/rnv.app/properties/plugins/additionalProperties/anyOf/0/properties/android/properties/disabled"
},
"forceLinking": {
"$ref": "#/definitions/rnv.app/properties/plugins/additionalProperties/anyOf/0/properties/android/properties/forceLinking"
},
"path": {
"$ref": "#/definitions/rnv.app/properties/plugins/additionalProperties/anyOf/0/properties/android/properties/path"
}
Expand Down
Loading

0 comments on commit 191f0cc

Please sign in to comment.