Unimodules compatability with latest react-native release?

I am testing out Unimodules in my ‘react-native init’ application (never used Expo before). Are Unimodules compatible with the latest react-native releases i.e. 0.58.6?

I see that ‘Expo SDK v32.0.0 is based once again on React Native 0.57 “September 2018”’. This gave me the impression that I must use 0.57, but it’s unclear whether that is a requirement for Unimodules as well.

Here is more context on the problem I ran into:

I was using react-native@0.57. Installed @unimodules/core and started using Expo’s FileSystem without any problems.

I updated to react-native@0.58.6 and started seeing issues with FileSystem.

I call await FileSystem.getInfoAsync(folderPath, {}) to check whether a specific folder exists. No issues.

I then call await FileSystem.copyAsync(image.uri, destPath), but the app suddenly freezes and the only message I receive is, /Applications/React Native Debugger.app/Contents/Resources/app.asar/node_modules/react-devtools-cor…:3 [React DevTools] Connection to RN closed

I built the app using Xcode 10 (this is my first time trying to debug an app within Xcode), and I see expo.modules.ExponentFileSystemQueue (serial) 1 Running Block (please see attached for more details). Is this something I need to fix or is I need to use a different version of react-native? Thanks!

hello! could you possibly share a reproducible example for this?

I was able to reproduce the bug here:

https://github.com/howardwkim/testExpo

Code inside App.js

Please take a look at this! It prevent’s us from using unimodules in the first place :confused:

hi! looking into it soon, sorry this is still in preview as mentioned in the release blog post so there are some rough edges. will get back to you shortly on this

Hey! It looks like you’re calling FileSystem.copyAsync(fromUri, toUri), whereas the proper way to call copyAsync is to call it with an options dictionary: { from: fromUri, to: toUri }. This fixes the crash:

diff --git a/App.js b/App.js
index 23fc932..bd11d13 100644
--- a/App.js
+++ b/App.js
@@ -26,7 +26,7 @@ export default class App extends Component<Props> {
       if (!memoriesDirectory.exists) {
         await FileSystem.makeDirectoryAsync(folderPath, {});
       }
-      await FileSystem.copyAsync(ret.uri, destPath);
+      await FileSystem.copyAsync({ from: ret.uri, to: destPath });
     } catch (err) {
       console.log('#*# err: ', err);
     }

:slightly_smiling_face:

2 Likes

Thanks!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.