react-native-markdown-display icon indicating copy to clipboard operation
react-native-markdown-display copied to clipboard

code_inline customization

Open hawoooi opened this issue 1 year ago • 3 comments

i've found that code_inline behaves differently than expected. I wasn't able to set margin, padding, and border radius for it. Other things work fine. I was only able to set the background color, and the text color.

hawoooi avatar Aug 28 '24 13:08 hawoooi

Exactly, I also face this issue for the margin.!

lvlupharshit avatar Dec 24 '24 13:12 lvlupharshit

Arriving far after the question so I hope you could find the reason by yourself. I still answer in case other people wonder why it behaves this way.

When looking at the lib code, it appears the code_inline rule uses React-Native's Text component. Since margin, padding, and border radius are View style props, you can't use them for code_inline. If you really need those, I suggest creating a custom rule that wraps the original implementation with a view that wraps it (be careful, you'll have to use specific a specific style for the wrapper to avoid passing it text styles)

LouisDvr avatar Feb 26 '25 14:02 LouisDvr

Thanks for explaining, I don't actually understand much about building packages.

But just out of curiosity that would it not be convinient if you provide styling options access directly instead of making our own rules. Basic ones like margins and paddings etc.

Btw, great library :)

lvlupharshit avatar Feb 26 '25 23:02 lvlupharshit