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

[Bug] Modal组件中使用react-navigation中 useRoute会报错 #1383

Closed
1 task done
7pou opened this issue Sep 26, 2024 · 1 comment
Closed
1 task done

[Bug] Modal组件中使用react-navigation中 useRoute会报错 #1383

7pou opened this issue Sep 26, 2024 · 1 comment

Comments

@7pou
Copy link

7pou commented Sep 26, 2024

💬 前提强调

  • I have searched the issues of this repository and believe that this is not a duplicate.

🙋 描述详情/重现步骤

import { useRoute} from '@react-navigation/native';
const route = useRoute()
<Modal popup>
{children}
</Modal>

看源码Modal会被Portal挂在Navigate外面, 有什么解决方案吗

🔴 版本

5.0.4

💻 运行环境

Android

⚫️ npx react-native info输出信息

System:
OS: Windows 10 10.0.19044
CPU: (4) x64 Intel(R) Core(TM) i5-6402P CPU @ 2.80GHz
Memory: 10.45 GB / 27.92 GB
Binaries:
Node:
version: 18.20.3
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 1.22.15
path: ~\AppData\Roaming\npm\yarn.CMD
npm:
version: 10.7.0
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: AI-233.14808.21.2331.11709847
Visual Studio: Not Found
Languages:
Java:
version: 17.0.11
path: /c/Program Files/Common Files/Oracle/Java/javapath/javac
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.3
wanted: 0.72.3
react-native-windows: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found

补充说明

目前的层级是 AntProvide -> NavigationContainer -> Stack.Navigator -> Stack.Screen -> Modal
我尝试修改为 NavigationContainer -> AntProvide -> Stack.Navigator -> Stack.Screen -> Modal后没有解决问题

No response

@7pou 7pou added the Bug🐛 label Sep 26, 2024
@7pou 7pou changed the title [Bug] Modal组件中使用react-navigation中 useNavigation会报错 [Bug] Modal组件中使用react-navigation中 useRoute会报错 Sep 26, 2024
@1uokun
Copy link
Collaborator

1uokun commented Sep 26, 2024

未来版本会参考https://ant.design/components/modal-cn#modalusemodal 加入 useModal(),把Modal可以得到当前page页的上下文,而不是只能root Portal中


In future versions, we will refer to https://ant.design/components/modal-cn#modalusemodal to add useModal, so that Modal can get the context of the current page instead of the root Portal.

1uokun added a commit that referenced this issue Oct 6, 2024
1uokun added a commit that referenced this issue Oct 6, 2024
1uokun added a commit that referenced this issue Oct 7, 2024
1uokun added a commit that referenced this issue Oct 7, 2024
@1uokun 1uokun mentioned this issue Oct 7, 2024
@1uokun 1uokun mentioned this issue Nov 13, 2024
@1uokun 1uokun removed the PR welcome label Nov 13, 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+
@1uokun 1uokun closed this as completed Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants