当前位置: 首页 > article >正文

React UI设计黑色蒙层#000000 80%,首次打开弹出,点击图片可以关闭

import { MainProps } from "@src/component/MaskPannel";
import React, { useState } from "react";
import { StyleSheet, View, TouchableOpacity, Image, Text } from 'react-native';

import { UI } from 'xxxxxx'; // 可以自定义Icon图库
const { Icon } = UI;

const MaskPannel: React.FC<MainProps> = (props: MainProps) => {
    const [visible, setVisible] = useState(true);

    const handleClose = () => {
        setVisible(false);
    };

    const handleMinimize = () => {
        // 处理最小化逻辑
    };

    const handleHelp = () => {
        // 处理帮助逻辑
    };

    return (
        <View style={styles.container}>
            <View style={styles.header}>
                <Text style={styles.headerText}>黑色蒙层和覆盖透明图片</Text>
                <View style={styles.iconContainer}>
                    <TouchableOpacity onPress={handleHelp} style={styles.iconButton}>
                        <Icon type='question-circle-o' size={18} tintColor='rgba(255, 255, 255, 0.7)' />
                    </TouchableOpacity>
                    <TouchableOpacity onPress={handleMinimize} style={styles.iconButton}>
                        <Icon type='minus' size={18} tintColor='rgba(255, 255, 255, 0.7)' />
                    </TouchableOpacity>
                    <TouchableOpacity onPress={handleClose} style={styles.iconButton}>
                        <Icon type='times' size={18} tintColor='rgba(255, 255, 255, 0.7)' />
                    </TouchableOpacity>
                </View>
            </View>
            <View style={styles.wrap}>
                {visible && (
                    <View style={styles.overlayContainer}>
                        <TouchableOpacity style={styles.overlay} onPress={handleClose}>
                            <Image source={require('@src/assets/test/bk.png')} style={styles.overlayImage} />
                        </TouchableOpacity>
                    </View>
                )}

                <View style={styles.effectsRow}>
                    <TouchableOpacity style={styles.effectContainer}>
                        <Image source={require('@src/assets/test/pika1.gif')} style={styles.effectImage} />
                        <Text style={styles.effectText}>城堡</Text>
                    </TouchableOpacity>
                    <TouchableOpacity style={styles.effectContainer}>
                        <Image source={require('@src/assets/test/pika2.gif')} style={styles.effectImage} />
                        <Text style={styles.effectText}>发射爱心</Text>
                    </TouchableOpacity>
                    <TouchableOpacity style={styles.effectContainer}>
                        <Image source={require('@src/assets/test/pika3.gif')} style={styles.effectImage} />
                        <Text style={styles.effectText}>创世纪摩托车</Text>
                    </TouchableOpacity>
                </View>
            </View>
        </View>
    );
}

const styles = StyleSheet.create({
    container: {
        // flex: 1,
        borderTopLeftRadius: 12,
        borderTopRightRadius: 12,
        overflow: 'hidden',
        height: 576
    },
    wrap: {
        // flex: 1,
        backgroundColor: '#2E3137',
        paddingTop: 10,
        paddingHorizontal: 20,
    },
    header: {
        flexDirection: 'row',
        justifyContent: 'space-between',
        alignItems: 'center',
        paddingHorizontal: 10,
        paddingVertical: 5,
        backgroundColor: '#25272C',
        height: 40,
    },
    headerText: {
        color: '#FFFFFF',
        fontSize: 14,
        fontWeight: '400',
        fontFamily: 'Microsoft YaHei',
        lineHeight: 16,
    },
    iconContainer: {
        width: 98,
        height: 18,
        flexDirection: 'row',
        justifyContent: 'space-between',
        alignItems: 'center',
    },
    iconButton: {
        width: 18,
        height: 18,
        justifyContent: 'center',
        alignItems: 'center',
    },
    overlayContainer: {
        ...StyleSheet.absoluteFillObject,
        zIndex: 2,
    },
    overlay: {
        ...StyleSheet.absoluteFillObject,
        backgroundColor: 'rgba(0, 0, 0, 0.8)',
    },
    overlayImage: {
        width: 375,
        height: 536,
    },
    effectsRow: {
        flexDirection: 'row',
        justifyContent: 'space-between',
        marginTop: 20,
    },
    effectContainer: {
        alignItems: 'center',
        width: 100,
        backgroundColor: '#2E3137',
        padding: 10,
        borderRadius: 10,
    },
    effectImage: {
        width: 50,
        height: 50,
        marginBottom: 8,
    },
    effectText: {
        fontFamily: 'Microsoft YaHei',
        color: '#FFFFFF',
        fontSize: 12,
    },
});

export default MaskPannel;

1.黑色蒙层#000000 80%,首次打开弹出

2.点击图片可以关闭


http://www.kler.cn/a/414341.html

相关文章:

  • 九、Spring Boot集成Spring Security之授权概述
  • 常用元器件使用方法18:单节锂电池充电管理芯片XT4052的使用方法
  • 读《Effective Java》笔记 - 条目11
  • STM32F10x 定时器
  • Qt程序发布及打包成exe安装包
  • 【dvwa靶场:File Upload系列】File Upload低-中-高级别,通关啦
  • Figma入门-铅笔钢笔工具
  • 大数据笔记
  • Mybatis:Mybatis快速入门
  • 如何将MinIO数据迁移到阿里云OSS
  • LLMs之ell:ell(轻量级函数式提示工程框架)的简介、安装和使用方法、案例应用之详细攻略
  • python+django自动化平台(一键执行sql) 前端vue-element展示
  • 应急响应靶机——easy溯源
  • 算法的NPU终端移植:深入探讨与实践指南
  • 豆包MarsCode算法题:三数之和问题
  • 论 AI(人工智能)的现状
  • 商汤绝影打造A New Member For U,让汽车拥有“有趣灵魂”
  • 力扣 搜索旋转排序数组-33
  • Qt UI设计 菜单栏无法输入名字
  • faiss库中ivf-sq(ScalarQuantizer,标量量化)代码解读-3
  • 自动驾驶科研资料整理
  • 【再谈设计模式】装配器模式 ~复杂结构构建的巧匠
  • 注意http-proxy-middleware要解决跨域问题,想修改origin请求头不要设置changeOrigin=true
  • DeSTSeg: Segmentation Guided Denoising Student-Teacher for Anomaly Detection
  • IPGuard与Ping32结合,提供企业级数据加密与防泄密解决方案,全面保障敏感数据安全
  • Linux服务器安装mongodb