如何制作<文本/>作为React Native中图像的水印
How to make <Text /> as watermark of images in React Native
为了使<Text />
作为图像的水印,它在官方文档中显示:
通过嵌套的背景图像
熟悉web的开发人员对一个常见功能的要求是背景图像。要处理这个用例,只需创建一个普通的
<Image>
组件,并向其添加您想在其上分层的任何子组件
return (
<Image source={...}>
<Text>Inside</Text>
</Image>
);
我试过了,"内部"有白色背景,而不是图像的部分。
如何将"Inside"作为图像的水印?谢谢
您可以使用ImageBackground组件
链接->https://reactnative.dev/docs/imagebackground
import React from "react";
import { ImageBackground, StyleSheet, Text, View } from "react-native";
const image = { uri: "https://reactjs.org/logo-og.png" };
const App = () => (
<View style={styles.container}>
<ImageBackground source={image} resizeMode="cover" style={styles.image}>
<Text style={styles.text}>Inside</Text>
</ImageBackground>
</View>
);
const styles = StyleSheet.create({
container: {
flex: 1,
},
image: {
flex: 1,
justifyContent: "center"
},
text: {
color: "white",
fontSize: 42,
lineHeight: 84,
fontWeight: "bold",
textAlign: "center",
backgroundColor: "#000000c0"
}
});
export default App;
相关文章:
- 如何制作<文本/>作为React Native中图像的水印
- JavaScript-添加图像:React Native XCode
- JQuery - 预加载图像(使用 JQuery / native JavaScript / CSS)
- React Native 将 http 图像保存到 Android 相机胶卷
- 在 React Native Webview 中使用本地图像
- 如何在 react native 中加载图像时获取响应标头
- React-Native 使用 XHR 将图像文件发送到 API 后端
- React-Native:将图像网址转换为base64字符串
- React Native静态图像don'脱机捆绑时不会显示在应用程序中
- 如何在React native中动态设置图像的来源
- 如何使用react native创建底部图像为圆形的图像滑块
- 如何制作包装包装“;静态图像资源”;在react native中
- 如何在react native中重叠图像
- 如何在React Native中聚焦裁剪图像
- 如何在native - script中上传图像到PHP服务器
- 在React Native中从Firebase数据库/存储中加载并返回图像
- React Native -使用showShareActionSheetWithOptions共享本地图像
- 在react native listview中添加动态本地图像
- 使用React Native为数组中的每个对象打印图像
- React Native:下载图像并将其转换为Base64图像