Skip to content

Commit

Permalink
chore: Throw an error when the New Architecture is not available (#6913)
Browse files Browse the repository at this point in the history
## Summary

This PR adds check for the New Architecture and web.

<img
src="https://github.com/user-attachments/assets/212e051b-3cb3-4657-8e37-9b0677634c6d"
width="300" />
  • Loading branch information
MatiPl01 authored Jan 21, 2025
1 parent 4ce44be commit 82dde81
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
} from '../commonTypes';
import { checkCppVersion } from '../platform-specific/checkCppVersion';
import { jsVersion } from '../platform-specific/jsVersion';
import { isFabric } from '../PlatformChecker';
import { isFabric, isWeb } from '../PlatformChecker';
import type React from 'react';
import { getShadowNodeWrapperFromRef } from '../fabricUtils';
import { ReanimatedTurboModule } from '../specs';
Expand All @@ -25,6 +25,8 @@ import type {
NormalizedSingleCSSAnimationSettings,
} from '../css/platform/native';

const IS_WEB = isWeb();

export function createNativeReanimatedModule(): IReanimatedModule {
return new NativeReanimatedModule();
}
Expand Down Expand Up @@ -65,6 +67,11 @@ class NativeReanimatedModule implements IReanimatedModule {
See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#native-part-of-reanimated-doesnt-seem-to-be-initialized for more details.`
);
}
if (!isFabric() && !IS_WEB) {
throw new ReanimatedError(
'Reanimated 4 supports only the React Native New Architecture and web.'
);
}
if (__DEV__) {
checkCppVersion();
}
Expand Down

0 comments on commit 82dde81

Please sign in to comment.