O'Reilly logo

React Native Cookbook by Crysfel Villa, Stan Bershadskiy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exposing custom Android modules

Often you will find yourself writing React Native applications for both iOS and Android. We have discussed how to go about creating native modules in iOS in the first recipe of this chapter. Now it's time to put our green Android robot hats on and write some Java!

This recipe will take us through writing our first Android native module. We will mimic the functionality of the Exposing custom iOS modules recipe, but for Android. We're going to create a HelloManager native module with a greetUser method that takes a name and isAdmin Boolean value arguments. It will return a greeting message that we will display.

Getting ready

For this recipe, we created a React Native application titled NativeModule.

In this recipe, we ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required