Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
kacperkapusciak committed Aug 4, 2023
1 parent 709979e commit 059e1e0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docs/advanced/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"link": {
"type": "generated-index"
}
}
}
2 changes: 1 addition & 1 deletion docs/guides/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"link": {
"type": "generated-index"
}
}
}
6 changes: 3 additions & 3 deletions docs/guides/debugging_tables/tables.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import styles from './styles.module.css';
import React from "react";
import styles from "./styles.module.css";

/*
Testing setup:
Expand Down Expand Up @@ -106,7 +106,7 @@ export function SummaryTable() {
</tbody>
</table>
¹ - Works, but uses web implementations of functions and runs worklets on
the JS thread. This means that{' '}
the JS thread. This means that{" "}
<a href="../../api/nativeMethods/measure">measure</a> and Layout
Animations will not be available.
<br />² - Experimental feature (see description).
Expand Down
36 changes: 17 additions & 19 deletions docs/guides/web-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ module.exports = {
If you use
[playground](https://github.com/software-mansion-labs/reanimated-2-playground)
app and want to start it in the browser just type:

```shell
yarn web
```

If you want to start the example applications from the
If you want to start the example applications from the
[reanimated repository](https://github.com/software-mansion/react-native-reanimated)
you need to run the following command inside the `Example` directory:

```shell
yarn start-web
```
Expand All @@ -46,41 +48,38 @@ If you want to use Reanimated in a `webpack` app you should adjust your `webpack
Example webpack config file with Reanimated support:

```js {6,14,15,34}
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const HtmlWebpackPlugin = require("html-webpack-plugin");
const webpack = require("webpack");

module.exports = {
entry: [
'babel-polyfill',
'./index.js'
],
entry: ["babel-polyfill", "./index.js"],
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './index.html',
filename: "index.html",
template: "./index.html",
}),
new webpack.EnvironmentPlugin({ JEST_WORKER_ID: null }),
new webpack.DefinePlugin({ process: { env: {} } })
new webpack.DefinePlugin({ process: { env: {} } }),
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
use: {
loader: 'babel-loader',
loader: "babel-loader",
options: {
presets: [
'@babel/preset-react',
{ plugins: ['@babel/plugin-proposal-class-properties'] }
"@babel/preset-react",
{ plugins: ["@babel/plugin-proposal-class-properties"] },
],
},
},
},
],
},
resolve: {
alias: { 'react-native$': 'react-native-web', },
extensions: ['.web.js', '.js'],
alias: { "react-native$": "react-native-web" },
extensions: [".web.js", ".js"],
},
};
```
Expand All @@ -107,7 +106,7 @@ For example:
```ts
const sv = useSharedValue(0);
const dv = useDerivedValue(
() => sv.value + 1,
() => sv.value + 1,
[sv] // dependency array here
);
```
Expand All @@ -116,7 +115,6 @@ Be sure to pass the dependency itself (`sv`) and not `sv.value` to the dependenc

> Babel users will still need to install the `@babel/plugin-proposal-class-properties` plugin.

### ESLint Support

When you use hooks from React, they give you nice suggestions from ESLint to include all dependencies. In order to add this support to Reanimated hooks, add the following to your ESLint config:
Expand All @@ -139,7 +137,7 @@ This assumes you've already installed the `react-hooks` eslint [plugin](https://
If you're using ESLint autofix, the ESLint plugin may add `.value` to the dependency arrays, rather than the root dependency. In these cases, you should update the array yourself.

```tsx
const sv = useSharedValue(0)
const sv = useSharedValue(0);

// 🚨 bad, sv.value is in the array
const dv = useDerivedValue(() => sv.value, [sv.value]);
Expand All @@ -163,5 +161,5 @@ yarn add raf
Add the following to the top of your `_app.tsx`:

```ts
import 'raf/polyfill'
import "raf/polyfill";
```
2 changes: 1 addition & 1 deletion docs/shared-element-transitions/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"link": {
"type": "generated-index"
}
}
}
2 changes: 1 addition & 1 deletion docs/utilities/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"link": {
"type": "generated-index"
}
}
}

0 comments on commit 059e1e0

Please sign in to comment.