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

Android android_hyphenationFrequency in text does not work in react-native 0.64.2 #31878

Closed
evd1ser opened this issue Jul 19, 2021 · 12 comments
Closed
Labels
Component: Text Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@evd1ser
Copy link

evd1ser commented Jul 19, 2021

Description

I'm trying to add soft hyphenation to app using android_hyphenationFrequency but it doesn't work.

try on new clean app

React Native version:

{
  "name": "TestTestWrapp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "17.0.1",
    "react-native": "0.64.2"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.64.0",
    "react-test-renderer": "17.0.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

Steps To Reproduce

  1. create new app
  2. add some text like WillHaveAnHyphenWhenBreakingForNewLine
    2.1 for example I use three text with different symbol
    2.2 WillHave\u00ADAnHyphen\u00ADWhen\u00ADBreaking\u00ADForNew\u00ADLine - in this issue written that it doesn't work for android
    2.3 WillHave\u200BAnHyphen\u200BWhen\u200BBreaking\u200BForNew\u200BLine - wrap for android
  3. add maxWidth to container - example 300
  4. add text props android_hyphenationFrequency with any value
  5. run on android device example: emulator Pixel 4 API 30

Expected Results

To see the result like in this request - #29157

but I don't see anything like it

Snack, code example, screenshot, or link to a repository:

code example:
Снимок экрана 2021-07-19 в 13 20 26
result example:
Screenshot_1626690040

text wrap with \u200B but no hyphenation symbol

repository with example - https://github.com/evd1ser/test-rn-andoid-text-hyphenation

@yanel777
Copy link

yanel777 commented Jul 19, 2021

+1

@evd1ser evd1ser changed the title Android hyphenation in text does not work in react-native 0.64.2 Android android_hyphenationFrequency in text does not work in react-native 0.64.2 Jul 19, 2021
@lpatrun
Copy link

lpatrun commented Jul 22, 2021

It doesn't work on 0.64.1 as well.
I tried on emulator and real device, both being android 8.0 and higher.
I just added android_hyphenationFrequency prop to Text component and tried with 'full', 'balanced', 'high' but it made no difference.

@LukaZagar1995
Copy link

+1

@fabOnReact
Copy link
Contributor

fabOnReact commented Aug 3, 2021

seems to me that you are using textBreakStrategy.
Can you reproduce this problem without that prop?

the result should be something like

https://github.com/facebook/react-native/pull/29157/files?file-filters%5B%5D=.js#diff-1654e2fe87ee923670e15697f1556521bb5565e04d6bc2d306c5204f6b5ef4beR211-R232

AFTER

#29157 (comment)

@yanel777
Copy link

yanel777 commented Aug 3, 2021

seems to me that you are using textBreakStrategy.
Can you reproduce this problem without that prop?

the result should be something like

https://github.com/facebook/react-native/pull/29157/files?file-filters%5B%5D=.js#diff-1654e2fe87ee923670e15697f1556521bb5565e04d6bc2d306c5204f6b5ef4beR211-R232

AFTER

#29157 (comment)

@fabriziobertoglio1987
textBreakStrategy = any value or undefined - reproduce this problem

@evd1ser
Copy link
Author

evd1ser commented Aug 3, 2021

seems to me that you are using textBreakStrategy.
Can you reproduce this problem without that prop?

@fabriziobertoglio1987
I'm try without textBreakStrategy too result:

Снимок экрана 2021-08-03 в 16 31 02

Снимок экрана 2021-08-03 в 16 24 56

example repo: https://github.com/evd1ser/test-rn-andoid-text-hyphenation

@steffenkleinle
Copy link

Still experiencing this on react-native v0.66.4 and v0.67.2 on android under certain(most) circumstances. With texts of certain lengths in views of certain length it does work while for others it does not work apparently.On iOS everything works as it should.
Example: Your example (WillHave\u00ADAnHyphen\u00ADWhen\u00ADBreaking\u00ADForNew\u00ADLine) works fine:
image
However, if I add \u00ADWill\u00ADitStill\u00ADHaveAnHyphen\u00ADIfIMake\u00ADThisEven\u00ADLonger it won't work anymore:
image
With zero width spaces everything works fine u200B:
image

Did you find any workaround (except replacing soft hyphens u00AD with zero width spaces u200B)?

@TheRealMikeD
Copy link

I hope this doesn't make things worse, but I was trying to use a value of "balanced" and I got an error:
Invalid android_hyphenationFrequency: balanced
According to the RN docs for RN 0.67 and later, "balanced" is no longer a valid value: https://reactnative.dev/docs/0.67/text#android_hyphenationfrequency-android

That said, I concur with the original poster that none of the values seem to do anything, as far as I can see.
Using RN 0.69.6

@fabOnReact
Copy link
Contributor

fabOnReact commented Feb 13, 2023

Copy link

github-actions bot commented Mar 5, 2024

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 5, 2024
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 12, 2024
@Shai69bb
Copy link

Help

@Shai69bb Shai69bb mentioned this issue Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Text Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

9 participants