Fork me on GitHub
#clojurescript
<
2023-01-09
>
Akiz20:01:07

Hi, i would like to import react-native-url-polyfill/auto at the top of my CLJS so the https://github.com/charpeni/react-native-url-polyfill will be automatically applied. It should be equivalent to this #js import 'react-native-url-polyfill/auto'; , how can i do this?

Akiz20:01:08

https://github.com/charpeni/react-native-url-polyfill/blob/main/auto.js

import {setupURLPolyfill} from './index';

setupURLPolyfill();

thheller06:01:27

just (:require ["react-native-url-polyfill/auto"]) in your main ns

Akiz07:01:49

I tried that, but it didn’t have the expected effect.

Akiz07:01:46

I was still getting url.searchParams is not a function (which should be repaired by importing auto.js)

thheller09:01:06

can't comment on that. don't know how the lib works. what are you using to build? in case of shadow-cljs the above require will have the same effect as the import. for other tools not sure.

👍 2
Akiz14:01:28

In this case, I don’t use shadow-cljs. I am building on top of this template https://github.com/joshuamiller/react-native-template-cljs-krell-storybook. I want to use some library that has an error in context of React-Native and react-native-url-polyfill lib should be a cure… I will try it later with shadow-cljs to see if importing is really the problem.

thheller15:01:11

krell should also support this and just work

Akiz16:01:11

Thank you. Then it must be something very different.