From f952d130ad631c2b42ae98c9084ae10cccb29b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 9 Sep 2015 13:21:18 +0200 Subject: [PATCH] Better fix for the local image working with preload --- Examples/AdvancedEffects/src/Transition.js | 1 + Examples/AdvancedEffects/src/Vignette.js | 1 + RNGL/GLImage.m | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Examples/AdvancedEffects/src/Transition.js b/Examples/AdvancedEffects/src/Transition.js index 6262249..146405e 100644 --- a/Examples/AdvancedEffects/src/Transition.js +++ b/Examples/AdvancedEffects/src/Transition.js @@ -6,6 +6,7 @@ class Transition extends React.Component { const { width, height, shader, progress, from, to, uniforms } = this.props; const scale = React.PixelRatio.get(); return true} onMoveShouldSetResponder={() => true} onResponderMove={this.onResponderMove} diff --git a/RNGL/GLImage.m b/RNGL/GLImage.m index e9c4d20..9635e2d 100644 --- a/RNGL/GLImage.m +++ b/RNGL/GLImage.m @@ -79,9 +79,10 @@ RCT_NOT_IMPLEMENTED(-init) // Load the image (without resizing it) if (![_src hasPrefix:@"http://"] && ![_src hasPrefix:@"https://"]) { - // N.B: in this case we don't trigger onload because image is already loaded. - // this behavior is specific to GLCanvas needs self.image = [UIImage imageNamed:_src]; + dispatch_async(dispatch_get_main_queue(), ^{ + if (_onload) _onload(); + }); } else { _loading = [_bridge.imageLoader loadImageWithTag:_src size:CGSizeZero -- 2.26.2