Fix Image not rendering the first time svg is displayed

Fix Image not rendering the first time svg is displayed
Add toDataURL method for Svg elements for Android (not finished yet)
This commit is contained in:
Horcrux
2016-08-11 16:27:15 +08:00
parent 76a3e8e32d
commit 857b5f5207
6 changed files with 81 additions and 44 deletions
+4 -4
View File
@@ -24,12 +24,12 @@ RCT_EXPORT_MODULE()
RCT_EXPORT_METHOD(toDataURL:(nonnull NSNumber *)reactTag callback:(RCTResponseSenderBlock)callback)
{
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
UIView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[RNSVGSvgView class]]) {
RCTLogError(@"Invalid svg returned frin registry, expecting RNSVGSvgView, got: %@", view);
} else {
__kindof UIView *view = viewRegistry[reactTag];
if ([view isKindOfClass:[RNSVGSvgView class]]) {
RNSVGSvgView *svg = view;
callback(@[[svg getDataURL]]);
} else {
RCTLogError(@"Invalid svg returned frin registry, expecting RNSVGSvgView, got: %@", view);
}
}];
}