arendjr / text-clipper

Fast and correct clip functions for HTML and plain text
MIT License
133 stars 13 forks source link

html style not supported in #21

Closed toorandroidmaster closed 1 year ago

toorandroidmaster commented 1 year ago

when i tried to add style of one html paragraph . it was not working @arendjr

arendjr commented 1 year ago

I’m sorry, can you provide a bit more details? Do you have a specific snippet that you tried? What failed exactly?

toorandroidmaster commented 1 year ago

I’m sorry, can you provide a bit more details? Do you have a specific snippet that you tried? What failed exactly?

-this is my code but style is not working

My Code :

import { Dimensions } from 'react-native'; import clip from 'text-clipper';

const htmlString = <p style='text-align:left;padding:0;margin:0; color:#fffff'> Hello World! Lorem Ipsum is simply dummy text of the printing and typesetting industry..</p>;

{clip(htmlString, screenWidth, {html: true, stripTags: true})}
arendjr commented 1 year ago

I think the problem here is that you’re trying to inject HTML styles into a React Native component. With React Native, the styling needs to be handled by the components, which is not something that text-clipper can help you with. Also, text-clipper is designed to clip to a specific number of characters, rather than screen width.

toorandroidmaster commented 1 year ago

I think the problem here is that you’re trying to inject HTML styles into a React Native component. With React Native, the styling needs to be handled by the components, which is not something that text-clipper can help you with. Also, text-clipper is designed to clip to a specific number of characters, rather than screen width.

@arendjr you are right.. text-clipper is great but it will be. more great it provides html styling as like other html in react native packages