Boky
Boky

Reputation: 12064

Cannot read property 'style' of undefined React Native

I removed some of unused dependencies from package.json file and then I did rm -rf node_modules and then npm install.

If I now build my project in Xcode I do not get any errors, but If I try yo run it in a simulator I get red screen as follows:

enter image description here

In the simulator I get :

TypeError: Cannot read property 'Symbol(Symbol.iterator)' of null
    at launchEditor (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/react-native/local-cli/server/util/launchEditor.js:153:29)
    at Object.handle (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/react-native/local-cli/server/middleware/openStackFrameInEditorMiddleware.js:17:7)
    at next (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/connect/lib/proto.js:174:15)
    at Object.handle (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/react-native/local-cli/server/middleware/getDevToolsMiddleware.js:74:7)
    at next (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/connect/lib/proto.js:174:15)
    at Object.handle (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/react-native/local-cli/server/middleware/getDevToolsMiddleware.js:74:7)
    at next (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/connect/lib/proto.js:174:15)
    at Object.compression [as handle] (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/compression/index.js:205:5)
    at next (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/connect/lib/proto.js:174:15)
    at IncomingMessage.<anonymous> (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/react-native/local-cli/server/middleware/loadRawBodyMiddleware.js:20:5)

I do not have idea what's going on. Any idea how to solve it?

EDIT

Scene.js is from react-native router-flux navigation:

/**
 * Copyright (c) 2015-present, Pavel Aksonov
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */
import React, { PropTypes } from 'react';
import { ViewPropTypes, Text } from 'react-native';

export default class extends React.Component {

  // @todo - should all props be documented/specified here?

  static propTypes = {
    tabBarStyle: ViewPropTypes.style,
    tabBarSelectedItemStyle: ViewPropTypes.style,
    tabBarIconContainerStyle: ViewPropTypes.style,
    tabBarShadowStyle: ViewPropTypes.style,
    tabSceneStyle: ViewPropTypes.style,
    tabStyle: ViewPropTypes.style,
    tabTitleStyle: Text.propTypes.style,
    tabSelectedTitleStyle: Text.propTypes.style,
    tabTitle: PropTypes.string,
  };

  render() {
    return null;
  }
}

Upvotes: 1

Views: 12814

Answers (1)

Tony Cowling
Tony Cowling

Reputation: 41

So I had this issue as well and your post helped me solve it. React Native Router Flux was updated roughly 2 weeks ago, where View.propTypes was deprecated for the new ViewPropTypes. Here's the commit for it. https://github.com/aksonov/react-native-router-flux/commit/36dc20418987850677c52905beda59310a0500c3

The issue is that when this update was committed to the live branch the library version was not incremented from 3.37.0 so if you have done an npm install after that commit was implemented, your package would update with the new change, but you would most likely be none the wiser to what they had done (unless you read the commit updates for every package you use in a project)

I found that reverting react-native-router-flux to an earlier version fixed this issue. I used 3.36.0

npm install [email protected] --save

Upvotes: 4

Related Questions