KoreanThinker / react-native-translator

🌐 Unlimited free google translate component & hook (Unofficial)
https://www.npmjs.com/package/react-native-translator
MIT License
81 stars 9 forks source link

ISSUE: display "Enter a Url" before translate show #18

Open 1vinnie1 opened 1 year ago

1vinnie1 commented 1 year ago
useEffect(() => {
    async function translateF() {
      const _result = await translate('vi', 'en', 'gà', {
        type: 'google',
        timeout: 5000,
      });
      console.log('lllllllllllllll', _result);
    }
    translateF();
  }, [translate]);

I write this in my screen, _result alway return "Enter a Url" on the first time I log, but after save the file a again, it show right text. It also happen with

<Translator
          from="en"
          to="ja"
          value={value}
          onTranslated={t => setTimeout(() => setResult(t), 1000)}
        />
        <TextInput
          style={{ backgroundColor: 'red', height: 50, width: '100%' }}
          value={value}
          onChangeText={t => setValue(t)}
        />
        <Text>{result}</Text>
    result display "Enter a Url" before showing right sentences. How can I remove the "Enter a Url" text
soroshzzz26 commented 1 year ago

because its crawling webview empty page it should be fixed i will make a pr

soroshzzz26 commented 1 year ago

another reason that i found is that after generating result webview state should be reset (from and to) because if we pass this(like now) next time you call "translate" you get the previous generated value by webiew in the setInerval

soroshzzz26 commented 1 year ago

also the "eu policy" setInterval causes a sound in the "enter url" page it should check the url in injecetedscript

Dsalvat596 commented 3 months ago

Any update on this?

This text still appears. Is there a way to hide it?

caesar4321 commented 3 months ago

Any update on this?

This text still appears. Is there a way to hide it?

Any update on this?

This text still appears. Is there a way to hide it?

onTranslated={(text) => {
                                    if (text === "Enter a URL") {
                                        setTranslatedBio("");
                                    } else {
                                        setTranslatedBio(text);
                                    }
                                }}