react-native-translator icon indicating copy to clipboard operation
react-native-translator copied to clipboard

ISSUE: display "Enter a Url" before translate show

Open 1vinnie1 opened this issue 2 years ago • 6 comments

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
    

1vinnie1 avatar Jun 23 '23 04:06 1vinnie1

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

soroshzzz26 avatar Sep 02 '23 17:09 soroshzzz26

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 avatar Sep 02 '23 18:09 soroshzzz26

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

soroshzzz26 avatar Sep 02 '23 18:09 soroshzzz26

Any update on this?

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

DanielOnramp avatar Jun 12 '24 21:06 DanielOnramp

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);
									}
								}}

caesar4321 avatar Jun 18 '24 13:06 caesar4321