-
Notifications
You must be signed in to change notification settings - Fork 614
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
[Bug] Toast does not show on modal on react native 0.75.3 #1388
Labels
Comments
不能使用ReactNative的Modal,你要用Ant Design的Modal,因为原生的Modal层级比较高覆盖不了 |
@LeeYuze 那为啥之前的 |
有其他办法吗?因为我全局用的基本都是 |
1uokun
added a commit
that referenced
this issue
Oct 28, 2024
1uokun
added a commit
that referenced
this issue
Oct 28, 2024
1uokun
added a commit
that referenced
this issue
Nov 9, 2024
1uokun
added a commit
that referenced
this issue
Nov 14, 2024
* feat: Modal add useModal(#1383) * feat: Picker support modalType(#1383) * feat: Carousel support onScrollAnimationEnd * fix:[Form] fix Require cycle * feat:[typescript] export all component types * feat: Slider add disabledStep、onSlidingStart、onSlidingComplete prop * fix: Tooltip safe floatingStyles * chore: test * feat: Slider add tapToSeek prop * feat: typescript@5.6.2 * fix: Picker & DatePicker defaultValue prop works(#1331) * fix: DatePicker children extra placeholder * feat: refactor useTheme by lodash.mergewith * 代码暂存 * feat: Toast support useToast (#1388) * fix: Switch styles doc * feat: Modal support animationDuration prop(#1386) * Temp 5.2.4 (#1392) * feat: refactor Slider * feat: Toast support useToast (#1388) * fix: Switch styles doc * feat: Modal support animationDuration prop(#1386) * feat: 5.3.0 * feat: react-native-reanimated@3.x not support jest snap (software-mansion/react-native-reanimated#6645) * bump 5.3.0 * fix: Switch style in 0.76 (#1389) * fix: Radio defaultCheck not works (#1380) * feat: Upgrade react-native@0.75+
fixed in import {Button, Modal, View} from "react-native";
import {Toast, Provider} from "@ant-design/react-native";
import {useState} from "react";
export default function ProfilePage(props) {
const [visible, setVisible] = useState(false);
+ const [toastApi, contextHolder] = Toast.useToast();
return (
<View style={{flex: 1, paddingTop: 100}}>
<Button title={"Show Toast"} onPress={() => {
// 这里正常
Toast.show("Hello world", 2, false);
}}/>
<Button title={"Show Modal"} onPress={() => setVisible(true)}/>
<Modal visible={visible}>
+ {contextHolder}
- <Provider>
<View style={{height: 400, backgroundColor: "blue"}}>
<Button title={"Show Toast on Modal"} onPress={() => {
// 这里Toast不显示???
+ toastApi.show("Hi, show on modal?", 2, false);
- Toast.show("Hi, show on modal?", 2, false);
}}/>
<Button title={"Close Modal"} onPress={() => setVisible(false)}/>
</View>
- </Provider>
</Modal>
</View>
);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
💬 前提强调
🙋 描述详情/重现步骤
依赖版本:
"@ant-design/react-native": "^5.2.3"
。不使用
Modal
,Toast
正常显示,使用Modal
,无法显示。代码很简单:
🔴 版本
10.7.0
💻 运行环境
Android
⚫️
npx react-native info
输出信息补充说明
No response
The text was updated successfully, but these errors were encountered: