Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Mark debugging docs as unreleased, remove recommended metro config step #6529

Merged
merged 4 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions packages/docs-reanimated/docs/_shared/_unreleased_info.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:::info
This page refers to changes that haven't been released yet. They will become available in the next minor release of Reanimated.
MatiPl01 marked this conversation as resolved.
Show resolved Hide resolved

:::
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ 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,6 +6,10 @@ 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: 1 addition & 27 deletions packages/docs-reanimated/docs/fundamentals/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -91,33 +91,7 @@ To learn more about the plugin head onto to [Reanimated babel plugin](/docs/fund

</details>

### 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)
MatiPl01 marked this conversation as resolved.
Show resolved Hide resolved
### Step 3: Clear Metro bundler cache (recommended)

<Tabs groupId="package-managers">
<TabItem value="expo" label="EXPO" default>
Expand Down
6 changes: 6 additions & 0 deletions packages/docs-reanimated/src/css/colors.css
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@
--swm-sidebar-label-text-experimental: var(--swm-navy-light-100);
--swm-sidebar-label-background-experimental: var(--swm-yellow-light-40);

--swm-sidebar-label-text-unreleased: var(--swm-navy-light-100);
--swm-sidebar-label-background-unreleased: var(--swm-blue-light-40);

/* Mobile sidebar versions */
--swm-sidebar-elements-version-text: var(--swm-navy-light-100);
--swm-sidebar-elements-version-inactive: var(--swm-navy-dark-40);
Expand Down Expand Up @@ -440,6 +443,9 @@
--swm-sidebar-label-text-experimental: var(--swm-off-white);
--swm-sidebar-label-background-experimental: var(--swm-yellow-dark-120);

--swm-sidebar-label-text-unreleased: var(--swm-off-white);
--swm-sidebar-label-background-unreleased: var(--swm-blue-dark-120);

/* Mobile sidebar versions */
--swm-sidebar-elements-version-text: var(--swm-navy-dark-20);
--swm-sidebar-elements-version-inactive: var(--swm-navy-dark-60);
Expand Down
5 changes: 5 additions & 0 deletions packages/docs-reanimated/src/theme/DocSidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ export default function DocSidebarWrapper(props) {

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

MatiPl01 marked this conversation as resolved.
Show resolved Hide resolved
return (
<DocSidebar
newItems={newItems}
experimentalItems={experimentalItems}
unreleasedItems={unreleasedItems}
heroImages={heroImages}
titleImages={titleImages}
{...props}
Expand Down