mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
29caed22cc
Summary: When a __rounded__ View on Android has a border, a small gap appears between the border and the center of the view (most noticeably when the background and border colors are the same) Since the border is drawn on top of the other layers, the approach here is to make the center of the View slightly larger so that there is an overlap with the border, and closing the visible gap There are 2 cases for a View with a border: 1. `borderWidth` is set for a consistent border width around all 4 edges 2. Uneven border widths are set (using `borderTopWidth`, `borderLeftWidth, ...) **How is a rounded rectangle drawn?** __Case 1__: `borderWidth` is set for a consistent border width around all 4 edges - Before: - first, `mInnerClipPathForBorderRadius` was used to draw the center of the View - then the border is drawn along the path of `mCenterDraw` with a stroke width of the border width - Now: - `mBackgroundColorRenderPath` is used to draw the center of the View and is exactly a slightly enlarged version of `mInnerClipPathForBorderRadius` __Case 2__: Uneven border widths are set (using borderTopWidth, borderLeftWidth, ...) - Before: - `mInnerClipPathForBorderRadius` was used to draw the center of the View - for each edge, a quadrilateral is drawn - `mOuterClipPathForBorderRadius` clips the outer edge of the border - `mInnerClipPathForBorderRadius` (same is used to draw the center of the View) clips the inner edge of the border - Now: - `mBackgroundColorRenderPath` is used to draw the center of the View, allowing `mInnerClipPathForBorderRadius` to persist as the path that clips the inner edge of the border When `mGapBetweenPaths` = 0, `mBackgroundColorRenderPath` == `mInnerClipPathForBorderRadius`, which is exactly the original implementation Changelog: [Internal][Fixed] - rounded Views with borders shows small gap Reviewed By: mdvacca Differential Revision: D39979567 fbshipit-source-id: 6db71d14ead6256e1b7becf73862e0a537c6a47b
Building React Native for Android
See the Building from Source guide on the React Native website.
Running tests
When you submit a pull request CircleCI will automatically run all tests. To run tests locally, see Testing guide on the React Native website.