RN封装的model弹出层组件

需要用到react-native-ui-kitten这个组件库,自行点击链接参考去安装

安装完直接用就完事了

js 复制代码
import { StyleSheet,View, Text} from 'react-native'
import { Modal} from '@ui-kitten/components'
function AlertAction (props) {

  const closeModal = () => {
    props.closeModal() // 调用父组件的关闭弹窗方法
  }
  return (
    <Modal
      animationType="none"
      visible={props.visible}
      onBackdropPress={closeModal} // 点击外部区域关闭Modal(非中间白色区域)
      backdropStyle={{ backgroundColor: 'rgba(0, 0, 0, 0.5)' }}>
      <View style={styles.container}>
        <Text>111111</Text>
      </View>
    </Modal>
  )
}


export default AlertAction

const styles = StyleSheet.create({
  container: {
    backgroundColor: '#FFF',
    width: 700,
    height: 400,
    borderRadius: 5,
  },
})

使用方法

js 复制代码
import LanyaModul from '../../components/lanyaModul'
export default function aaa(){
  const [lanyamodulflag, setLanYaModulFlag] = useState(true)
    // 关闭蓝牙弹窗
  const closeModal = () => {
    setLanYaModulFlag(false)
  }
	return (
		<LanyaModul
          visible={lanyamodulflag}
          closeModal={closeModal}
        ></LanyaModul>
	)
}
相关推荐
木斯佳1 小时前
前端八股文面经大全:bilibili生态技术方向二面 (2026-03-25)·面经深度解析
前端·ai·ssd·sse·rag
不会写DN1 小时前
Gin 日志体系详解
前端·javascript·gin
冬夜戏雪1 小时前
实习面经记录(十)
java·前端·javascript
爱学习的程序媛3 小时前
【Web前端】JavaScript设计模式全解析
前端·javascript·设计模式·web
小码哥_常3 小时前
从SharedPreferences到DataStore:Android存储进化之路
前端
老黑3 小时前
开源工具 AIDA:给 AI 辅助开发加一个数据采集层,让 AI 从错误中自动学习(Glama 3A 认证)
前端·react.js·ai·nodejs·cursor·vibe coding·claude code
jessecyj3 小时前
Spring boot整合quartz方法
java·前端·spring boot
苦瓜小生4 小时前
【前端】|【js手撕】经典高频面试题:手写实现function.call、apply、bind
java·前端·javascript
天若有情6734 小时前
前端HTML精讲03:页面性能优化+懒加载,搞定首屏加速
前端·性能优化·html
踩着两条虫4 小时前
AI驱动的Vue3应用开发平台深入探究(十):物料系统之内置组件库
android·前端·vue.js·人工智能·低代码·系统架构·rxjava