Skip to content

Commit

Permalink
Import PropTypes and createReactClass
Browse files Browse the repository at this point in the history
This relates to a breaking change in React 16 where PropTypes and
createClass were removed from React

Fixes #57
Fixes #56
  • Loading branch information
parndt committed Oct 23, 2017
1 parent 34d60a3 commit 206f14c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/ParallaxView.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

var createReactClass = require('create-react-class');
var PropTypes = require('prop-types');
var React = require('react');
var ReactNative = require('react-native');
var {
Expand All @@ -17,22 +19,22 @@ var ScrollableMixin = require('react-native-scrollable-mixin');
var screen = Dimensions.get('window');
var ScrollViewPropTypes = ScrollView.propTypes;

var ParallaxView = React.createClass({
var ParallaxView = createReactClass({
mixins: [ScrollableMixin],

propTypes: {
...ScrollViewPropTypes,
windowHeight: React.PropTypes.number,
backgroundSource: React.PropTypes.oneOfType([
React.PropTypes.shape({
uri: React.PropTypes.string,
windowHeight: PropTypes.number,
backgroundSource: PropTypes.oneOfType([
PropTypes.shape({
uri: PropTypes.string,
}),
// Opaque type returned by require('./image.jpg')
React.PropTypes.number,
PropTypes.number,
]),
header: React.PropTypes.node,
blur: React.PropTypes.string,
contentInset: React.PropTypes.object,
header: PropTypes.node,
blur: PropTypes.string,
contentInset: PropTypes.object,
},

getDefaultProps: function () {
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
},
"homepage": "https://github.com/lelandrichardson/react-native-parallax-view",
"dependencies": {
"create-react-class": "^15.6.2",
"prop-types": "^15.6.0",
"react": "^16.0.0",
"react-native-scrollable-mixin": "^1.0.1"
},
"peerDependencies": {
Expand Down

0 comments on commit 206f14c

Please sign in to comment.