Search in sources :

Example 26 with WritableArray

use of com.facebook.react.bridge.WritableArray in project maps by rnmapbox.

the class GeoJSONUtils method fromLatLng.

public static WritableArray fromLatLng(LatLng latLng) {
    double[] coords = new double[] { latLng.getLongitude(), latLng.getLatitude() };
    WritableArray writableCoords = new WritableNativeArray();
    writableCoords.pushDouble(coords[0]);
    writableCoords.pushDouble(coords[1]);
    return writableCoords;
}
Also used : WritableArray(com.facebook.react.bridge.WritableArray) WritableNativeArray(com.facebook.react.bridge.WritableNativeArray)

Example 27 with WritableArray

use of com.facebook.react.bridge.WritableArray in project maps by rnmapbox.

the class RCTMGLMapView method getCenter.

public void getCenter(String callbackID) {
    LatLng center = mMap.getCameraPosition().target;
    WritableArray array = new WritableNativeArray();
    array.pushDouble(center.getLongitude());
    array.pushDouble(center.getLatitude());
    WritableMap payload = new WritableNativeMap();
    payload.putArray("center", array);
    AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
    mManager.handleEvent(event);
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap) WritableArray(com.facebook.react.bridge.WritableArray) WritableNativeMap(com.facebook.react.bridge.WritableNativeMap) LatLng(com.mapbox.mapboxsdk.geometry.LatLng) WritableNativeArray(com.facebook.react.bridge.WritableNativeArray) AndroidCallbackEvent(com.mapbox.rctmgl.events.AndroidCallbackEvent)

Example 28 with WritableArray

use of com.facebook.react.bridge.WritableArray in project maps by rnmapbox.

the class RCTMGLMapView method getCoordinateFromView.

public void getCoordinateFromView(String callbackID, PointF pointInView) {
    float density = getDisplayDensity();
    pointInView.x *= density;
    pointInView.y *= density;
    LatLng mapCoordinate = mMap.getProjection().fromScreenLocation(pointInView);
    WritableMap payload = new WritableNativeMap();
    WritableArray array = new WritableNativeArray();
    array.pushDouble(mapCoordinate.getLongitude());
    array.pushDouble(mapCoordinate.getLatitude());
    payload.putArray("coordinateFromView", array);
    AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
    mManager.handleEvent(event);
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap) WritableArray(com.facebook.react.bridge.WritableArray) WritableNativeMap(com.facebook.react.bridge.WritableNativeMap) LatLng(com.mapbox.mapboxsdk.geometry.LatLng) WritableNativeArray(com.facebook.react.bridge.WritableNativeArray) AndroidCallbackEvent(com.mapbox.rctmgl.events.AndroidCallbackEvent)

Example 29 with WritableArray

use of com.facebook.react.bridge.WritableArray in project intercom-react-native by intercom.

the class IntercomHelpCenterHelpers method parseHelpCenterSectionsToReadableArray.

public static WritableArray parseHelpCenterSectionsToReadableArray(List<HelpCenterSection> helpCenterSectionList) {
    WritableArray sections = Arguments.createArray();
    HelpCenterSection[] sectionsArray = new HelpCenterSection[helpCenterSectionList.size()];
    sectionsArray = helpCenterSectionList.toArray(sectionsArray);
    ;
    for (HelpCenterSection section : sectionsArray) {
        sections.pushMap(parseHelpCenterSectionToReadableMap(section));
    }
    return sections;
}
Also used : WritableArray(com.facebook.react.bridge.WritableArray) HelpCenterSection(io.intercom.android.sdk.helpcenter.sections.HelpCenterSection)

Example 30 with WritableArray

use of com.facebook.react.bridge.WritableArray in project intercom-react-native by intercom.

the class IntercomHelpCenterHelpers method parseHelpCenterCollectionsContentToReadableMap.

public static WritableMap parseHelpCenterCollectionsContentToReadableMap(HelpCenterCollectionContent helpCenterCollectionContent) {
    WritableMap helpCenterCollection = Arguments.createMap();
    helpCenterCollection.putString("id", helpCenterCollectionContent.getCollectionId());
    helpCenterCollection.putString("title", helpCenterCollectionContent.getTitle());
    helpCenterCollection.putString("summary", helpCenterCollectionContent.getSummary());
    WritableArray articles = parseArticlesToReadableArray(helpCenterCollectionContent.getHelpCenterArticles());
    helpCenterCollection.putArray("articles", articles);
    WritableArray sections = parseHelpCenterSectionsToReadableArray(helpCenterCollectionContent.getHelpCenterSections());
    helpCenterCollection.putArray("sections", sections);
    return helpCenterCollection;
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap) WritableArray(com.facebook.react.bridge.WritableArray)

Aggregations

WritableArray (com.facebook.react.bridge.WritableArray)144 WritableMap (com.facebook.react.bridge.WritableMap)121 ReactMethod (com.facebook.react.bridge.ReactMethod)41 ArrayList (java.util.ArrayList)38 List (java.util.List)25 WritableNativeMap (com.facebook.react.bridge.WritableNativeMap)20 StringeeClient (com.stringee.StringeeClient)20 StringeeError (com.stringee.exception.StringeeError)20 Conversation (com.stringee.messaging.Conversation)20 WritableNativeArray (com.facebook.react.bridge.WritableNativeArray)18 Text (com.google.mlkit.vision.text.Text)10 ReadableMap (com.facebook.react.bridge.ReadableMap)9 CallbackListener (com.stringee.messaging.listeners.CallbackListener)9 JSONException (org.json.JSONException)8 SuppressLint (android.annotation.SuppressLint)7 Bundle (android.os.Bundle)7 Handler (android.os.Handler)7 Nullable (androidx.annotation.Nullable)7 Face (com.google.mlkit.vision.face.Face)7 Message (com.stringee.messaging.Message)7