I'm currently attempting to do the Ios version of this tutorial.
The tutorial is brief introduction to using native modudles in react-native via react-native-create-bridge

I should see a simple blue box under the text. However, I'm getting the error 'Cannot ready property 'string' of undefined. enter image description here After examining the line in question AND removing the .string portion. The page now renders, however, without the expected blue box.

This is what ThirdSquareNativeView.js looks like

//  Created by react-native-create-bridge

import React, { Component } from 'react'
import { requireNativeComponent } from 'react-native'

const ThirdSquare = requireNativeComponent('ThirdSquare', ThirdSquareView)

export default class ThirdSquareView extends Component {
  constructor() {
    super();
    console.log('this this working?');
  }
  render() {
    return <ThirdSquare {...this.props} />
  }
}

ThirdSquareView.propTypes = {
  exampleProp: React.PropTypes.string
}
1

There are 1 best solutions below

0
On BEST ANSWER

You need to install and import prop-types.It is no longer a part of React.

npm install prop-types --save

And then use as

import PropTypes from 'prop-types';

Your code will be something like

ThirdSquareView.propTypes = {
  exampleProp: PropTypes.string
}