undefined не является объектом (оценка '_reactNative.Text.defaultProps.allowFrontScaling)

Я знаю, что этот вопрос немного устарел, однако я столкнулся с подобным случаем в одном из моих проектов и принял этот вопрос и решил поделиться своим решением, которое отлично сработало для меня, и надеюсь, что он будет служить другим тем же.

private string ConvertToWesternArbicNumerals(string input)
{
    var result = new StringBuilder(input.Length);

    foreach (char c in input.ToCharArray())
    {
        //Check if the characters is recognized as UNICODE numeric value if yes
        if (char.IsNumber(c))
        {
            // using char.GetNumericValue() convert numeric Unicode to a double-precision 
            // floating point number (returns the numeric value of the passed char)
            // apend to final string holder
            result.Append(char.GetNumericValue(c));
        }
        else
        {
            // apend non numeric chars to recreate the orignal string with the converted numbers
            result.Append(c);
        }
    }

    return result.ToString();
}

теперь вы можете просто вызвать функцию, чтобы вернуть западные арабские цифры.

1
задан CollierPlays 27 February 2019 в 17:37
поделиться

1 ответ

Попробуйте изменить

Text.defaultProps.allowFontScaling = AppConfig.allowTextFontScaling 

на

Text.allowFontScaling = AppConfig.allowTextFontScaling . 

. Если это не работает, необходимо явно установить allowFontScaling = false для всех экземпляров Text

.
0
ответ дан Arvindh 27 February 2019 в 17:37
поделиться