Building custom Android modules for React Native

3Comments

Write your comment…

Hey! Nice introduction tutorial! Do you have any suggestion on the implementation/bridging of an Android service in React-Native?
I'm asking because I'm considering all the available options for making react-native-beacons-android works even when the app is killed.
Thanks ;)

React Native won't be alive in background. Obviously, the Event listener which we created in the React Native layer will also be destroyed. Communication might not be possible. Some people said that it is possible to start the Javascript core from the background. But, I never tried it. I'll let you know if I find some workaround.

Write a reply...

Thanks for this Sriraman, If I want to simply tweak an existing module e.g. react-native-maps to include map style capability, I need to import com.google.android.gms.maps.model.MapStyleOptions; in .java file that extends an Android MapView. However when running the app, it appears the MapStyleOptions is not in scope. Can you give me a clue, what are the steps to make this accessible in the Java? would i need to rebuild somehow from the original master? I don't see a reference to the other imports in this file elsewhere in the project for an example of how it was done.

There are two ways to do it. You can create a new react native module and add the react-native-maps as the dependency.

Write a reply...

Hi, I came here looking for an answer, I need to measure a custom component, but in react native you don't get the method .measure unless it's a native UI component as far as I understand from this:

The methods described here are available on most of the default components provided by React Native. Note, however, that they are not available on composite components that aren't directly backed by a native view. This will generally include most components that you define in your own app.

measure(callback)

... my question is: Making a Bridged (as in this tutorial) component will make it get .measure method? I'd like to know before learning to do this so at least i won't have false expectations...

thank you!

Write a reply...

Join a friendly and inclusive Q&A network for coders

  • 🖥Pick the technologies you like & read great content through your feed.
  • 💬Ask a question when you want to learn more about anything.
  • 🚀Share what you know & build your portfolio.
Sign up nowLearn more

loading ...