Skip to content

Commit

Permalink
Fix case when dashed/dotted borders do not work with overflow: hidden (
Browse files Browse the repository at this point in the history
…facebook#48414)

Summary:

Was looking into facebook#48078 which was brought to my attention due to my recent refactorings of iOS Views, especially around how overflow: hidden works. This bug was not brought on by my changes but seems to be a lingering Fabric bug (iirc this bool was not changed when I refactored things)

Anyway, dotted/dashed borders did not work with overflow: hidden. The reason why is we use core animation borders in this case which is incorrect as CA cannot do these types of borders. So I added a check to make sure that the borders are solid as well if we want to use CA to draw them.

Changelog: [iOS] [Fixed] - Dashed & dotted borders now work with overflow: hidden

Reviewed By: mdvacca

Differential Revision: D67720492
  • Loading branch information
joevilches authored and facebook-github-bot committed Dec 30, 2024
1 parent a3c8e21 commit fd5d70e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,8 @@ - (void)invalidateLayer
#endif
const bool useCoreAnimationBorderRendering =
borderMetrics.borderColors.isUniform() && borderMetrics.borderWidths.isUniform() &&
borderMetrics.borderStyles.isUniform() && borderMetrics.borderRadii.isUniform() &&
borderMetrics.borderStyles.isUniform() && borderMetrics.borderStyles.left == BorderStyle::Solid &&
borderMetrics.borderRadii.isUniform() &&
(
// iOS draws borders in front of the content whereas CSS draws them behind
// the content. For this reason, only use iOS border drawing when clipping
Expand Down
8 changes: 8 additions & 0 deletions packages/rn-tester/js/examples/Border/BorderExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,14 @@ export default ({
<View style={[styles.smallBox, styles.borderWithChildren2]}>
<View style={[styles.childOfBorder, {left: -15, top: 0}]} />
</View>
<View
style={[
styles.smallBox,
styles.borderWithChildren2,
{borderStyle: 'dashed', overflow: 'hidden'},
]}>
<View style={[styles.childOfBorder, {left: -15, top: 0}]} />
</View>
</View>
);
},
Expand Down

0 comments on commit fd5d70e

Please sign in to comment.