From 19bbda90529e347550badf69ac75cbdf740b3f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Tue, 18 Aug 2015 21:03:31 +0200 Subject: [PATCH] add an incremented flag to force the re-render of glview when using GL.Target --- RNGL/GLView.h | 1 + RNGL/GLView.m | 5 +++++ RNGL/GLViewManager.m | 1 + index.js | 14 +++++++++++++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/RNGL/GLView.h b/RNGL/GLView.h index ad277d3..d466a4b 100644 --- a/RNGL/GLView.h +++ b/RNGL/GLView.h @@ -6,6 +6,7 @@ @property (nonatomic) NSDictionary *uniforms; @property (nonatomic) NSArray *targetUniforms; @property (nonatomic) BOOL opaque; +@property (nonatomic) NSNumber *targetIncrement; - (instancetype)initWithBridge:(RCTBridge *)bridge; diff --git a/RNGL/GLView.m b/RNGL/GLView.m index 6c21bfe..acf8355 100644 --- a/RNGL/GLView.m +++ b/RNGL/GLView.m @@ -127,6 +127,11 @@ NSString* srcResource (id res) [self setNeedsDisplay]; } +- (void)setTargetIncrement:(NSNumber *)targetIncrement +{ + [self setNeedsDisplay]; +} + - (void)setTargetUniforms:(NSArray *)targetUniforms { _targetUniforms = targetUniforms; diff --git a/RNGL/GLViewManager.m b/RNGL/GLViewManager.m index b9a6b99..0ce3588 100644 --- a/RNGL/GLViewManager.m +++ b/RNGL/GLViewManager.m @@ -19,6 +19,7 @@ RCT_EXPORT_VIEW_PROPERTY(uniforms, NSDictionary); RCT_EXPORT_VIEW_PROPERTY(shader, NSNumber); RCT_EXPORT_VIEW_PROPERTY(targetUniforms, NSArray); RCT_EXPORT_VIEW_PROPERTY(opaque, BOOL); +RCT_EXPORT_VIEW_PROPERTY(targetIncrement, NSNumber); - (UIView *)view { diff --git a/index.js b/index.js index 6bda85f..fd3c9a0 100644 --- a/index.js +++ b/index.js @@ -45,6 +45,12 @@ Target.propTypes = { const GLViewNative = requireNativeComponent("GLView", GLView); class GLView extends Component { + + constructor (props, context) { + super(props, context); + this._targetIncrement = 0; // This is a current workaround to force the refresh of targets + } + setNativeProps (props) { this.refs.native.setNativeProps(props); } @@ -85,7 +91,13 @@ class GLView extends Component { }); return {targets} - + ; } else { -- 2.26.2