Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable RTL using ClojureScript, Re-natal and React-Native?

I'm develop an app in re-natal platform which is based on ClojureScript and React Native. I have an issue to disable RTL for my application in Android platform.

this is the code to disable RTL in react-native which works totally fine:

const ReactNative = require('react-native');

ReactNative.I18nManager.allowRTL(false); 

And I think this is the exact above code in cljs:

(def ReactNative (js/require "react-native"))

(.allowRTL (.I18nManager ReactNative) false)

However, I got this error:

"Object is not a function (evaluating 'my-app.android.core.ReactNative.I18nManager())"

react-native: "v0.50.3"

react: "16.0.0"

re-frame: "0.9.2"

clojurescript: "1.9.542"

clojure: "1.9.0-alpha16"

screenshot of error

like image 224
petros Avatar asked Jul 26 '26 03:07

petros


1 Answers

I18nManager is a field (not a method) of ReactNative object. It should be accessed like this: (.-I18nManager ReactNative). So, the equivalent of

ReactNative.I18nManager.allowRTL(false); 

will be

(.allowRTL (.-I18nManager ReactNative) false)
like image 99
OlegTheCat Avatar answered Jul 27 '26 21:07

OlegTheCat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!