Commit f443f379 authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

Implement events through for container when !visibleContent

parent f3aa34ff
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
@property (nonatomic) BOOL opaque; @property (nonatomic) BOOL opaque;
@property (nonatomic) BOOL autoRedraw; @property (nonatomic) BOOL autoRedraw;
@property (nonatomic) BOOL eventsThrough; @property (nonatomic) BOOL eventsThrough;
@property (nonatomic) BOOL visibleContent;
@property (nonatomic) NSNumber *nbContentTextures; @property (nonatomic) NSNumber *nbContentTextures;
@property (nonatomic) NSNumber *renderId; @property (nonatomic) NSNumber *renderId;
@property (nonatomic) NSArray *imagesToPreload; @property (nonatomic) NSArray *imagesToPreload;
......
...@@ -131,7 +131,20 @@ NSString* srcResource (id res) ...@@ -131,7 +131,20 @@ NSString* srcResource (id res)
- (void)setEventsThrough:(BOOL)eventsThrough - (void)setEventsThrough:(BOOL)eventsThrough
{ {
self.userInteractionEnabled = !eventsThrough; _eventsThrough = eventsThrough;
[self updateUIE];
}
-(void)setVisibleContent:(BOOL)visibleContent
{
_visibleContent = visibleContent;
[self updateUIE];
}
- (void) updateUIE
{
self.userInteractionEnabled = !(_eventsThrough);
self.superview.userInteractionEnabled = !(_eventsThrough && !_visibleContent);
} }
- (void)setData:(GLData *)data - (void)setData:(GLData *)data
......
...@@ -22,6 +22,7 @@ RCT_EXPORT_VIEW_PROPERTY(nbContentTextures, NSNumber); ...@@ -22,6 +22,7 @@ RCT_EXPORT_VIEW_PROPERTY(nbContentTextures, NSNumber);
RCT_EXPORT_VIEW_PROPERTY(opaque, BOOL); RCT_EXPORT_VIEW_PROPERTY(opaque, BOOL);
RCT_EXPORT_VIEW_PROPERTY(autoRedraw, BOOL); RCT_EXPORT_VIEW_PROPERTY(autoRedraw, BOOL);
RCT_EXPORT_VIEW_PROPERTY(eventsThrough, BOOL); RCT_EXPORT_VIEW_PROPERTY(eventsThrough, BOOL);
RCT_EXPORT_VIEW_PROPERTY(visibleContent, BOOL);
RCT_EXPORT_VIEW_PROPERTY(data, GLData); RCT_EXPORT_VIEW_PROPERTY(data, GLData);
RCT_EXPORT_VIEW_PROPERTY(renderId, NSNumber); RCT_EXPORT_VIEW_PROPERTY(renderId, NSNumber);
RCT_EXPORT_VIEW_PROPERTY(imagesToPreload, NSArray); RCT_EXPORT_VIEW_PROPERTY(imagesToPreload, NSArray);
......
...@@ -11,10 +11,10 @@ const { ...@@ -11,10 +11,10 @@ const {
const GLCanvas = requireNativeComponent("GLCanvas", null); const GLCanvas = requireNativeComponent("GLCanvas", null);
const renderVcontent = function (width, height, id, children, visibleContent) { const renderVcontent = function (width, height, id, children, { visibleContent }) {
const childrenStyle = { const childrenStyle = {
position: "absolute", position: "absolute",
top: visibleContent ? 0 : height, top: visibleContent ? 0 : height, // as a workaround for RN, we offset the content so it is not visible but still can be rasterized
left: 0, left: 0,
width: width, width: width,
height: height, height: height,
...@@ -32,7 +32,7 @@ const renderVGL = function (props) { ...@@ -32,7 +32,7 @@ const renderVGL = function (props) {
/>; />;
}; };
const renderVcontainer = function (width, height, contents, renderer, style) { const renderVcontainer = function ({ style, width, height }, contents, renderer) {
const parentStyle = { const parentStyle = {
position: "relative", position: "relative",
...style, ...style,
......
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