package com.terrylinla.rnsketchcanvas;

import android.util.Log;

import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;

public class SketchCanvasModule extends ReactContextBaseJavaModule {
    SketchCanvasModule(ReactApplicationContext reactContext) {
        super(reactContext);
    }

    @Override
    public String getName() {
        return "SketchCanvasModule";
    }

    @ReactMethod
    public void transferToBase64(int tag, String type, boolean transparent, Callback callback){
        try {
            String base64 = SketchCanvasManager.Canvas.getBase64(type, transparent);
            callback.invoke(null, base64);
        } catch (Exception e) {
            callback.invoke(e.getMessage(), null);
        }
    }
}
@@ -266,16 +266,178 @@
 tMethod;
+%0Aimport com.facebook.react.uimanager.NativeViewHierarchyManager;%0Aimport com.facebook.react.uimanager.UIBlock;%0Aimport com.facebook.react.uimanager.UIManagerModule;
 %0A%0Apublic
@@ -740,16 +740,22 @@
 e64(
+final 
 int tag,
  Str
@@ -750,16 +750,22 @@
 int tag,
+ final
  String 
@@ -769,16 +769,22 @@
 ng type,
+ final
  boolean
@@ -796,16 +796,22 @@
 sparent,
+ final
  Callbac
@@ -853,24 +853,327 @@
     
-String base64
+final ReactApplicationContext context = getReactApplicationContext();%0A            UIManagerModule uiManager = context.getNativeModule(UIManagerModule.class);%0A            uiManager.addUIBlock(new UIBlock() %7B%0A                public void execute(NativeViewHierarchyManager nvhm) %7B%0A                    SketchCanvas view
  = 
+(
 Sket
@@ -1184,22 +1184,73 @@
 nvas
-Manager.Canvas
+) nvhm.resolveView(tag);%0A                    String base64 = view
 .get
@@ -1280,32 +1280,40 @@
 t);%0A            
+ 
+       
 callback.invoke(
@@ -1327,16 +1327,50 @@
 ase64);%0A
+                %7D%0A            %7D);%0A
         

fix #47