加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

react-native – React本机在android上工作非常慢

发布时间:2020-12-15 20:45:47 所属栏目:百科 来源:网络整理
导读:通过’非常慢’我的意思是,它加载一个大约5秒的过渡,尽管这只是一个简单的示例应用程序. Here is the whole app RN code 看看onPressFeed 你在运行什么版本的React Native?你在运行什么手机? 如果你在Android模拟器上运行React Native,它会非常慢.此外,如
通过’非常慢’我的意思是,它加载一个大约5秒的过渡,尽管这只是一个简单的示例应用程序.

Here is the whole app RN code

看看onPressFeed

你在运行什么版本的React Native?你在运行什么手机?

如果你在Android模拟器上运行React Native,它会非常慢.此外,如果您启用了Chrome调试,则会减慢应用程序的速度.

我在我的三星Galaxy s4设备上运行了一个相当简单的React Native应用程序,它运行得相当快(动画运行也相当顺利).

我运行的一些示例代码(带有动画的sidedrawer和主视图):

_renderCancel: function(){
  if (this.state.showView) {
    return (
      this.props.view
    );
  } else {
     return ;
   }
},render: function() {

var menu = <Menu 
              closeDrawer={this.closeDrawer}
              navigator={this.props.navigator} 
              modifyOnClose={this.modifyOnClose} />;


return (
  <Drawer
    ref="drawer"
    onClose={this.onClose}
    type={this.state.drawerType}
    animation={this.state.animation}
    openDrawerOffset={this.state.openDrawerOffset}
    closedDrawerOffset={this.state.closedDrawerOffset}
    panOpenMask={this.state.panOpenMask}
    panCloseMask={this.state.panCloseMask}
    relativeDrag={this.state.relativeDrag}
    panStartCompensation={this.state.panStartCompensation}
    openDrawerThreshold={this.state.openDrawerThreshold}
    content={menu}
    styles={drawerStyles}
    disabled={this.state.disabled}
    tweenHandler={this.tweenHandler}
    tweenDuration={this.state.tweenDuration}
    tweenEasing={this.state.tweenEasing}
    acceptDoubleTap={this.state.acceptDoubleTap}
    acceptTap={this.state.acceptTap}
    acceptPan={this.state.acceptPan}
    changeVal={this.state.changeVal}
    negotiatePan={false}
    side={this.state.rightSide ? 'right' : 'left'}
    >
    <View>
      <CustomToolBar onPress={this.openDrawer}/> 
      {this._renderCancel()}   
    </View>
  </Drawer>

);
},

这在我的设备上运行得相当快.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读