import React, { useEffect, useState } from 'react'; import { ScrollView, StyleSheet, Text, View } from 'react-native'; //import { Marquee } from '@animatereactnative/marquee'; import { ElevationObject } from '../../../components/Button'; import TextView from '../../../components/TextView'; import MyModal from '../../../components/MyModal'; import Swiper from 'react-native-swiper'; import Dialog from '../../../components/Dialog'; const PinMessage = ({ messageList=[] }) => { const [visible, showDialog] = useState(false); useEffect(() => { if (messageList.length > 0) { showDialog(true) } }, [messageList]) if (isIOS) { if (visible) return ( { messageList.map((item, index) => showDialog(false)}/> )} ); else return <> } else { return ( { messageList.map((item, index) => showDialog(false)}/> )} ); } } const Message = ({item}) => { const [expand, setExpand] = useState(false) const max = ($width-32)/8; return ( { item.pinTitle?.length>max ? {item.pinTitle} : {item.pinTitle} } setExpand(!expand)}/> { expand && {item.pinContent} } ) } const NoticeView = ({item, onClose}) => { return ( {item.pinTitle} {item.pinContent} ) } export default PinMessage; const styles = StyleSheet.create({ pinMessageView: { top: 180, left: 16, right: 16, zIndex: 10, maxHeight: $vh(60), overflow: "hidden", position: 'absolute', }, messageCard: { marginBottom: 16, maxHeight: $vh(50), overflow: "hidden", borderRadius: 6, backgroundColor: colorLight, ...ElevationObject(3) }, marquee: { flex: 1, overflow: "hidden", ...$padding(12, 16) }, textTitle: { color: textPrimary, fontSize: 16, fontWeight: "bold" }, fixedTitle: { flex: 1, color: textPrimary, fontSize: 16, fontWeight: "bold", ...$padding(12, 16) }, textMessage: { color: textSecondary, paddingLeft: 16, paddingRight: 16, paddingBottom: 16, fontSize: 14 }, noticeLayer: { top: 0, left: 0, right: 0, bottom: 0, zIndex: 20, position: "absolute", alignItems: 'center', justifyContent: 'center', backgroundColor: 'rgba(0,0,0,.5)' }, noticeDialog: { width: Dialog.dialogWidth, height: $vw(100) + 48 }, noticeDialog2: { height: $vh(50) }, noticeDialogChild: { width: Dialog.dialogWidth, marginLeft: "auto", marginRight: "auto" }, closeIcon: { top: 8, right: 8, position: "absolute" }, notiveView: { height: $vh(50) - 48, marginLeft: 4, marginRight: 4, borderRadius: 12, backgroundColor: colorLight }, noticeTitle: { color: textPrimary, padding: 16, fontSize: 16, fontWeight: "bold", marginRight: 16 } })