question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Text component `android_hyphenationFrequency` type is incomplete

See original GitHub issue

Description

Current prop is missing the high value on the flow types:

// Libraries/Text/TextProps.js
/**
   * Set hyphenation strategy on Android.
   *
   */
  android_hyphenationFrequency?: ?('normal' | 'none' | 'full'),

should be:

  android_hyphenationFrequency?: ?('normal' | 'none' | 'full' | 'high')

Version

0.67.2

Output of npx react-native info

System: OS: macOS 12.1 CPU: (8) arm64 Apple M1 Memory: 90.97 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.12.0 - ~/.nvm/versions/node/v16.12.0/bin/node Yarn: 1.22.17 - ~/.nvm/versions/node/v16.12.0/bin/yarn npm: 8.1.0 - ~/.nvm/versions/node/v16.12.0/bin/npm Watchman: 2022.01.31.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.2 - /Users/osp/.gem/ruby/2.7.2/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 Android SDK: API Levels: 30, 32 Build Tools: 30.0.2, 32.0.0 System Images: android-32 | Google APIs ARM 64 v8a, android-32 | Google Play ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7935034 Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild Languages: Java: 11.0.11 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.67.2 => 0.67.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

It’s just a flow-type error (I think)

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

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
steffenkleinlecommented, Feb 17, 2022

According to the full changelog of v0.67.0 high and balanced were removed as possible values for android_hyphenationFrequency: https://github.com/facebook/react-native/blob/main/CHANGELOG.md#android-specific-3 (6th bullet point). Corresponding commit: https://github.com/facebook/react-native/commit/a0d30b848a07480d0fccec608a62a505c71f8cac

It seems like the docs did just not get adjusted.

Explanation:

hyphenationStrategy must be one of one of Layout#HYPHENATION_FREQUENCY_NONE, Layout#HYPHENATION_FREQUENCY_NORMAL, Layout#HYPHENATION_FREQUENCY_FULL: (https://developer.android.com/reference/android/widget/TextView#setHyphenationFrequency(int))

Thus “high” and “balanced” are not only redundant, but actually don’t do what the value indicates - Layout#BREAK_STRATEGY_BALANCED (constant value: 2) and Layout#BREAK_STRATEGY_HIGH_QUALITY (constant value: 1) are only meant to be used for android:breakStrategy

There is also currently a bug breaking the hyphenation with soft hyphens (\u00AD/­): https://github.com/facebook/react-native/issues/31878

1reaction
ospfrancocommented, Mar 25, 2022

The comment by klinzo explained it, the functionality has been removed, adding the types won’t solve it

Read more comments on GitHub >

github_iconTop Results From Across the Web

setHyphenationFrequency doesn't work - Stack Overflow
I was trying to adding hyphenation on breaking long words in TextView. For example, I have a textView which text is "Recommendations".
Read more >
hyphens - CSS: Cascading Style Sheets - MDN Web Docs
The hyphens CSS property specifies how words should be hyphenated when text wraps across multiple lines. It can prevent hyphenation entirely ...
Read more >
LineBreaker | Android Developers
Value for hyphenation frequency indicating the full amount of automatic hyphenation. This hyphenation frequency is useful for running text and where it's ...
Read more >
History of hyphenation in Android - Cups of Code
normal frequency is often used for informal cases, like short sentences and chat messages. · none frequency indicates no automatic hyphenation.
Read more >
About hyphenation in Android Q - Medium
So, let's sum it up. First, if you app is heavily relying on text output, be sure to check the impact of hyphenation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found