gpt4 book ai didi

react-native - RCTBridge 需要 dispatch_sync 来加载 RCTDevLoadingView。这可能会导致死锁

转载 作者:行者123 更新时间:2023-12-03 14:48:48 25 4
gpt4 key购买 nike

我在日志中得到了这个:

RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks



这导致了一个问题,即 React 中渲染的内容会导致对齐问题。

(见附件截图1) Screenshot with Issue

这是随机发生的,因为所有屏幕都没有显示对齐问题。

(见附件截图2) Screenshot without issue

我在布局中使用了样式组件:
return(
this.props.lastComponent ?
<CommentList marginLeft={this.props.marginLeft}>
<CommentUserPicWrapper imageWidth={this.props.imageWidth}>
{this.props.imageType === 'URL' ? <CommentUserPic source={{uri:this.props.uri}} imageWidth={this.props.imageWidth} onLoad={this.handleLoad}/> : <CommentUserPic source={require('../../img/defaultProfPic.png')} imageWidth={this.props.imageWidth} onLoad={this.handleLoad}/>}
{
this.state.loading ? null : <ActivityIndicator style={{position:'absolute'}}/>
}
</CommentUserPicWrapper>
<CommentDetails borderStatus={true} marginLeft={this.props.marginLeft}>
<CommentUserName>{this.props.userName} says</CommentUserName>
<CommentUserContent>{this.props.UserContent}</CommentUserContent>
<CommentUserDate><Text>{this.props.commentDate}</Text> at <Text>{this.props.commentTime}</Text>MST</CommentUserDate>
</CommentDetails>
<CommentReply onPress={this.replyClicked} borderStatus={true} underlayColor='transparent'>
<CommentReplyText>Reply</CommentReplyText>
</CommentReply>
</CommentList>
:
<CommentList marginLeft={this.props.marginLeft}>
<CommentUserPicWrapper imageWidth={this.props.imageWidth}>
{this.props.imageType === 'URL' ? <CommentUserPic source={{uri:this.props.uri}} imageWidth={this.props.imageWidth} onLoad={this.handleLoad}/> : <CommentUserPic source={require('../../img/defaultProfPic.png')} imageWidth={this.props.imageWidth} onLoad={this.handleLoad}/>}
{this.state.loading ? null : <ActivityIndicator style={{position:'absolute'}}/>}
</CommentUserPicWrapper>
<CommentDetails borderStatus={this.props.borderStatus} marginLeft={this.props.marginLeft}>
<CommentUserName>{this.props.userName} says</CommentUserName>
<CommentUserContent>{this.props.UserContent}</CommentUserContent>
<CommentUserDate><Text>{this.props.commentDate}</Text> at <Text>{this.props.commentTime}</Text>MST</CommentUserDate>
</CommentDetails>
<CommentReply onPress={this.replyClicked} borderStatus={this.props.borderStatus} underlayColor='transparent'>
<CommentReplyText>Reply</CommentReplyText>
</CommentReply>
</CommentList>
)

谢谢。

最佳答案

我通过更新修复了它 AppDelegate.m如下:

   #if RCT_DEV
#import <React/RCTDevLoadingView.h>
#endif
//...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//...
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation
moduleProvider:nil
launchOptions:launchOptions];
#if RCT_DEV
[bridge moduleForClass:[RCTDevLoadingView class]];
#endif

RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"<AddYourAppNameHere>"
initialProperties:nil];
//...
}
来源:
devburmistro 的回答于 2017 年 12 月 10 日来自: https://github.com/facebook/react-native/issues/16376

关于react-native - RCTBridge 需要 dispatch_sync 来加载 RCTDevLoadingView。这可能会导致死锁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45988103/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com