Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 .

like image 237
user3676224 Avatar asked Sep 08 '17 15:09

user3676224


1 Answers

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.

like image 121
Rajan Maharjan Avatar answered Nov 16 '22 09:11

Rajan Maharjan