Closed azangru closed 7 years ago
Sorry, I just saw this. Any idea how this can be fixed? Can we PR into the polyfill for a fix? Or maybe only import the package if window
is available?
Or maybe only import the package if window is available?
Trouble with imports is, they are static; we can't import conditionally.
Thanks for setting up that test, it worked great! 😃 I think I fixed it here https://github.com/souporserious/react-view-pager/commit/762f877a12f292fc4ad185dcd655be9f3e88a300 do you need me to do a release to test it out?
I added a note to the PR with a caution about the test. I will look into it a bit closer tomorrow. I believe as it stands it may produce false positives. For example, you may call window in componentDidMount, which will work fine with SSR, but will probably fail the test.
But if you can release the current version of the module, that would be awesome, since you already fixed some other bugs I am worried about :-) I can then live-test it in my project and let you know whether it breaks anything :-)
Alright it's released https://github.com/souporserious/react-view-pager/commit/6110a0146fd332a3278690f2ef65ce354dfa4903 finger's crossed, feel free to close this if it works.
Awesome! Works great! I'll close the issue then.
On an unrelated note: have you ever had a chance to test react-view-pager on an Android phone? In the project I am working on, it feels surprizingly more sluggish than on an iPhone or on the desktop, and I can't figure out whether it's something that I did or whether it's a genuine problem with React Motion / react-view-pager, which for whatever reason behaves worse on Android than on iPhones. Or is it that iPhones are just so much more powerful (which would be strange, because the Android phone I tried it on was a reasonably new Sony Xperia)
Awesome! I'm glad it worked. Bummed to hear it is sluggish on Android. Are you testing that in a dev or prod environment? I know React Motion does better in a prod environment. Now that I've figured out a path to all of this stuff I want to go back and really focus on getting the best performance. There are some functions that get called a lot like here that I want to look at and see how we can make it as fast as possible.
Are you testing that in a dev or prod environment?
Prod, definitely :-)
Because of
resize-observer-polyfill
's generous use ofwindow
:-(