简体   繁体   中英

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

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.

Not sure why, But I narrowed my code base down as much as possible. this error is generated when I try to use 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? FlatList generates the same error as well when i tried it.

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.

基于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. One solution is to use react-native init in order to test react native projects of version 0.48.

I met the same question. But I have not use expo. Finally i fix it by reset ios simulator.

Step: Hardware - Erase All Content and Settings - Reset

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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