List of usage examples for com.facebook.react.uimanager UIBlock UIBlock
UIBlock
From source file:com.boundlessgeo.spatialconnect.jsbridge.RNSpatialConnect.java
License:Apache License
@ReactMethod public void bindMapView(final int tag, final Callback successCallback) { UIManagerModule uiManager = this.reactContext.getNativeModule(UIManagerModule.class); uiManager.addUIBlock(new UIBlock() { public void execute(NativeViewHierarchyManager nvhm) { MapView mapView = (MapView) nvhm.resolveView(tag); //mapView.getMapAsync(this); mapView.getMapAsync(new OnMapReadyCallback() { @Override//www . j a va 2s.c o m public void onMapReady(final GoogleMap googleMap) { mGoogleMap = googleMap; successCallback.invoke(false, "success"); } }); } }); }
From source file:com.boundlessgeo.spatialconnect.jsbridge.RNSpatialConnect.java
License:Apache License
@ReactMethod public void addRasterLayers(final ReadableArray storeIdArray) { UIManagerModule uiManager = this.reactContext.getNativeModule(UIManagerModule.class); uiManager.addUIBlock(new UIBlock() { public void execute(NativeViewHierarchyManager nvhm) { List<String> storeIds = new ArrayList<>(storeIdArray.size()); for (int index = 0; index < storeIdArray.size(); index++) { storeIds.add(storeIdArray.getString(index)); }//from w ww .j ava2 s .co m List<SCDataStore> stores = SpatialConnect.getInstance().getDataService().getActiveStores(); for (SCDataStore store : stores) { List<TileOverlay> tiles = tileoverlays.get(store.getStoreId()); if (storeIds.contains(store.getStoreId())) { if (tiles == null) { if (store instanceof GeoPackageStore && ((GeoPackageStore) store).getTileSources().size() > 0) { SCRasterStore rs = new GpkgRasterSource((GeoPackageStore) store); List<TileOverlay> newTiles = new ArrayList<TileOverlay>(); for (String tableName : rs.rasterLayers()) { TileOverlay t = rs.overlayFromLayer(tableName, mGoogleMap); newTiles.add(t); } tileoverlays.put(store.getStoreId(), newTiles); } } } else { if (tiles != null) { for (TileOverlay tile : tiles) { tile.remove(); } tileoverlays.remove(store.getStoreId()); } } } } }); }