Skip to content

Commit

Permalink
docs: Restore logger docs changes after release (#6608)
Browse files Browse the repository at this point in the history
## Summary

This PR just restores changes I reverted in the #6529 PR. Since now
logger changes are released after `3.16.0` is rolled out, we can restore
the getting start part and remove unreleased labels/info boxes.
  • Loading branch information
MatiPl01 authored Oct 18, 2024
1 parent b4db562 commit 7b3a8b1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ sidebar_position: 1

# Accurate Call Stacks

import UnreleasedInfo from '../_shared/_unreleased_info.mdx';

<UnreleasedInfo />

When debugging Reanimated code, you may encounter error or warning call stacks that don't clearly indicate the root cause of the problem. These stacks can be misleading, as they often highlight code from Reanimated's internals rather than the misuse of the Reanimated API that is the source of the problem.

To address this, Reanimated provides a Metro configuration wrapper called `wrapWithReanimatedMetroConfig`. This wrapper automatically adjusts your Metro config to improve the accuracy of call stacks in warnings and errors generated by the Reanimated library.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ sidebar_position: 2

# Logger configuration

import UnreleasedInfo from '../_shared/_unreleased_info.mdx';

<UnreleasedInfo />

Reanimated shows warnings that indicate misuses of the library API, such as modifying the [shared value](/docs/fundamentals/glossary#shared-value) during component re-render. These logs can be configured to be more or less verbose.

The **default** logger configuration doesn't require any user setup and displays **all warnings and errors**. If you want to change this behavior, use the `configureReanimatedLogger` function.
Expand Down
28 changes: 27 additions & 1 deletion packages/docs-reanimated/docs/fundamentals/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,33 @@ To learn more about the plugin head onto to [Reanimated babel plugin](/docs/fund

</details>

### Step 3: Clear Metro bundler cache (recommended)
### Step 3: Wrap metro config with reanimated wrapper (recommended)

Wrap your existing Metro configuration in the `metro.config.js` file with the `wrapWithReanimatedMetroConfig` function.

```js
// metro.config.js
const {
wrapWithReanimatedMetroConfig,
} = require('react-native-reanimated/metro-config');

const config = {
// Your existing Metro configuration options
};

module.exports = wrapWithReanimatedMetroConfig(config);
```

<details>
<summary>Why should I do this?</summary>

Wrapping your Metro configuration with the Reanimated Metro config wrapper will result in displaying improved reanimated errors and warnings with more accurate call stacks. Thanks to this, identifying misuses of the Reanimated API will be much easier than before.

To learn more about this feature, head onto to [Accurate Call Stacks](/docs/debugging/accurate-call-stacks).

</details>

### Step 4: Clear Metro bundler cache (recommended)

<Tabs groupId="package-managers">
<TabItem value="expo" label="EXPO" default>
Expand Down
5 changes: 1 addition & 4 deletions packages/docs-reanimated/src/theme/DocSidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ export default function DocSidebarWrapper(props) {

const newItems = ['animations/withClamp'];
const experimentalItems = ['shared-element-transitions/overview'];
const unreleasedItems = [
'debugging/accurate-call-stacks',
'debugging/logger-configuration',
];
const unreleasedItems = [];

return (
<DocSidebar
Expand Down

0 comments on commit 7b3a8b1

Please sign in to comment.