0
votes

Hi everyone: I'm using react-native-router-flux (v.3.39.2) in a react-native project, but today its showing this warning:

Warning: SceneView has a method called shouldComponentUpdate(). shouldComponentUpdate should nt be used when extending React.PureComponent. Please extend React.Component if shouldComponentUpdate is used.

This is my Entry Point:

import React from 'react'; import { AppRegistry, StyleSheet, Platform } from 'react-native';

import {Scene, Router} from 'react-native-router-flux';

import HomeView from './src/components/HomeView' import ArtistDetailView from './src/components/ArtistDetailView'

export default class platzimusic extends React.Component { render() {

const isAndroid = Platform.OS === 'android'
return (
  <Router>
    <Scene key="root">
      <Scene key="home" component={HomeView} hideNavBar/>
      <Scene key="artistDetail" component={ArtistDetailView} hideNavBar={isAndroid}/>
    </Scene>
  </Router>
)

} }

AppRegistry.registerComponent('platzimusic', () => platzimusic);

and this is my package.json:

{
  "name": "platzimusic",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.0.0-alpha.12",
    "react-native": "^0.45.0",
    "react-native-router-flux": "^3.39.2",
    "react-native-vector-icons": "^4.2.0"
  },
  "devDependencies": {
    "babel-jest": "20.0.3",
    "babel-preset-react-native": "1.9.2",
    "jest": "20.0.4",
    "react-test-renderer": "16.0.0-alpha.12"
  },
  "jest": {
    "preset": "react-native"
  }
}

What's wrong?

Thanks

1

1 Answers

0
votes

The problem has been fixed: https://github.com/aksonov/react-native-experimental-navigation/pull/23 (the actual change can be found at the commit, https://github.com/aksonov/react-native-experimental-navigation/pull/23/files)

I'm not sure how to update the package.json file to properly fix the issue, as I'm pretty sure the change will disappear if you npm install, but until then if you want to get rid of the warning, go into node_modules/react-native-experimental-navigation/NavigationCard.js, and chage the line: class SceneView extends React.PureComponent { to class SceneView extends React.Component {