简体   繁体   English

React Native 0.48 - `scrollview没有本机的proptype

[英]React Native 0.48 - `scrollview has no proptype for native

I am running into the following error after I upgraded to react native 0.48, which is showing on the expo app ( in IOS only ) when rendering 我升级到反应原生0.48后出现了以下错误,这在渲染应用程序( 仅在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. scrollview没有原生类型BOOL的RCTScrollView.onScrollAnimationEnd的proptype。如果你自己没有改变这个prop,这通常意味着你的本机代码版本和javascript代码不同步。 Updating oth should make this error go away. 更新oth应该使这个错误消失。

Not sure why, But I narrowed my code base down as much as possible. 不知道为什么,但我尽可能缩小我的代码库。 this error is generated when I try to use ListView. 我尝试使用ListView时生成此错误。 Here is the code base: 这是代码库:

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;

And here are my dependencies: 这是我的依赖:

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

I took a look over the docs for ListView, seems like its deprecated, but it should still work? 我看了一下ListView的文档,似乎已经弃用了,但它应该还能运行吗? FlatList generates the same error as well when i tried it. FlatList在我尝试时也会生成相同的错误。

Note: I made sure there isn't another packager running . 注意:我确保没有其他打包器在运行。

Found the possible solution! 找到可能的解决方案!

- 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 error should disappear. ... ScrollView错误应该消失。

基于https://github.com/react-community/create-react-native-app/blob/master/VERSIONS.md ,看起来expo 20.xx应该与0.47.x版本的react-native一起使用。

Apparently at the moment Expo Client app not completely compatible with RN 0.48 and higher. 显然,目前Expo Client应用程序与RN 0.48及更高版本不完全兼容。 One solution is to use react-native init in order to test react native projects of version 0.48. 一种解决方案是使用react-native init来测试版本0.48的本机项目。

I met the same question. 我遇到了同样的问题。 But I have not use expo. 但我没有使用世博会。 Finally i fix it by reset ios simulator. 最后我通过重置ios模拟器来修复它。

Step: Hardware - Erase All Content and Settings - Reset 步骤:硬件 - 删除所有内容和设置 - 重置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM