NativeBase: Undefined is not an object (evaluating '_reactNative.ViewPropTypes.style')

Hi, I have an issue with the latest version of nativeBase.

I’m trying just to add an example in my Application.

import { AppRegistry } from 'react-native'
import React, { Component } from 'react';
import { Container, Header, Title, Content, Footer, FooterTab, Button, Left, Right, Body, Icon } from 'native-base';
​export default class AnatomyExample extends Component {
    render() {
        return (
            <Container>
                <Header>
                    <Left>
                        <Button transparent>
                            <Icon name='menu' />
                        </Button>
                    </Left>
                    <Body>
                        <Title>Header</Title>
                    </Body>
                    <Right />
                </Header>
                <Content>
                    // Your main content goes here
                </Content>
                <Footer>
                    <FooterTab>
                        <Button full>
                            <Text>Footer</Text>
                        </Button>
                    </FooterTab>
                </Footer>
            </Container>
        );
    }
}


AppRegistry.registerComponent('myApp', () => AnatomyExample)

My package.json:

{
  "name": "myApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "lodash": "^4.17.4",
    "native-base": "^2.1.4",
    "react": "16.0.0-alpha.6",
    "react-native": "0.43.4",
    "react-native-camera": "git+https://github.com/lwansbrough/react-native-camera.git",
    "react-native-vector-icons": "^4.1.1",
    "react-navigation": "^1.0.0-beta.9"
  },
  "devDependencies": {
    "babel-jest": "19.0.0",
    "babel-preset-react-native": "1.9.1",
    "jest": "19.0.2",
    "react-test-renderer": "16.0.0-alpha.6"
  },
  "jest": {
    "preset": "react-native"
  }
}

image

I’v tried to delete node_modules, cache clean, npm install, not working.

Thanks,

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 18
  • Comments: 40 (5 by maintainers)

Most upvoted comments

@wellmonge thank you! My problem was that in my package.json I was doing:

"react-native-router-flux": "^3.37.0"

But that actually fetches the most recent 3.x.x version. Setting the package version explicitly with:

"react-native-router-flux": "3.37.0"

Solved my problem.

@Tsouef @Dani93380 View.propTypes is deprecated and instead ViewPropTypes is used from RN44, which is introduced in the latest version of NativeBase as well. So For RN44 go for NativeBase v2.1.4 and anything below RN44, you can use NB v2.1.3

How I solved this:

  1. grep -R “View.propTypes” node_modules above command fetches me list of all packages to update in my case ex. rn-viewpager,react-native-material-ui etc.

  2. Installed and cloned these scripts. https://github.com/reactjs/react-codemod#reactnative-view-proptypes

  3. ran command for each module found in step 1 https://github.com/reactjs/react-codemod#reactnative-view-proptypes

for ex. jscodeshift -t react-codemod/transforms/ReactNative-View-propTypes.js node_modules/rn-viewpager/

@ngoducduy

I upgrade react-native-router-flux 3.39.0 and get this error, with a simple roll back to version 3.37.0 it works. Could be some related with -v3.39.0 .

@shivrajkumar i can’t upgrade to 0.44.0 because of other dependencies and I’m on

    "native-base": "2.1.0",
    "react": "15.4.1",
    "react-native": "0.42.3",

but nothing working so far even with older native-base versions

@Tsouef @Dani93380 works perfect for me, try to update react-native package to 0.44.0

Hello! Guys I’ve been reading this thread because i also encountered the same issue. Here’s what i did,

Current XCode Version = 8.3.3

i removed the /node_modules and ios/build folders and installed new with these versions

"react": "16.0.0-alpha.6"
"react-native": "0.44.0"
"babel-jest": "20.0.3"
"babel-preset-react-native": "2.0.0"

(Note: This step is very important) and don’t forget to restart the server like so

node node_modules/react-native/local-cli/cli.js start -- --reset-cache

then rebuild, for instance:

react-native run-<platform>

Hope this helps.

Thanks, It’s working !

It’s react-native-router-flux issue. I did npm install, and I got the newer version for that. And then I rolled it back to the version specified in package.json, that is v3.35.0, and it’s working fine now.

"native-base": "2.1.4",
"react": "16.0.0-alpha.6",
"react-native": "0.44.0",

works for me Also tried this with RNRF 3.39.2, got it running