What is expo-modules-autolinking?
The expo-modules-autolinking package is designed to automatically link native modules in Expo projects. It simplifies the process of integrating native code with JavaScript by scanning for native modules and linking them without requiring manual configuration.
What are expo-modules-autolinking's main functionalities?
Automatic Module Discovery
This feature allows you to automatically discover native modules in your project. The `findModules` function scans the project directory and returns a list of native modules that can be linked.
const { findModules } = require('expo-modules-autolinking');
const modules = findModules();
console.log(modules);
Custom Module Linking
This feature enables custom linking of specific modules for a given platform. The `linkModules` function takes an object with the modules to link and the target platform, and performs the linking process.
const { linkModules } = require('expo-modules-autolinking');
linkModules({
modules: ['module1', 'module2'],
platform: 'ios'
});
Configuration Options
This feature allows you to configure the autolinking process with various options. The `configure` function accepts an object with configuration settings such as target platforms and modules to exclude from linking.
const { configure } = require('expo-modules-autolinking');
configure({
platforms: ['ios', 'android'],
exclude: ['module-to-exclude']
});
Other packages similar to expo-modules-autolinking
rnpm
The rnpm (React Native Package Manager) package was an early tool for managing and linking native modules in React Native projects. While it provided basic autolinking capabilities, it has been largely deprecated in favor of more modern tools like react-native-auto-linking and Expo's autolinking features.
Scripts that autolink Expo modules.
API documentation
Installation in managed Expo projects
For managed Expo projects, please follow the installation instructions in the API documentation for the latest stable release. If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
Installation in bare React Native projects
For bare React Native projects, you must ensure that you have installed and configured the expo
package before continuing.
Add the package to your npm dependencies
npm install expo-modules-autolinking
Contributing
Contributions are very welcome! Please refer to guidelines described in the contributing guide.