Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last pragraph sentence of some html text gets cuts off i.e not shown #360

Closed
kamalpandey opened this issue Apr 27, 2020 · 21 comments
Closed
Labels
bug:upstream The bug is caused by a third party library. bug Crush'em all. is:FAQ candidate A canonical issue to put in the FAQ. is:missing template This issue does not comply with our contribution guidelines. is:waiting pr A pull request is awaiting reviews to solve the problem.

Comments

@kamalpandey
Copy link

This is problem In smaller device in Android i.e. Google pixel 2xl or 2a and not problem in larger device. Could somebody tell what is wrong?

@ohitslaurence
Copy link

Try add this to your props, worked for me.

customWrapper: (content) => {
    return <Text textBreakStrategy="simple">{content}</Text>;
},

@nolife08021
Copy link

Try add this to your props, worked for me.

customWrapper: (content) => {
    return <Text textBreakStrategy="simple">{content}</Text>;
},

hi,
can you give me full sample?

@nolife08021
Copy link

Try add this to your props, worked for me.

customWrapper: (content) => {
    return <Text textBreakStrategy="simple">{content}</Text>;
},

I tried, it cut off more content. lol

@nolife08021
Copy link

Screen Shot 2020-05-09 at 5 59 12 PM

@nolife08021
Copy link

@kamalpandey @ohitslaurence do you guys have any solution on this?

@nolife08021
Copy link

nolife08021 commented May 9, 2020

I tried
customWrapper={(content) => {return <TextInput multiline={true} editable={false} selectTextOnFocus={false}>{content}</TextInput>;}}

An error show out.

Invariant Violation: Nesting of <View> within <Text> is not currently supported

@kamalpandey
Copy link
Author

@nolife08021 No Waiting for some one to reply on this.

@nolife08021
Copy link

@kamalpandey

try this

<HTML tagsStyles={{p:{ flex:1 }}} allowFontScaling={false} customWrapper={(content) => {return <TextInput style={{backgroundColor:'white'}} multiline={true} editable={false} selectTextOnFocus={false}>{content}</TextInput>;}} baseFontStyle={{flex:1, fontSize:14, fontFamily: "System"}} ignoredStyles={["font-family"]} html={html}/>

@ohitslaurence
Copy link

@kamalpandey Also try adding lineHeight to your html tags. Like 1.4x your font size

@nolife08021
Copy link

@kamalpandey Also try adding lineHeight to your html tags. Like 1.4x your font size

lineHieght works for me. Thanks

@kamalpandey
Copy link
Author

@nolife08021 @ohitslaurence
I am using like this
<HTML html={postBody} onLinkPress={handleLinkPress} imagesMaxWidth={imagesMaxWidth()} ignoredStyles={[...IGNORED_STYLES]} baseFontStyle={baseFontStyle()} alterChildren={node => alterChildren(node)} alterNode={node => alterNode(node)} staticContentMaxWidth={staticContentMaxWidth()} />
where should i be using?

@ohitslaurence
Copy link

@nolife08021 @ohitslaurence
I am using like this
<HTML html={postBody} onLinkPress={handleLinkPress} imagesMaxWidth={imagesMaxWidth()} ignoredStyles={[...IGNORED_STYLES]} baseFontStyle={baseFontStyle()} alterChildren={node => alterChildren(node)} alterNode={node => alterNode(node)} staticContentMaxWidth={staticContentMaxWidth()} />
where should i be using?

@kamalpandey You can put the lineHeight inside your baseFontStyle

@kamalpandey
Copy link
Author

kamalpandey commented May 11, 2020

Screenshot from 2020-05-11 19-52-00
Screenshot from 2020-05-11 19-52-00 (1)

@ohitslaurence
I added this

const MOBILE_FONT_SIZE = 15;
export const baseFontStyle = () => {
  return {
    fontSize: isTablet ? TABLET_FONT_SIZE : MOBILE_FONT_SIZE,
    lineHeight: MOBILE_FONT_SIZE * 1.4,
    color: Colors.darker
  };
};

but still issue persists.

@nolife08021
Copy link

@kamalpandey

I set the lineHeight in tagStyle.

<HTML allowFontScaling={false} tagsStyles={{p:{fontSize:18, padding:10, minHeight:60, lineHeight:22 }}} baseFontStyle={{fontSize:scaledSize(18), fontFamily: "System", justifyContent:'center' }} ignoredStyles={["font-family"]} html={JSON.parse(optionText)} {...htmlConfig}/>

@Tyki
Copy link

Tyki commented May 27, 2020

Facing same issues on MIUI and oneplus OS.

Any updates?

@kamalpandey
Copy link
Author

kamalpandey commented Jun 3, 2020

@Tyki
For now you can use
this pr
Until this pr get merged

@jsamr jsamr added bug Crush'em all. is:missing template This issue does not comply with our contribution guidelines. labels Jul 4, 2020
@jsamr jsamr linked a pull request Jul 5, 2020 that will close this issue
@jsamr jsamr added is:waiting pr A pull request is awaiting reviews to solve the problem. is:FAQ candidate A canonical issue to put in the FAQ. bug:upstream The bug is caused by a third party library. labels Jul 5, 2020
@jsamr jsamr mentioned this issue Nov 26, 2020
41 tasks
@jsamr
Copy link
Collaborator

jsamr commented Jan 16, 2021

So this bug has reportedly appeared with React Native on Android Q (facebook/react-native#25258). Since v5 release, you can use defaultTextProps and set textBreakStrategy to highQuality simple in order to circumvent this bug. I'm closing this thread now as there is an easy workaround and the bug is upstream.

@jsamr jsamr closed this as completed Jan 16, 2021
@hotaryuzaki
Copy link

So this bug has reportedly appeared with React Native on Android Q (facebook/react-native#25258). Since v5 release, you can use defaultTextProps and set textBreakStrategy to highQuality in order to circumvent this bug. I'm closing this thread now as there is an easy workaround and the bug is upstream.

defaultTextProps={{ textBreakStrategy: 'highQuality' }}
not worked for me, set to simple not worked too.

@hotaryuzaki
Copy link

hotaryuzaki commented Mar 8, 2021

sorry, mine was v4 so i need to update to v5.
now it works, but i had to set to simple, not highQuality
defaultTextProps={{ textBreakStrategy: 'simple' }}

oh dont forget after update version we have to reset Metro bundler cache, i found here #375 (comment)

@aarie33
Copy link

aarie33 commented Dec 19, 2023

any update on this issue?
I use v6.3.4, and I still have an issue with the last 2/3 of words in the last paragraph being cut off.

@mochadwi
Copy link

mochadwi commented Jan 7, 2025

using both simple & highQuality not works for me using 6.3.4, with RN 0.68.2, in android 10 & above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:upstream The bug is caused by a third party library. bug Crush'em all. is:FAQ candidate A canonical issue to put in the FAQ. is:missing template This issue does not comply with our contribution guidelines. is:waiting pr A pull request is awaiting reviews to solve the problem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants