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

React-native 问题汇总 #4

Open
HAAAAADION opened this issue Sep 2, 2016 · 0 comments
Open

React-native 问题汇总 #4

HAAAAADION opened this issue Sep 2, 2016 · 0 comments

Comments

@HAAAAADION
Copy link
Owner

HAAAAADION commented Sep 2, 2016

官方详细问题汇总

Genymotion模拟器

运行react-nativec run-android安装到安卓模拟器Genymotion时出现错误:

Could not run adb reverse: Command failed: D:\Android\sdk/platform-tools/adb reverse tcp:8081 tcp:8081

执行adb命令adb reverse tcp:8081 tcp:8081出现错误:

adb server version (32) doesn't match this client (36); killing...
error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037: 通常每个套接字地址(协议/网络地址/端口)只允许使用次。 (10048)      
could not read ok from ADB Server
* failed to start daemon *
error: cannot connect to daemon

解决办法:

设置GenymotionAndroid SDK位置

image

辅助解决办法:

tasklist /fi "PID eq 5037"           //查看占用了5037端口的进程
taskkill /pid 5037 /f                  //终止pid为5037的进程, /f表示为强制
taskkill /F /IM adb.exe             //直接强制终止adb
adb kill-server                          //关闭adb
adb start-server                       //开启adb

运行react-native run-android出错

运行react-native run-android出现错误:
image

解决办法:

降低gradle版本(参照下图)

image

ListView 修改数据重新渲染

使用cloneWithRows更新数据时, 如只更新该数据中的某一字段, 这条数据是不会被从新渲染, 需要整条记录替换更新才能被重新渲染, 数据结构如下:

var list = [
    {
    name: 'dion',
    age: '18'
    },
    {
        name: 'jack',
        age: '22'
    }
];

如果需要更新jackage20

//这样不会被 ListView 重新渲染
list[1].age = 20;
ds.cloneWithRows(list);
 //整条记录更新才会被 ListView 重新渲染
list[1] = {name: 'jack', age: '20'};
ds.cloneWithRows(list);
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

1 participant