首页 > 解决方案 > 执行 UI 块时引发 React Native 异常:一个视图一次只能与一个视图控制器关联

问题描述

我有这个问题。我似乎找不到解决方案。我正在尝试实现一个对话框。它在 Android 上运行良好。但目前在 iOS 上遇到了麻烦。请帮忙 :(

    Exception thrown while executing UI block: A view can only be associated with at most one view controller at a time! View <RCTView: 0x7fe0e7e62ad0; reactTag: 355; frame = (0 0; 414 896); layer = <CALayer: 0x600003a877c0>> is associated with <UIViewController: 0x7fe0e7c4e450>. Clear this association before associating this view with <UIViewController: 0x7fe0e7c56060>.

__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke
    RCTUIManager.m:1192
__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke.489
__RCTExecuteOnMainQueue_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
-[UIApplication _run]
UIApplicationMain
main
start
0x0

在此处输入图像描述

标签: iosreactjsuser-interfacenativeblock

解决方案


推荐阅读