Skip to content

Commit

Permalink
fix: android implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Nov 20, 2024
1 parent f69e13a commit 9a74846
Show file tree
Hide file tree
Showing 7 changed files with 3,226 additions and 10,651 deletions.
3 changes: 2 additions & 1 deletion Apps/BRNPlayground/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
# Note that this is incompatible with web debugging.
newArchEnabled=false
newArchEnabled=true
hermesEnabled=true
bridgelessEnabled=true

# Uncomment the line below if building react-native from source
#ANDROID_NDK_VERSION=26.1.10909125
Expand Down
12 changes: 6 additions & 6 deletions Apps/BRNPlayground/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Apps/BRNPlayground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@babylonjs/react-native": "file:../../Modules/@babylonjs/react-native",
"@babylonjs/react-native-iosandroid": "file:../../Modules/@babylonjs/react-native-iosandroid",
"@babylonjs/react-native-windows": "file:../../Modules/@babylonjs/react-native-windows",
"@react-native-community/slider": "^4.2.2",
"@react-native-community/slider": "^4.5.5",
"react": "18.2.0",
"react-native": "0.73.5",
"react-native-macos": "^0.73.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

@ReactModule(name = BabylonModule.NAME)
public final class BabylonModule extends NativeBabylonModuleSpec {
static final String NAME = "EngineViewNativeComponent";
static final String NAME = "BabylonModule";

BabylonModule(ReactApplicationContext reactContext) {
super(reactContext);
Expand All @@ -17,22 +17,22 @@ public final class BabylonModule extends NativeBabylonModuleSpec {
@NonNull
@Override
public String getName() {
return BabylonModule.NAME;
return BabylonModule.NAME;
}

@Override
public void initialize(Promise promise) {
// this.getReactApplicationContext().runOnJSQueueThread(() -> {
// BabylonNativeInterop.initialize(this.getReactApplicationContext());
// promise.resolve(null);
// });
this.getReactApplicationContext().runOnJSQueueThread(() -> {
BabylonNativeInterop.initialize(this.getReactApplicationContext());
promise.resolve(null);
});
}

@Override
public void resetView(Promise promise) {
// this.getReactApplicationContext().runOnUiQueueThread(() -> {
// BabylonNativeInterop.resetView();
// promise.resolve(null);
// });
this.getReactApplicationContext().runOnUiQueueThread(() -> {
BabylonNativeInterop.resetView();
promise.resolve(null);
});
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
package com.babylonreactnative;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.facebook.react.BaseReactPackage;
import com.facebook.react.ReactPackage;
import com.facebook.react.TurboReactPackage;
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;
import com.facebook.react.uimanager.ViewManager;

public class BabylonPackage implements ReactPackage {
Expand All @@ -27,6 +20,8 @@ public List<NativeModule> createNativeModules(ReactApplicationContext reactConte
@NonNull
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
// We have two implementations of EngineViewManager, one per architecture.
// Implementation source code is determined by the sourceSets in the build.gradle file.
return Arrays.<ViewManager>asList(new EngineViewManager());
}
}
Loading

0 comments on commit 9a74846

Please sign in to comment.