gpt4 book ai didi

javascript - React Native 0.48 - `scrollview 没有原生的 proptype

转载 作者:技术小花猫 更新时间:2023-10-29 11:24:56 25 4
gpt4 key购买 nike

在我升级到 React Native 0.48 后,我遇到了以下错误,它在渲染时显示在 expo 应用程序(仅在 IOS 中)

scrollview has no proptype for native prop RCTScrollView.onScrollAnimationEnd of native type BOOL .if you havent changed this prop yourself this usually means that your versions of the native code and javascript code are out of sync. Updating oth should make this error go away.

不知道为什么,但我尽可能地缩小了我的代码库。当我尝试使用 ListView 时会生成此错误。这是代码库:

import React from 'react';
import {AppRegistry,View,Text,StyleSheet,ListView} from 'react-native';

const styles = StyleSheet.create({
fullView:{
flex:1
},
statusBar: {
backgroundColor:"#de3c3c",
padding:5
},
});



class MyComponent extends React.Component {
constructor() {
super();
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
dataSource: ds.cloneWithRows(['row 1', 'row 2']),
};
}

render() {
return (
<ListView
dataSource={this.state.dataSource}
renderRow={(rowData) => <Text>{rowData}</Text>}
/>
);
}
}

export default MyComponent;

这是我的依赖项:

  "dependencies": {
"expo": "^20.0.0",
"react": "^16.0.0-alpha.12",
"react-native": "^0.48.1",
"react-navigation": "^1.0.0-beta.11"
}

我查看了 ListView 的文档,它似乎已被弃用,但它应该仍然有效?当我尝试 FlatList 时,它也会产生同样的错误。

注意:我确定没有其他打包程序在运行。

最佳答案

找到了可能的解决方案!

- Bump expo version in package.json to 21.0.2
- Bump react-native version in package.json to 0.48.4
- Remove node_modules
- npm install or yarn install
- Change sdk version in app.json to 21.0.0

...ScrollView 错误应该会消失。

关于javascript - React Native 0.48 - `scrollview 没有原生的 proptype,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46119806/

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