Are the underlying Native Modules compiled when they are installed from NPM, or are they compiled when the App is run (i.e. bundled)?
I don't think it's likely that they are compiled when they are installed from NPM as that would require you to have the appropriate compilers on your computer at the time of installation (which I didn't). On top of that, I can't find any files that appear to be the result of a compilation.
However, the reason that I'm not sure, is that changes to the Native code don't seem to be reflected in the final React Native app.
I'm trying to implement a feature that is missing in an NPM package, so to familiarize myself with the package, I've been tinkering around with the Native code.
However, I can change whatever I want, but the changes don't seem to do anything in the final application.
I went so far as to completely delete all of the Native code (the android
and ios
folders) from the given package and then cleared my cache (on both the Expo bundler and on the Expo client), but still nothing happened; somehow the application still seemed to ignore what should have been an obvious error (i.e. missing files).
Does this have something to do with the fact that I'm using Expo? Are the changes being ignored, because the code is being read from a cache somewhere? Am I just fundamentally misunderstanding something?
Any help would be much appreciated.
P.s. My end goal is to be able to modify the aforementioned NPM package, so if it's not possible to modify a Native Module directly, can someone enlighten me as to the correct way to do so? Thanks.
For those of you who may be in a similar situation, it seems that you are unable to modify Native code with Expo unless you eject your app or you use vanilla React Native.
From what I gather, the reason for this is that every Native module that is compatible with Expo, comes pre-bundled with Expo (this includes modules that the Expo team made as well as modules that other people made but the Expo team included).
This means that unless you can get the maintaner of an Expo-compatible Native module to release a new version of their package with your changes applied to it, Expo will not pick up your custom changes.
Even then I can't guarantee it will work, as I don't know whether or not each release of Expo is limited to the versions of the Native modules that it contained at the point of it's release.
If you need more information, it would probably be best to try to contact one of the Expo developers on social media or on the Expo forums.
Here are some additional links. They may go dead eventually, but I'll include them anyways: