Skip to content
Open
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
3 changes: 2 additions & 1 deletion example/.detoxrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ module.exports = {
'android.debug': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk',
build: 'cd android && ./gradlew assembleDebug assembleAndroidTest',
build:
'cd android && ./gradlew assembleDebug assembleAndroidTest -PnewArchEnabled=false',
testBinaryPath:
'android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk',
reversePorts: [8081],
Expand Down
3 changes: 1 addition & 2 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
# Temporarily disabled for Detox E2E testing compatibility
newArchEnabled=false
newArchEnabled=true
Comment on lines 32 to +35
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The surrounding docs still state that Android Detox runs with newArchEnabled=false set in the example app (e.g. example/e2e/README.md and CLAUDE.md). Since the default is now true and Detox is handled via a Gradle CLI override, consider updating the comment here to reflect the new behavior (and update those docs in the same PR) to avoid confusing contributors.

Copilot uses AI. Check for mistakes.

# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
Expand Down
14 changes: 6 additions & 8 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,6 @@ export interface ViewShotProperties {
style?: StyleProp<ViewStyle>;
}

const acceptedFormats = ["png", "jpg"].concat(
Platform.OS === "android" ? ["webm", "raw"] : [],
);

const acceptedResults = ["tmpfile", "base64", "data-uri"].concat(
Platform.OS === "android" ? ["zip-base64"] : [],
);

const defaultOptions: CaptureOptions = {
format: "png",
quality: 1,
Expand All @@ -119,6 +111,12 @@ function validateOptions(input?: CaptureOptions): {
options: CaptureOptions;
errors: string[];
} {
const acceptedFormats = ["png", "jpg"].concat(
Platform.OS === "android" ? ["webm", "raw"] : [],
);
const acceptedResults = ["tmpfile", "base64", "data-uri"].concat(
Platform.OS === "android" ? ["zip-base64"] : [],
);
const options: CaptureOptions = {
...defaultOptions,
...input,
Expand Down
13 changes: 3 additions & 10 deletions src/specs/NativeRNViewShot.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {TurboModule} from "react-native";
import {TurboModuleRegistry, NativeModules, Platform} from "react-native";
import {Int32, WithDefault} from "react-native/Libraries/Types/CodegenTypes";
import {TurboModuleRegistry} from "react-native";
import {WithDefault} from "react-native/Libraries/Types/CodegenTypes";

export interface Spec extends TurboModule {
releaseCapture: (uri: string) => void;
Expand All @@ -11,11 +11,4 @@ export interface Spec extends TurboModule {
captureScreen: (options: Object) => Promise<string>;
}

// Support both old and new architecture
const isTurboModuleEnabled = global.__turboModuleProxy != null;

const RNViewShotModule = isTurboModuleEnabled
? TurboModuleRegistry.getEnforcing<Spec>("RNViewShot")
: NativeModules.RNViewShot;

export default RNViewShotModule as Spec;
export default TurboModuleRegistry.get<Spec>("RNViewShot");
Loading