wcandillon / react-native-redash

The React Native Reanimated and Gesture Handler Toolbelt
https://wcandillon.gitbook.io/redash/
MIT License
1.98k stars 117 forks source link

ReText doesn't render unicode on Android #417

Closed VincentQuillien closed 3 years ago

VincentQuillien commented 3 years ago

Hi !

It seems ReText cannot render unicode characters on Android, I've tried both device and simulator and with different fonts.

const text = useSharedValue('Beautiful Zürich Switzerland');

return <ReText text={text} />;

Screenshot_1610467365 Works fine on iOS.

wcandillon commented 3 years ago

Oh no 😅 Would https://github.com/axelra-ag/react-native-animateable-text be a suitable alternative for now? (cc @JonnyBurger)

VincentQuillien commented 3 years ago

Yes I'll replace my instances of ReText with AnimateableText, thanks @JonnyBurger !

Iltimirov commented 3 years ago

It's pity, but neither retext or animateable-text do not work with Russian symbols :(

I've tried it only on android emulator with animateable-text 0.5.9

const animatedText = useDerivedValue(
  () => `использовать ${value.value} бонусов test`,
)
const animatedProps = useAnimatedProps(() => {
  return {
    text: animatedText.value,
  }
})
Снимок экрана 2021-02-25 в 21 30 53
JonnyBurger commented 3 years ago

I think this is a bug in Reanimated (or even RN possibly). I have opened an issue here: https://github.com/software-mansion/react-native-reanimated/issues/1782

The issue is also reproducible without ReText and also happens in my react-native-animteable-text component.

However, I have found a workaround: It works if you don't wrap the text in a shared value and use it in useAnimatedProps directly.

Notice how in the following example one way works and one don't. If you rearchitect it a bit I'm sure you can make it work.

import React from 'react';
import {TextInput} from 'react-native';
import Animated, {
  useAnimatedProps,
  useSharedValue,
} from 'react-native-reanimated';

const AnimatedTextInput = Animated.createAnimatedComponent(TextInput);

const value = 'ööö';

export const Repro = () => {
  const sharedValue = useSharedValue(value);
  const animatedProps = useAnimatedProps(() => {
    return {value: `${value} ${sharedValue.value}`};
  }, []);
  return <AnimatedTextInput animatedProps={animatedProps} />;
};

// Result: ööö ööö

I think this issue can be closed as there is nothing that can be done in this repo.

piaskowyk commented 3 years ago

We have PR ready to merge fix in Reanimated: https://github.com/software-mansion/react-native-reanimated/pull/1784

Stevemoretz commented 3 years ago

Looks like it is merged?

JonnyBurger commented 3 years ago

Yes, fixed in newest Reanimated version 👍🏼 one to close @wcandillon 🙌🏼