mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 23:54:53 +00:00
[android] Make SvgView.drawChildren synchronized
Fix race-condition https://github.com/react-native-community/react-native-svg/issues/948 Refactor toDataUrl
This commit is contained in:
@@ -26,27 +26,21 @@ class SvgViewModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
|
||||
|
||||
@ReactMethod
|
||||
public void toDataURL(int tag, Callback successCallback) {
|
||||
SvgView svg = SvgViewManager.getSvgViewByTag(tag);
|
||||
|
||||
if (svg != null) {
|
||||
successCallback.invoke(svg.toDataURL());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ReactMethod
|
||||
public void toDataURL(int tag, ReadableMap options, Callback successCallback) {
|
||||
SvgView svg = SvgViewManager.getSvgViewByTag(tag);
|
||||
|
||||
if (svg != null) {
|
||||
successCallback.invoke(
|
||||
svg.toDataURL(
|
||||
options.getInt("width"),
|
||||
options.getInt("height")
|
||||
)
|
||||
);
|
||||
if (options != null) {
|
||||
successCallback.invoke(
|
||||
svg.toDataURL(
|
||||
options.getInt("width"),
|
||||
options.getInt("height")
|
||||
)
|
||||
);
|
||||
} else {
|
||||
successCallback.invoke(svg.toDataURL());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user