I have an Android class that extends SimpleViewManager class and encapsulates a MapView. Setting props from React Native JavaScript class works like a charm (using the @ReactProp annotation). However, i'd like to be able to call a method on the view, something like the following:
public void centerToMyLocation(MapView view) {
view.getController().setCenter(myLocation);
}
I've tried using the @ReactMethod annotation, getting a ref for the MapView in JavaScript and then call the centerToMyLocation method on that object. But it doesn't work (I get mapViewRef.centerToMyLocation is not a function error).
How can I call the method from a JavaScript class where I render the native MapView component?