React native参考手册
Components: MaskedViewIOS
MaskedViewIOS
使用maskElement
道具中指定的遮罩渲染子视图。
import React from 'react';
import { MaskedView, Text, View } from 'react-native';
class MyMaskedView extends React.Component {
render() {
return (
<MaskedView
style={{ flex: 1 }}
maskElement={
<View style={styles.maskContainerStyle}>
<Text style={styles.maskTextStyle}>
Basic Mask
</Text>
</View>
}
>
<View style={{ flex: 1, backgroundColor: 'blue' }} />
</MaskedView>
);
}
}
上述示例将呈现一个填充其父项的蓝色背景视图,然后使用标有“基本遮罩”的文本遮罩该视图。
maskElement
道具所呈现的视图的alpha通道决定了视图的内容和背景显示了多少。完全或部分不透明像素允许底层内容显示,但完全透明的像素会遮挡该内容。
道具
ViewPropTypes props...
maskElement: element
Components: MaskedViewIOS相关
React Native 是一个 JavaScript 的框架,用来撰写实时的、可原生呈现 iOS 和 Android 的应用。
主页 | https://facebook.github.io/react-native/ |
源码 | https://github.com/facebook/react-native |
发布版本 | 0.49 |