Skip to content

Instantly share code, notes, and snippets.

@Mood-al
Created October 2, 2022 22:16
Show Gist options
  • Save Mood-al/06c08a659f1e21e0a2041a79bbacc722 to your computer and use it in GitHub Desktop.
Save Mood-al/06c08a659f1e21e0a2041a79bbacc722 to your computer and use it in GitHub Desktop.
useEffect(() => {
if (value === "" && locale === "ar") {
setDir("rtl");
return;
}
/* The above code is setting the direction of the text to right to left if the user is focussed on
the text box. */
if (focussed) {
isRTL(value) ? setDir("rtl") : setDir("ltr");
}
}, [value, focussed, locale]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment