Skip to content

Commit 88a450d

Browse files
update: add support for latest RN & Expo (#323)
- Removed the references to direct RN and make the project use the app installation - Updated the Expo plugin - Added the newest accessibility traits to prevent crashes - Added PrivacyInfo for iOS - Re-created the Podfile following the latest conventions - Removed Telemetry - Updated the TS specifications - Created DynamicUtil for Android to replace the old DynamicFromMap (RN Core) - Bumped Android SDk to 34 - Homologated ARCore to 1.43.0
1 parent d6b51f0 commit 88a450d

File tree

134 files changed

+13956
-10528
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+13956
-10528
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CHANGELOG
22

3+
## v2.42.0 - 7 February 2025
4+
5+
- Compatibility with Expo 52
6+
- Removed Telemetry
7+
- Cleaned codebase
8+
39
## v2.41.1 - 6 March 2024
410

511
- fix(ViroBase): fix onClick not working for <ViroText /> components [`#277`](https://github.com/NativeVision/viro/pull/277)
@@ -100,7 +106,7 @@
100106
- Removing references to fbjs. [`#8`](https://github.com/NativeVision/viro/pull/8)
101107
- fix typo in package.json [`#6`](https://github.com/NativeVision/viro/pull/6)
102108
- Adding NPM publish action [`#4`](https://github.com/NativeVision/viro/pull/4)
103-
- * Removed the star from every pod as when doing pod install it drops … [`#1`](https://github.com/NativeVision/viro/pull/1)
109+
- - Removed the star from every pod as when doing pod install it drops … [`#1`](https://github.com/NativeVision/viro/pull/1)
104110
- First [`4fb045b`](https://github.com/NativeVision/viro/commit/4fb045b7948533abc8787a10981f74b003a3ea68)
105111
- Remove broken scripts [`2d94c22`](https://github.com/NativeVision/viro/commit/2d94c22e0447a655cffbb3ae415ebc111e4d15bc)
106112
- Updating Readme to give better install instructions and moving examples to their own page(#7) [`bee93cc`](https://github.com/NativeVision/viro/commit/bee93cc7a18666294a14eb13606ef4e2f160202a)

android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ buildscript {
77
}
88
jcenter()
99
google()
10+
mavenCentral()
1011
}
1112
dependencies {
1213
classpath 'com.android.tools.build:gradle:8.2.0'
1314
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0"
15+
classpath("com.facebook.react:react-native-gradle-plugin")
1416
// NOTE: Do not place your application dependencies here; they belong
1517
// in the individual module build.gradle files
1618
}
@@ -19,17 +21,15 @@ buildscript {
1921
allprojects {
2022
repositories {
2123
mavenLocal()
22-
maven {
23-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
24-
url "$rootDir/../node_modules/react-native/android"
25-
}
24+
mavenCentral()
2625
maven {
2726
//url 'https://maven.google.com'
2827
// Android JSC is installed from npm
2928
url("$rootDir/../node_modules/jsc-android/dist")
3029
}
3130
google()
3231
jcenter()
32+
3333
maven { url 'https://jitpack.io' }
3434
}
3535
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
#Fri Feb 07 19:36:38 CST 2025
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
4-
networkTimeout=10000
5-
validateDistributionUrl=true
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
65
zipStoreBase=GRADLE_USER_HOME
76
zipStorePath=wrapper/dists
1.61 KB
Binary file not shown.

android/settings.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
include ':gvr_common', ':viro_bridge', ':viro_renderer', ':arcore_client'
1+
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
2+
plugins { id("com.facebook.react.settings") }
3+
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
4+
includeBuild("../node_modules/@react-native/gradle-plugin")
5+
include ':gvr_common', ':viro_bridge', ':viro_renderer', ':arcore_client'

android/viro_bridge/build.gradle

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
apply plugin: 'com.android.library'
22
apply plugin: "kotlin-android"
3+
apply plugin: "com.facebook.react"
34

45
android {
5-
compileSdkVersion 33
6-
buildToolsVersion '30.0.2'
6+
compileSdkVersion 34
77
namespace "com.viromedia.bridge"
88

99
defaultConfig {
@@ -27,10 +27,12 @@ dependencies {
2727
})
2828
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0"
2929

30+
implementation("com.facebook.react:react-android:0.76.0")
31+
//implementation("com.facebook.react:react-native:+")
32+
3033
implementation 'androidx.appcompat:appcompat:1.0.0'
3134
testImplementation 'junit:junit:4.12'
32-
implementation 'com.facebook.react:react-native:+'
33-
implementation 'com.google.ar:core:1.41.0'
35+
implementation 'com.google.ar:core:1.43.0'
3436
implementation project(':gvr_common')
3537
implementation project(':viro_renderer')
3638
implementation 'com.google.android.exoplayer:exoplayer:2.19.1'

android/viro_bridge/src/main/java/com/viromedia/bridge/component/node/VRTNodeManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import android.provider.MediaStore;
2525

2626
import com.facebook.react.bridge.Dynamic;
27-
import com.facebook.react.bridge.DynamicFromMap;
2827
import com.facebook.react.bridge.JavaOnlyMap;
2928
import com.facebook.react.bridge.ReactApplicationContext;
3029
import com.facebook.react.bridge.ReadableArray;
@@ -41,6 +40,7 @@
4140
import com.viromedia.bridge.component.VRTViroViewGroupManager;
4241
import com.viromedia.bridge.module.MaterialManager;
4342
import com.viromedia.bridge.module.MaterialManager.MaterialWrapper;
43+
import com.viromedia.bridge.utility.DynamicUtil;
4444
import com.viromedia.bridge.utility.Helper;
4545
import com.viromedia.bridge.utility.ViroEvents;
4646
import com.viromedia.bridge.utility.ViroLog;
@@ -244,7 +244,7 @@ public void setWidth(Dynamic width) {
244244
super.setWidth(width);
245245
} else if (width.getType() == ReadableType.Number){
246246
JavaOnlyMap map = JavaOnlyMap.of(WIDTH_NAME, width.asDouble() * s2DUnitPer3DUnit);
247-
Dynamic newWidth = DynamicFromMap.create(map, WIDTH_NAME);
247+
Dynamic newWidth = DynamicUtil.create(map, WIDTH_NAME);
248248
super.setWidth(newWidth);
249249
} else {
250250
ViroLog.warn(TAG, "Width is not of type Number or String. Doing nothing.");
@@ -257,7 +257,7 @@ public void setHeight(Dynamic height) {
257257
super.setHeight(height);
258258
} else if (height.getType() == ReadableType.Number) {
259259
JavaOnlyMap map = JavaOnlyMap.of(HEIGHT_NAME, height.asDouble() * s2DUnitPer3DUnit);
260-
Dynamic newHeight = DynamicFromMap.create(map, HEIGHT_NAME);
260+
Dynamic newHeight = DynamicUtil.create(map, HEIGHT_NAME);
261261
super.setHeight(newHeight);
262262
} else {
263263
ViroLog.warn(TAG, "Height is not of type Number or String. Doing nothing.");
@@ -278,7 +278,7 @@ public void setPaddings(int index, Dynamic padding) {
278278
super.setPaddings(index, padding);
279279
} else if (padding.getType() == ReadableType.Number) {
280280
JavaOnlyMap map = JavaOnlyMap.of(PADDING_NAME, padding.asDouble() * s2DUnitPer3DUnit);
281-
Dynamic newPadding = DynamicFromMap.create(map, PADDING_NAME);
281+
Dynamic newPadding = DynamicUtil.create(map, PADDING_NAME);
282282
super.setPaddings(index, newPadding);
283283
} else {
284284
ViroLog.warn(TAG, "Padding is not of type Number of String. Doing nothing.");
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.viromedia.bridge.utility;
2+
import com.facebook.react.bridge.Dynamic;
3+
import com.facebook.react.bridge.ReadableArray;
4+
import com.facebook.react.bridge.ReadableMap;
5+
import com.facebook.react.bridge.ReadableType;
6+
7+
public class DynamicUtil {
8+
public static Dynamic create(ReadableMap map, String key) {
9+
return new Dynamic() {
10+
@Override
11+
public void recycle() {
12+
13+
}
14+
15+
@Override
16+
public int asInt() {
17+
return 0;
18+
}
19+
20+
@Override
21+
public boolean isNull() {
22+
return false;
23+
}
24+
25+
@Override
26+
public ReadableType getType() {
27+
return map.getType(key);
28+
}
29+
30+
@Override
31+
public double asDouble() {
32+
return map.getDouble(key);
33+
}
34+
35+
@Override
36+
public String asString() {
37+
return map.getString(key);
38+
}
39+
40+
@Override
41+
public boolean asBoolean() {
42+
return map.getBoolean(key);
43+
}
44+
45+
@Override
46+
public ReadableMap asMap() {
47+
return map.getMap(key);
48+
}
49+
50+
@Override
51+
public ReadableArray asArray() {
52+
return map.getArray(key);
53+
}
54+
};
55+
}
56+
}

components/AR/ViroARScene.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import { ViroBase } from "../ViroBase";
4747
import { ViroCamera } from "../ViroCamera";
4848
import { ViroTrackingStateConstants } from "../ViroConstants";
4949
import { ViroCommonProps } from "./ViroCommonProps";
50-
import { ViroTelemetry } from "../Telemetry/ViroTelemetry";
50+
import { ViroOrbitCamera } from "components/ViroOrbitCamera";
5151

5252
const ViroCameraModule = NativeModules.ViroCameraModule;
5353

@@ -394,23 +394,26 @@ export class ViroARScene extends ViroBase<Props> {
394394
return (
395395
<ViroSceneContext.Provider
396396
value={{
397-
cameraDidMount: (camera: ViroCamera) => {
397+
cameraDidMount: (camera: ViroCamera | ViroOrbitCamera) => {
398398
if (camera.props.active) {
399399
NativeModules.VRTCameraModule.setSceneCamera(
400400
findNodeHandle(this),
401401
findNodeHandle(camera)
402402
);
403403
}
404404
},
405-
cameraWillUnmount: (camera: ViroCamera) => {
405+
cameraWillUnmount: (camera: ViroCamera | ViroOrbitCamera) => {
406406
if (camera.props.active) {
407407
NativeModules.VRTCameraModule.removeSceneCamera(
408408
findNodeHandle(this),
409409
findNodeHandle(camera)
410410
);
411411
}
412412
},
413-
cameraDidUpdate: (camera: ViroCamera, active: boolean) => {
413+
cameraDidUpdate: (
414+
camera: ViroCamera | ViroOrbitCamera,
415+
active: boolean
416+
) => {
414417
if (active) {
415418
NativeModules.VRTCameraModule.setSceneCamera(
416419
findNodeHandle(this),

components/AR/ViroARSceneNavigator.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
ViroScene,
2828
ViroSceneDictionary,
2929
} from "../Types/ViroUtils";
30-
import { ViroTelemetry } from "../Telemetry/ViroTelemetry";
30+
3131

3232
const ViroARSceneNavigatorModule = NativeModules.VRTARSceneNavigatorModule;
3333

@@ -80,7 +80,6 @@ export class ViroARSceneNavigator extends React.Component<Props, State> {
8080

8181
constructor(props: Props) {
8282
super(props);
83-
ViroTelemetry.recordTelemetry("INIT", { ar: true });
8483
let initialSceneTag = this.props.initialSceneKey;
8584
if (initialSceneTag == null) {
8685
initialSceneTag = this.getRandomTag();

components/Telemetry/ViroTelemetry.ts

Lines changed: 0 additions & 93 deletions
This file was deleted.

components/Utilities/ViroVersion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VIRO_VERSION = "2.41.6";
1+
export const VIRO_VERSION = "2.42.0";

components/Viro3DSceneNavigator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
ViroSceneDictionary,
2626
} from "./Types/ViroUtils";
2727
import { ViroScene } from "./ViroScene";
28-
import { ViroTelemetry } from "./Telemetry/ViroTelemetry";
28+
2929
const Viro3DSceneNavigatorModule = NativeModules.VRT3DSceneNavigatorModule;
3030

3131
var mathRandomOffset = 0;

components/ViroCamera.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type State = {
4646
export class ViroCamera extends React.Component<Props, State> {
4747
_component: any;
4848
static contextType?: React.Context<any> | undefined = ViroSceneContext;
49+
declare context: React.ContextType<typeof ViroSceneContext>;
4950

5051
componentDidMount() {
5152
this.context.cameraDidMount(this);

components/ViroOrbitCamera.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class ViroOrbitCamera extends React.Component<Props> {
2929
_component: ViroNativeRef = null;
3030

3131
static contextType?: React.Context<any> | undefined = ViroSceneContext;
32+
declare context: React.ContextType<typeof ViroSceneContext>;
3233

3334
componentDidMount() {
3435
this.context.cameraDidMount(this);

0 commit comments

Comments
 (0)