8000 update: add support for latest RN & Expo by doranteseduardo · Pull Request #323 · ReactVision/viro · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

update: add support for latest RN & Expo #323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## v2.42.0 - 7 February 2025

- Compatibility with Expo 52
- Removed Telemetry
- Cleaned codebase

## v2.41.1 - 6 March 2024

- fix(ViroBase): fix onClick not working for <ViroText /> components [`#277`](https://github.com/NativeVision/viro/pull/277)
Expand Down Expand Up @@ -100,7 +106,7 @@
- Removing references to fbjs. [`#8`](https://github.com/NativeVision/viro/pull/8)
- fix typo in package.json [`#6`](https://github.com/NativeVision/viro/pull/6)
- Adding NPM publish action [`#4`](https://github.com/NativeVision/viro/pull/4)
- * Removed the star from every pod as when doing pod install it drops … [`#1`](https://github.com/NativeVision/viro/pull/1)
- - Removed the star from every pod as when doing pod install it drops … [`#1`](https://github.co CEB7 m/NativeVision/viro/pull/1)
- First [`4fb045b`](https://github.com/NativeVision/viro/commit/4fb045b7948533abc8787a10981f74b003a3ea68)
- Remove broken scripts [`2d94c22`](https://github.com/NativeVision/viro/commit/2d94c22e0447a655cffbb3ae415ebc111e4d15bc)
- Updating Readme to give better install instructions and moving examples to their own page(#7) [`bee93cc`](https://github.com/NativeVision/viro/commit/bee93cc7a18666294a14eb13606ef4e2f160202a)
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ buildscript {
}
jcenter()
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0"
classpath("com.facebook.react:react-native-gradle-plugin")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -19,17 +21,15 @@ buildscript {
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
mavenCentral()
maven {
//url 'https://maven.google.com'
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()

maven { url 'https://jitpack.io' }
}
}
Expand Down
5 changes: 2 additions & 3 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#Fri Feb 07 19:36:38 CST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
networkTimeout=10000
validateDistributionUrl=true
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Binary file modified android/react_viro/react_viro-release.aar
Binary file not shown.
6 changes: 5 additions & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
include ':gvr_common', ':viro_bridge', ':viro_renderer', ':arcore_client'
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
includeBuild("../node_modules/@react-native/gradle-plugin")
include ':gvr_common', ':viro_bridge', ':viro_renderer', ':arcore_client'
10 changes: 6 additions & 4 deletions android/viro_bridge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apply plugin: 'com.android.library'
apply plugin: "kotlin-android"
apply plugin: "com.facebook.react"

android {
compileSdkVersion 33
buildToolsVersion '30.0.2'
compileSdkVersion 34
namespace "com.viromedia.bridge"

defaultConfig {
Expand All @@ -27,10 +27,12 @@ dependencies {
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0"

implementation("com.facebook.react:react-android:0.76.0")
//implementation("com.facebook.react:react-native:+")

implementation 'androidx.appcompat:appcompat:1.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.facebook.react:react-native:+'
implementation 'com.google.ar:core:1.41.0'
implementation 'com.google.ar:core:1.43.0'
implementation project(':gvr_common')
implementation project(':viro_renderer')
implementation 'com.google.android.exoplayer:exoplayer:2.19.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import android.provider.MediaStore;

import com.facebook.react.bridge.Dynamic;
import com.facebook.react.bridge.DynamicFromMap;
import com.facebook.react.bridge.JavaOnlyMap;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReadableArray;
Expand All @@ -41,6 +40,7 @@
import com.viromedia.bridge.component.VRTViroViewGroupManager;
import com.viromedia.bridge.module.MaterialManager;
import com.viromedia.bridge.module.MaterialManager.MaterialWrapper;
import com.viromedia.bridge.utility.DynamicUtil;
import com.viromedia.bridge.utility.Helper;
import com.viromedia.bridge.utility.ViroEvents;
import com.viromedia.bridge.utility.ViroLog;
Expand Down Expand Up @@ -244,7 +244,7 @@ public void setWidth(Dynamic width) {
super.setWidth(width);
} else if (width.getType() == ReadableType.Number){
JavaOnlyMap map = JavaOnlyMap.of(WIDTH_NAME, width.asDouble() * s2DUnitPer3DUnit);
Dynamic newWidth = DynamicFromMap.create(map, WIDTH_NAME);
Dynamic newWidth = DynamicUtil.create(map, WIDTH_NAME);
super.setWidth(newWidth);
} else {
ViroLog.warn(TAG, "Width is not of type Number or String. Doing nothing.");
Expand All @@ -257,7 +257,7 @@ public void setHeight(Dynamic height) {
super.setHeight(height);
} else if (height.getType() == ReadableType.Number) {
JavaOnlyMap map = JavaOnlyMap.of(HEIGHT_NAME, height.asDouble() * s2DUnitPer3DUnit);
Dynamic newHeight = DynamicFromMap.create(map, HEIGHT_NAME);
Dynamic newHeight = DynamicUtil.create(map, HEIGHT_NAME);
super.setHeight(newHeight);
} else {
ViroLog.warn(TAG, "Height is not of type Number or String. Doing nothing.");
Expand All @@ -278,7 +278,7 @@ public void setPaddings(int index, Dynamic padding) {
super.setPaddings(index, padding);
} else if (padding.getType() == ReadableType.Number) {
JavaOnlyMap map = JavaOnlyMap.of(PADDING_NAME, padding.asDouble() * s2DUnitPer3DUnit);
Dynamic newPadding = DynamicFromMap.create(map, PADDING_NAME);
Dynamic newPadding = DynamicUtil.create(map, PADDING_NAME);
super.setPaddings(index, newPadding);
} else {
ViroLog.warn(TAG, "Padding is not of type Number of String. Doing nothing.");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.viromedia.bridge.utility;
import com.facebook.react.bridge.Dynamic;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableType;

public class DynamicUtil {
public static Dynamic create(ReadableMap map, String key) {
return new Dynamic() {
@Override
public void recycle() {

}

@Override
public int asInt() {
return 0;
}

@Override
public boolean isNull() {
return false;
}

@Override
public ReadableType getType() {
return map.getType(key);
}

@Override
public double asDouble() {
return map.getDouble(key);
}

@Override
public String asString() {
return map.getString(key);
}

@Override
public boolean asBoolean() {
return map.getBoolean(key);
}

@Override
public ReadableMap asMap() {
return map.getMap(key);
}

@Override
public ReadableArray asArray() {
return map.getArray(key);
}
};
}
}
11 changes: 7 additions & 4 deletions components/AR/ViroARScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { ViroBase } from "../ViroBase";
import { ViroCamera } from "../ViroCamera";
import { ViroTrackingStateConstants } from "../ViroConstants";
import { ViroCommonProps } from "./ViroCommonProps";
import { ViroTelemetry } from "../Telemetry/ViroTelemetry";
import { ViroOrbitCamera } from "components/ViroOrbitCamera";

const ViroCameraModule = NativeModules.ViroCameraModule;

Expand Down Expand Up @@ -394,23 +394,26 @@ export class ViroARScene extends ViroBase<Props> {
return (
<ViroSceneContext.Provider
value={{
cameraDidMount: (camera: ViroCamera) => {
cameraDidMount: (camera: ViroCamera | ViroOrbitCamera) => {
if (camera.props.active) {
NativeModules.VRTCameraModule.setSceneCamera(
findNodeHandle(this),
findNodeHandle(camera)
);
}
},
cameraWillUnmount: (camera: ViroCamera) => {
cameraWillUnmount: (camera: ViroCamera | ViroOrbitCamera) => {
if (camera.props.active) {
NativeModules.VRTCameraModule.removeSceneCamera(
findNodeHandle(this),
findNodeHandle(camera)
);
}
},
cameraDidUpdate: (camera: ViroCamera, active: boolean) => {
cameraDidUpdate: (
camera: ViroCamera | ViroOrbitCamera,
active: boolean
) => {
if (active) {
NativeModules.VRTCameraModule.setSceneCamera(
findNodeHandle(this),
Expand Down
3 changes: 1 addition & 2 deletions components/AR/ViroARSceneNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
ViroScene,
ViroSceneDictionary,
} from "../Types/ViroUtils";
import { ViroTelemetry } from "../Telemetry/ViroTelemetry";


const ViroARSceneNavigatorModule = NativeModules.VRTARSceneNavigatorModule;

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

constructor(props: Props) {
super(props);
ViroTelemetry.recordTelemetry("INIT", { ar: true });
let initialSceneTag = this.props.initialSceneKey;
if (initialSceneTag == null) {
initialSceneTag = this.getRandomTag();
Expand Down
93 changes: 0 additions & 93 deletions components/Telemetry/ViroTelemetry.ts

This file was deleted.

2 changes: 1 addition & 1 deletion components/Utilities/ViroVersion.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VIRO_VERSION = "2.41.6";
export const VIRO_VERSION = "2.42.0";
2 changes: 1 addition & 1 deletion components/Viro3DSceneNavigator.tsx
FBBD
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
ViroSceneDictionary,
} from "./Types/ViroUtils";
import { ViroScene } from "./ViroScene";
import { ViroTelemetry } from "./Telemetry/ViroTelemetry";

const Viro3DSceneNavigatorModule = NativeModules.VRT3DSceneNavigatorModule;

var mathRandomOffset = 0;
Expand Down
1 change: 1 addition & 0 deletions components/ViroCamera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type State = {
export class ViroCamera extends React.Component<Props, State> {
_component: any;
static contextType?: React.Context<any> | undefined = ViroSceneContext;
declare context: React.ContextType<typeof ViroSceneContext>;

componentDidMount() {
this.context.cameraDidMount(this);
Expand Down
1 change: 1 addition & 0 deletions components/ViroOrbitCamera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class ViroOrbitCamera extends React.Component<Props> {
_component: ViroNativeRef = null;

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

componentDidMount() {
this.context.cameraDidMount(this);
Expand Down
Loading
0