import * as React from "react"; import {ImageBackground, StyleProp, TouchableHighlight, View} from "react-native"; import {IProps} from "./render"; import _hooks from "./_hooks"; import {ViewStyle} from "react-native/Libraries/StyleSheet/StyleSheetTypes"; import ComponentHeaderView from "../header"; import app, {ThemeCss} from "../../app"; import Basic from "../../basicPage"; const ComponentRenderView: React.FC = (props) => { const css = app.theme.useGet(); _hooks.useData(props); // 是否展示 状态栏 const hasBar = typeof props.hasBar === "boolean" ? props.hasBar : true; // 状态栏是否浮动 const hasBarFloat = typeof props.hasBarFloat === "boolean" ? props.hasBarFloat : false; // 是否展示 header const hasHeader = typeof props.hasHeader === "boolean" ? props.hasHeader : true; // header 是否浮动 const isHeaderFloat = typeof props.isHeaderFloat === "boolean" ? props.isHeaderFloat : false; // header 是否有底边 const hasHeaderBottomLine = typeof props.hasHeaderBottomLine === "boolean" ? props.hasHeaderBottomLine : false; // 状态条样式 const statusBarStyle: StyleProp = { width: css.width, height: css.app.barHeight, backgroundColor: props.barBg ?? css.app.barBg, } // 状态条浮动 if (hasBarFloat) { statusBarStyle.position = 'absolute'; statusBarStyle.top = 0; statusBarStyle.left = 0; statusBarStyle.right = 0; statusBarStyle.zIndex = 1; } // 状态栏 view const barView = hasBar ? : undefined; // header view const headerView = hasHeader ? : undefined; // 内容样式 const childrenStyle: StyleProp = {flex: 1, position: 'relative'}; let childrenView: any; if (props.bgImage) { childrenView = {barView} {headerView} {props.children} } else { childrenStyle.backgroundColor = props.bgColor ?? css.app.bg; childrenView = {barView} {headerView} {props.children} } // 不可点击 if (props.hasPress) return childrenView; return { Basic.inputBlur() }}> {childrenView} } export default ComponentRenderView