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

After update to MIUI 12,Text is cut off #29259

Open
jinshiyi11 opened this issue Jul 1, 2020 · 23 comments
Open

After update to MIUI 12,Text is cut off #29259

jinshiyi11 opened this issue Jul 1, 2020 · 23 comments

Comments

@jinshiyi11
Copy link

Description

After update to MIUI 12, Text is cut off.
image
the actual text is QQ,but only Q is displayed

React Native version:

React Native version: 0.60.5
model: MI 10 Pro
android:10
MIUI:12.0.1
Fingerprint -> Xiaomi/cmi/cmi:10/QKQ1.191117.002/V12.0.1.0.QJACNXM:user/release-keys

Steps To Reproduce

updrade XiaoMi Phone's system to MIUI 12

Expected Results

full text is expected to display,like below
image

@xiaohui-hiwintech
Copy link

xiaohui-hiwintech commented Jul 1, 2020

yeah, i have the same issue in miui 12 but it is fine in miui 10 and 9. Not sure it's a issue in react-native or miui.
My rn version is 0.59.9.
image
The phone number and the word 'message' disappeared.

@jinshiyi11
Copy link
Author

currently ,we hook Text render to make it work correctly.
`
const originTextRender = Text.render;

Text.render = function render(props, ref) {

    return originTextRender.apply(this, [{ ...props,  style: [isMiUi12() ? {fontFamily:''} : null, props.style] }, ref]);  

};  

`

@sapjax
Copy link

sapjax commented Jul 3, 2020

This is caused by the default FontFamily of MIUI 12: "小米兰亭 PRO". It's a variable opentype Font, look like react-native doesn't support it.

@sapjax
Copy link

sapjax commented Jul 3, 2020

@jinshiyi11
What is your code to detect MIUI12 in isMiUi12?

@chrisglein chrisglein added Component: Text Needs: Environment Info Please run `react-native info` and edit your issue with that command's output. Newer Patch Available labels Jul 8, 2020
@github-actions
Copy link

github-actions bot commented Jul 8, 2020

⚠️ Missing Environment Information
ℹ️ Your issue may be missing information about your development environment. You can obtain the missing information by running react-native info in a console.

@github-actions
Copy link

github-actions bot commented Jul 8, 2020

⚠️ Using Old Version
ℹ️ It looks like you are using an older version of React Native. Please upgrade to the latest version, and verify if the issue persists. If it does not, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the current release.

@react-native-bot react-native-bot removed the Needs: Environment Info Please run `react-native info` and edit your issue with that command's output. label Jul 8, 2020
@bashen1
Copy link

bashen1 commented Jul 17, 2020

The same issue in miui 12

@Foveluy
Copy link

Foveluy commented Jul 21, 2020

currently ,we hook Text render to make it work correctly.
`
const originTextRender = Text.render;

Text.render = function render(props, ref) {

    return originTextRender.apply(this, [{ ...props,  style: [isMiUi12() ? {fontFamily:''} : null, props.style] }, ref]);  

};  

`

cannot fix the problem

@AKB48
Copy link
Contributor

AKB48 commented Jul 22, 2020

It did work to set a default property - {fontFamily: ''} in style property of Text

@KingAmo
Copy link

KingAmo commented Sep 18, 2020

same here,

@everfire130
Copy link
Contributor

The same issue in RN0.63.2

@jinshiyi11
Copy link
Author

jinshiyi11 commented Oct 9, 2020

@jinshiyi11
What is your code to detect MIUI12 in isMiUi12?

the code likes below

import {  Platform, NativeModules } from 'react-native';

function isMiUi12() {
    if(Platform.OS === 'android' && NativeModules.PlatformConstants){
        const fingerprint = NativeModules.PlatformConstants.Fingerprint && NativeModules.PlatformConstants.Fingerprint.toLowerCase();
      
        // MiUi12 fingerprint:Xiaomi/cmi/cmi:10/QKQ1.191117.002/V12.0.1.0.QJACNXM:user/release-keys
        if(fingerprint && fingerprint.startsWith('xiaomi') && fingerprint.indexOf('v12')!==-1){
            return true;
        }
    }
   
    return false;
}

@fangasvsass
Copy link

any update ?

@onegaop
Copy link

onegaop commented Nov 9, 2020

MIUI 12.0.5 , same here

@michael2h4ng
Copy link

michael2h4ng commented Nov 20, 2020

This looks more like a MIUI 12 issue to me.

We had the same problem, but when we changed the system's font weight to another value (in Settings - Display - Text size & font weight), the issue disappeared. When we changed it back to the original value, the rendering remained perfect.

@inkCrazy
Copy link

inkCrazy commented Jan 4, 2021

最后你们怎么解决问题的,RN0.62.2 小米10, MIUI12.0.8同样问题。

@magicismight
Copy link
Contributor

if (Platform.OS === 'android' && NativeModules.PlatformConstants) {
  const fingerprint = NativeModules.PlatformConstants.Fingerprint;

  if (fingerprint?.match(/^(xiaomi|redmi|mi|mix|poco).*\/v12\..*/i)) {
    const originTextRender = Text.render;

    Text.render = function render(props, ref) {
      return originTextRender.apply(this, [
        {
          ...props,
          style: [{ fontFamily: '' }, props.style]
        },
        ref
      ]);
    };
  }
}

@inkCrazy
Copy link

inkCrazy commented Jan 7, 2021

if (Platform.OS === 'android' && NativeModules.PlatformConstants) {
  const fingerprint = NativeModules.PlatformConstants.Fingerprint;

  if (fingerprint?.match(/^(xiaomi|redmi|mi|mix|poco).*\/v12\..*/i)) {
    const originTextRender = Text.render;

    Text.render = function render(props, ref) {
      return originTextRender.apply(this, [
        {
          ...props,
          style: [{ fontFamily: '' }, props.style]
        },
        ref
      ]);
    };
  }
}

这个是写在app.js里面,全局设置字体?

@hussainahmad
Copy link

if (Platform.OS === 'android' && NativeModules.PlatformConstants) {
  const fingerprint = NativeModules.PlatformConstants.Fingerprint;

  if (fingerprint?.match(/^(xiaomi|redmi|mi|mix|poco).*\/v12\..*/i)) {
    const originTextRender = Text.render;

    Text.render = function render(props, ref) {
      return originTextRender.apply(this, [
        {
          ...props,
          style: [{ fontFamily: '' }, props.style]
        },
        ref
      ]);
    };
  }
}

@magicismight where this code be put?

@yorickshan
Copy link

fontFamily: 'System'

it works for me

@zhuminjunivan

This comment was marked as off-topic.

@github-actions
Copy link

This issue is waiting for author's feedback since 24 days. Please provide the requested feedback 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 25, 2023
@github-actions
Copy link

github-actions bot commented Apr 2, 2023

This issue was closed because the author hasn't provided the requested feedback after 7 days.

@github-actions github-actions bot closed this as completed Apr 2, 2023
@facebook facebook locked as resolved and limited conversation to collaborators Apr 2, 2023
@NickGerleman NickGerleman reopened this Jun 9, 2023
@NickGerleman NickGerleman removed Needs: Author Feedback Newer Patch Available Stale There has been a lack of activity on this issue and it may be closed soon. labels Jun 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests