Natural top border to a rounded rect #1406
-
How do I add a border to the top of a Rounded Rect like this image? It is possible to use Path to draw the curve, but is there an easier way than that? |
Beta Was this translation helpful? Give feedback.
Answered by
wcandillon
Mar 9, 2023
Replies: 2 comments 3 replies
-
I achieved this by providing another RoundedRect of the same shape and shifting it up and clip it. import { Canvas, Group, RoundedRect, Shadow } from '@shopify/react-native-skia';
export default function App() {
const baseRect={x: 100, y: 100, width: 200, height: 160}
return (
<Canvas style={{flex: 1, backgroundColor: "#EAEAEA"}}>
<Group clip={{x: baseRect.x -1, y: baseRect.y - 4, height: 32, width: baseRect.width + 1}}>
<RoundedRect {...{...baseRect, y: baseRect.y - 1.5}} r={50} color="white" style="stroke" strokeWidth={1.5} />
</Group>
<RoundedRect {...baseRect} r={48} color="#ECECEC" style="fill">
<Shadow dx={0} dy={0} blur={2} color="rgba(0, 0, 0, 0.1)" />
</RoundedRect>
</Canvas>
);
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
hey @gaishimo 🙋🏼♂️ could you provide more information about this? Is the reference image done with Figma? if yes, how is it made? I am sure that we can map the concepts nicely. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
gaishimo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hey @gaishimo 🙋🏼♂️
could you provide more information about this? Is the reference image done with Figma? if yes, how is it made? I am sure that we can map the concepts nicely.