mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-03 07:06:04 +00:00
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:
@@ -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);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user