Commit 19bbda90 authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

add an incremented flag to force the re-render of glview when using GL.Target

parent 0483ff5e
......@@ -6,6 +6,7 @@
@property (nonatomic) NSDictionary *uniforms;
@property (nonatomic) NSArray *targetUniforms;
@property (nonatomic) BOOL opaque;
@property (nonatomic) NSNumber *targetIncrement;
- (instancetype)initWithBridge:(RCTBridge *)bridge;
......
......@@ -127,6 +127,11 @@ NSString* srcResource (id res)
[self setNeedsDisplay];
}
- (void)setTargetIncrement:(NSNumber *)targetIncrement
{
[self setNeedsDisplay];
}
- (void)setTargetUniforms:(NSArray *)targetUniforms
{
_targetUniforms = targetUniforms;
......
......@@ -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
{
......
......@@ -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 <View style={parentStyle}>
{targets}
<GLViewNative ref="native" {...props} style={nativeStyle} children={undefined} targetUniforms={targetUniforms} />
<GLViewNative
ref="native"
{...props}
style={nativeStyle}
children={undefined}
targetUniforms={targetUniforms}
targetIncrement={this._targetIncrement++} />
</View>;
}
else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment