0

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 Answer 1

1

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
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.