This React Native application demonstrates the integration of a custom native module. It showcases handling synchronous and asynchronous actions, as well as responding to native events emitted by the module.
The application provides a user interface to interact with these functionalities and display the results.
This app was made for learning purpose
- Native Module Integration: Connects with a custom native module to perform actions.
- Event Handling: Listens to and handles events emitted from the native module.
- Synchronous and Asynchronous Actions: Executes both synchronous and asynchronous functions provided by the native module.
This is an Expo app using expo-dev-client
for its development build, allowing for advanced native module integration.
- Ensure you have Expo CLI installed.
- Node.js and npm (or Yarn) installed on your development machine.
To run this application, follow these steps:
- Clone the repository:
git clone git@github.com:jtvargas/MyNativeModules.git
- Navigate to the project directory:
cd mynativemodules
- Install dependencies:
yarn
- Open Xcode (
ios/MyNativeModules.xcworkspace
) and build the project - Start the Expo development server:
- Run
expo start
to start the Expo Dev Tools in the browser.
- Run
- For running on a simulator/emulator:
- iOS:
npm run ios
orexpo run:ios
- iOS:
The application provides three main buttons to interact with:
- Callback Action: Triggers a synchronous action in the native module.
- Async Action: Initiates an asynchronous action in the native module.
- Reset State: Resets the application state.
Results from these actions, as well as any events emitted by the native module, are displayed on the screen.
If you want to understand better how the code works you can read the comments added in the source code or read this medium blogpost
At the moment I just implemented the iOS native side, the Android part is TBD.
Contributions to this project are welcome. Please ensure to follow the standard pull request process and adhere to coding best practices.