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. 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
}
You need to install and import
prop-types
.It is no longer a part of React.And then use as
Your code will be something like