Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ export default function BabelPluginReactCompiler(
*/
Program(prog, pass): void {
let opts = parsePluginOptions(pass.opts);
if (pipelineUsesReanimatedPlugin(pass.file.opts.plugins)) {
if (
opts.enableReanimatedCheck === true &&
pipelineUsesReanimatedPlugin(pass.file.opts.plugins)
) {
opts = injectReanimatedFlag(opts);
}
if (process.env["NODE_ENV"] === "development") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ export type PluginOptions = {
ignoreUseNoForget: boolean;

sources?: Array<string> | ((filename: string) => boolean) | null;

/**
* The compiler has customized support for react-native-reanimated, intended as a temporary workaround.
* Set this flag (on by default) to automatically check for this library and activate the support.
*/
enableReanimatedCheck: boolean;
};

const CompilationModeSchema = z.enum([
Expand Down Expand Up @@ -188,6 +194,7 @@ export const defaultOptions: PluginOptions = {
sources: (filename) => {
return filename.indexOf("node_modules") === -1;
},
enableReanimatedCheck: true,
} as const;

export function parsePluginOptions(obj: unknown): PluginOptions {
Expand Down
1 change: 1 addition & 0 deletions compiler/packages/snap/src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ function makePluginOptions(
eslintSuppressionRules,
flowSuppressions,
ignoreUseNoForget,
enableReanimatedCheck: false,
};
}

Expand Down