Skip to content

Commit d538f1e

Browse files
committed
Add a possibility to disable some logs
1 parent 72beef5 commit d538f1e

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

apps/common-app/src/examples/InvalidValueAccessExample.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import Animated, {
77
withTiming,
88
} from 'react-native-reanimated';
99

10+
Animated.configureLogger({
11+
strict: true,
12+
});
13+
1014
export default function InvalidValueAccessExample() {
1115
const [counter, setCounter] = React.useState(0);
1216
const [updateFromUseEffect, setUpdateFromUseEffect] = React.useState(false);

packages/react-native-reanimated/src/mutables.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22
import { shouldBeUseWeb } from './PlatformChecker';
33
import type { Mutable } from './commonTypes';
4+
import { logger } from './logger';
45
import { isFirstReactRender, isReactRendering } from './reactUtils';
56
import { shareableMappingCache } from './shareableMappingCache';
67
import { makeShareableCloneRecursive } from './shareables';
@@ -15,16 +16,18 @@ function shouldWarnAboutAccessDuringRender() {
1516

1617
function checkInvalidReadDuringRender() {
1718
if (shouldWarnAboutAccessDuringRender()) {
18-
console.warn(
19-
'[Reanimated] Reading from `value` during component render. Please ensure that you do not access the `value` property while React is rendering a component.'
19+
logger.warn(
20+
'Reading from `value` during component render. Please ensure that you do not access the `value` property while React is rendering a component.',
21+
{ strict: true }
2022
);
2123
}
2224
}
2325

2426
function checkInvalidWriteDuringRender() {
2527
if (shouldWarnAboutAccessDuringRender()) {
26-
console.warn(
27-
'[Reanimated] Writing to `value` during component render. Please ensure that you do not access the `value` property while React is rendering a component.'
28+
logger.warn(
29+
'Writing to `value` during component render. Please ensure that you do not access the `value` property while React is rendering a component.',
30+
{ strict: true }
2831
);
2932
}
3033
}

0 commit comments

Comments
 (0)