callstack / callstack/masked-view

Forward the nested view style as contentContainerStyle

Open
#247 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.2k
Forks
131
PR merge metrics
No merged PRs in 30d

Description

## Describe the feature

Export a contentContainerStyle prop to apply to the inner View inside masked view:

Image

```javascript
export default class MaskedView extends React.Component {
_hasWarnedInvalidRenderMask = false;

render(): React.Node {
const { maskElement, children, contentContainerStyle, ...otherViewProps } = this.props;

if (!React.isValidElement(maskElement)) {
if (!this._hasWarnedInvalidRenderMask) {
console.warn(
'MaskedView: Invalid `maskElement` prop was passed to MaskedView. ' +
'Expected a React Element. No mask will render.',
);
this._hasWarnedInvalidRenderMask = true;
}
return {children};
}

return (


{maskElement}

{children}

);
}
}
```

Today we have it patched locally but it would be ideal if it were possible without the patch

## Motivation

The current `StyleSheet.absoluteFill` is bringing problems in some cases, we have to calculate the size before apply the mask and is kinda annoying when we need to update the size after render.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.