Hi. I was wondering what would be the steps required if I wanted to support a react-native library that requires native code/linking, without ejecting?
Would I have to create my own Expo module, and would it require some approval from the Expo team?
Convince the Expo team to add the library to future versions of Expo
Of course adding stuff to Expo is not done lightly because everybody who does not need the library would still it included, making their apps a little bigger.
No, it’s no different to any of the other modules with native code that Expo includes (unless I’m missing something). I mean, in some cases they might have made some modifications to the code to make it work better in the Expo client, I suppose, but for something like rn-fetch-blob I don’t think that would be necessary.
If you’re not using Expo you need to install it (possibly using react-native link depending on your version of React Native). But the Expo team has done this already, so everybody using the Managed Workflow can just use react-native-screens or other things that depend on it (e.g. React Navigation). But if for some reason you didn’t need react-native-screens you’re still stuck with it taking up space in your app.
i.e. as far as I understand it, native code in a React Native app is basically either linked in or not. If it’s linked in you can use it. If it’s not, you can’t. I don’t think there’s anything like a module you can dynamically link in (like a plugin or KEXT or Linux kernel module etc.) after the native code is already compiled, which I think would be required for what you’re thinking of.
The Expo team is working to allow customising builds of standalone apps which would, I think, make it much easier to add things in without everybody paying the price.
They’re also working to make it much less painful to eject.
I don’t know when the above will be ready, but things should be closer when SDK 37 is released (planned for 31 March AFAIK.)
I really appreciate the detailed answer, this seems much more complex issue than I anticipated.
The main reason I (and others) need rn-fetch-blob is because fetch is very limited, it doesn’t support progress and it doesn’t seem to handle large files well. rn-fetch-blob can handle chunks and other things with ease in regards to downloading and uploading blobs.
rn-fetch-blob implements native code, and so it cannot be used in expo based projects. You would need to eject from expo from my understanding
IMO rn-fetch-blob would be very valuable library for Expo. Hopefully there will be an easier way to add libraries with native code in the future. I think my best option is to eject at this time in order to unblock the development of my app, and hopefully un-eject in the near future.