callstack / callstack/masked-view
Forward the nested view style as contentContainerStyle
- 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:
```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
Assessment
This issue has not been assessed yet.