From cd47aece7eb9854c9b68547417df6ec6ffc89783 Mon Sep 17 00:00:00 2001 From: Jakub Grzywacz Date: Mon, 30 Sep 2024 14:25:04 +0200 Subject: [PATCH] style: format and rename variables (#2469) # Summary Formatting and rename variable committed in #2415 --- USAGE.md | 34 +++++++++++-------- .../java/com/horcrux/svg/RenderableView.java | 7 +++- .../java/com/horcrux/svg/SvgViewManager.java | 6 ++-- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/USAGE.md b/USAGE.md index f3dc6b3ca..64cb9b2fa 100644 --- a/USAGE.md +++ b/USAGE.md @@ -145,12 +145,15 @@ export default () => { ); }; ``` + # Web configuration ## Metro bundler + No additional steps are required when using Metro bundler. ## Webpack + If you are using the Webpack bundler, the following steps are needed: - Install `@react-native/assets-registry/registry` as a project dependency. @@ -158,25 +161,26 @@ If you are using the Webpack bundler, the following steps are needed: - Configure the Webpack `module -> rules` section and include an important rule for `node_modules/@react-native/assets-registry/registry`. webpack.config.js - ```ts - const babelLoaderConfiguration = { - include: [ - path.resolve( - appDirectory, - // Important! - 'node_modules/@react-native/assets-registry/registry', - ), - ], - ... + +```ts +const babelLoaderConfiguration = { + include: [ + path.resolve( + appDirectory, + // Important! + 'node_modules/@react-native/assets-registry/registry', + ), + ], + ... }; module.exports = { - ...config, - module: { - rules: [babelLoaderConfiguration], - }, + ...config, + module: { + rules: [babelLoaderConfiguration], + }, }; - ``` +``` For more details on the complete Webpack configuration, you can refer to this [documentation](https://necolas.github.io/react-native-web/docs/multi-platform/#compiling-and-bundling) on how to set up a `webpack.config` file for React Native Web. diff --git a/android/src/main/java/com/horcrux/svg/RenderableView.java b/android/src/main/java/com/horcrux/svg/RenderableView.java index b24e0a184..60a0e9f13 100644 --- a/android/src/main/java/com/horcrux/svg/RenderableView.java +++ b/android/src/main/java/com/horcrux/svg/RenderableView.java @@ -428,7 +428,12 @@ void render(Canvas canvas, Paint paint, float opacity) { float maskY = (float) relativeOnFraction(mask.mY, clientRect.height()); float maskWidth = (float) relativeOnFraction(mask.mW, clientRect.width()); float maskHeight = (float) relativeOnFraction(mask.mH, clientRect.height()); - maskBounds = new RectF(clientRect.left + maskX, clientRect.top + maskY, clientRect.left + maskX + maskWidth, clientRect.top + maskY + maskHeight); + maskBounds = + new RectF( + clientRect.left + maskX, + clientRect.top + maskY, + clientRect.left + maskX + maskWidth, + clientRect.top + maskY + maskHeight); } // clip to mask bounds canvas.clipRect(maskBounds); diff --git a/android/src/transformRn73/java/com/horcrux/svg/SvgViewManager.java b/android/src/transformRn73/java/com/horcrux/svg/SvgViewManager.java index 51e263f56..113d0a016 100644 --- a/android/src/transformRn73/java/com/horcrux/svg/SvgViewManager.java +++ b/android/src/transformRn73/java/com/horcrux/svg/SvgViewManager.java @@ -328,11 +328,11 @@ public void setBorderBlockStartColor(SvgView view, @Nullable Integer value) { } public void setBorderRadius(ReactViewGroup view, int index, Dynamic rawBorderRadius) { - double test = 0; + double borderRadius = 0; if (rawBorderRadius.getType() == ReadableType.Number) { - test = rawBorderRadius.asDouble(); + borderRadius = rawBorderRadius.asDouble(); } - super.setBorderRadius(view, index, (float) test); + super.setBorderRadius(view, index, (float) borderRadius); } @Override