Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal 组件居中显示,丰富功能 #627

Open
WangShayne opened this issue May 23, 2023 · 1 comment
Open

Modal 组件居中显示,丰富功能 #627

WangShayne opened this issue May 23, 2023 · 1 comment

Comments

@WangShayne
Copy link

参考Ant Design Mobile RN

SunLxy added a commit that referenced this issue May 25, 2023
@SunLxy
Copy link
Contributor

SunLxy commented May 25, 2023

Modalplacement添加了middle值,用以控制居中展示,请安装 @uiw/react-native@4.0.9 试一下效果 @WangShayne

import React, { useState, Fragment } from 'react';
import { View, Text, SafeAreaView } from 'react-native';
import { Modal, Button,Grid, Icon } from '@uiw/react-native';

function ButtonGroupView() {
  const [visible,setVisible]= useState(false)
  const data = Array.from(new Array(24)).map((_val, i) => {
    return { icon: <Icon name="heart-on" color="red" />, text: `${i}`}
  });
  return (
    <Fragment>
      <Modal visible={visible} placement='middle'>
        <SafeAreaView style={{width:600}}>
          <View>
            <Grid data={data} columns='6' hasLine={false}/>
            <Button onPress={() => setVisible(false)}>
              隐藏中间弹出的模态框
            </Button>
          </View>
        </SafeAreaView>
      </Modal>
       <Button onPress={() => setVisible(true)}>
        中间显示
      </Button>
    </Fragment>
  );
}
export default ButtonGroupView

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants