Skip to content

Commit

Permalink
Update code for React v16 compatibility (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
aarondancer authored and cooperka committed Nov 15, 2017
1 parent 220ffc0 commit a7c93e2
Show file tree
Hide file tree
Showing 25 changed files with 246 additions and 121 deletions.
18 changes: 10 additions & 8 deletions GiftedForm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';

const GiftedFormManager = require('./GiftedFormManager');

Expand All @@ -25,7 +27,7 @@ const LoadingWidget = require('./widgets/LoadingWidget');
const HiddenWidget = require('./widgets/HiddenWidget');
const ErrorsWidget = require('./widgets/ErrorsWidget');

const GiftedForm = React.createClass({
const GiftedForm = createReactClass({
mixins: [ ContainerMixin ],

statics: {
Expand Down Expand Up @@ -62,11 +64,11 @@ const GiftedForm = React.createClass({
},

propTypes: {
isModal: React.PropTypes.bool,
clearOnClose: React.PropTypes.bool,
validators: React.PropTypes.object,
defaults: React.PropTypes.object,
openModal: React.PropTypes.func,
isModal: PropTypes.bool,
clearOnClose: PropTypes.bool,
validators: PropTypes.object,
defaults: PropTypes.object,
openModal: PropTypes.func,
},

componentWillUnmount() {
Expand Down Expand Up @@ -96,7 +98,7 @@ const GiftedForm = React.createClass({
},
});

var GiftedFormModal = React.createClass({
var GiftedFormModal = createReactClass({
mixins: [ ContainerMixin ],

getDefaultProps() {
Expand All @@ -106,7 +108,7 @@ var GiftedFormModal = React.createClass({
},

propTypes: {
isModal: React.PropTypes.bool,
isModal: PropTypes.bool,
},

render() {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Form component for React Native.
```js
var { GiftedForm, GiftedFormManager } = require('react-native-gifted-form');

var FormComponent = React.createClass({
var FormComponent = createReactClass({
render() {
return (
<GiftedForm
Expand Down
9 changes: 5 additions & 4 deletions mixins/ContainerMixin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
ScrollView,
View,
Expand All @@ -11,10 +12,10 @@ var GiftedFormManager = require('../GiftedFormManager');
module.exports = {

propTypes: {
formName: React.PropTypes.string,
scrollOnTap: React.PropTypes.bool,
scrollEnabled: React.PropTypes.bool,
formStyles: React.PropTypes.object,
formName: PropTypes.string,
scrollOnTap: PropTypes.bool,
scrollEnabled: PropTypes.bool,
formStyles: PropTypes.object,
// navigator: ,
},

Expand Down
29 changes: 14 additions & 15 deletions mixins/WidgetMixin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var React = require('react');
var {
Image
} = require('react-native')
import React from 'react';
import PropTypes from 'prop-types';
import { Image } from 'react-native';


var GiftedFormManager = require('../GiftedFormManager');
Expand All @@ -15,20 +14,20 @@ module.exports = {
},

propTypes: {
name: React.PropTypes.string,
title: React.PropTypes.string,
formName: React.PropTypes.string,
name: PropTypes.string,
title: PropTypes.string,
formName: PropTypes.string,
// image: ,
widgetStyles: React.PropTypes.object,
formStyles: React.PropTypes.object,
validationImage: React.PropTypes.bool,
openModal: React.PropTypes.func,
widgetStyles: PropTypes.object,
formStyles: PropTypes.object,
validationImage: PropTypes.bool,
openModal: PropTypes.func,
// navigator: ,
onFocus: React.PropTypes.func,
onBlur: React.PropTypes.func,
validateOnEmpty: React.PropTypes.bool,
onFocus: PropTypes.func,
onBlur: PropTypes.func,
validateOnEmpty: PropTypes.bool,
// If we want to store the state elsewhere (Redux store, for instance), we can use value and Form's onValueChange prop
value: React.PropTypes.any,
value: PropTypes.any,
},

getDefaultProps() {
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
},
"homepage": "https://github.com/FaridSafi/react-native-gifted-form#readme",
"dependencies": {
"apsl-react-native-button": "~3.0.0",
"moment": "~2.18.1",
"react-native-button": "~1.8.2",
"apsl-react-native-button": "^3.1.0",
"create-react-class": "^15.6.2",
"moment": "^2.19.1",
"prop-types": "^15.6.0",
"react-native-button": "^2.1.0",
"react-native-gifted-spinner": "~0.1.0",
"react-native-google-places-autocomplete": "~1.2.0",
"react-native-google-places-autocomplete": "^1.3.6",
"react-timer-mixin": "~0.13.3",
"validator": "~7.1.0"
"validator": "^9.0.0"
}
}
9 changes: 5 additions & 4 deletions widgets/DatePickerIOSWidget.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
var React = require('react');
var {
import React from 'react';
import createReactClass from 'create-react-class';
import {
View,
DatePickerIOS,
PixelRatio
} = require('react-native')
} from 'react-native';

var WidgetMixin = require('../mixins/WidgetMixin.js');


module.exports = React.createClass({
module.exports = createReactClass({
mixins: [WidgetMixin],

getDefaultProps() {
Expand Down
3 changes: 2 additions & 1 deletion widgets/ErrorsWidget.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import createReactClass from 'create-react-class';
import {
View,
Text,
Expand All @@ -7,7 +8,7 @@ import {

const WidgetMixin = require('../mixins/WidgetMixin.js');

module.exports = React.createClass({
module.exports = createReactClass({
mixins: [WidgetMixin],

render() {
Expand Down
5 changes: 3 additions & 2 deletions widgets/GooglePlacesWidget.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
var React = require('react');
import React from 'react';
import createReactClass from 'create-react-class';

var WidgetMixin = require('../mixins/WidgetMixin.js');

var {GooglePlacesAutocomplete} = require('react-native-google-places-autocomplete');


module.exports = React.createClass({
module.exports = createReactClass({
mixins: [WidgetMixin],

getDefaultProps() {
Expand Down
3 changes: 2 additions & 1 deletion widgets/GroupWidget.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import createReactClass from 'create-react-class';
import {
View,
Text
} from 'react-native';

var WidgetMixin = require('../mixins/WidgetMixin');

module.exports = React.createClass({
module.exports = createReactClass({
mixins: [WidgetMixin],

getDefaultProps() {
Expand Down
9 changes: 5 additions & 4 deletions widgets/HiddenWidget.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
var React = require('react');
var {
import React from 'react';
import createReactClass from 'create-react-class';
import {
View
} = require('react-native')
} from 'react-native';

var WidgetMixin = require('../mixins/WidgetMixin.js');


module.exports = React.createClass({
module.exports = createReactClass({
mixins: [WidgetMixin],

componentDidMount() {
Expand Down
9 changes: 5 additions & 4 deletions widgets/LoadingWidget.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
var React = require('react');
var {
import React from 'react';
import createReactClass from 'create-react-class';
import {
View,
Text,
TouchableHighlight,
Image,
PixelRatio
} = require('react-native')
} from 'react-native';

var WidgetMixin = require('../mixins/WidgetMixin.js');
var GiftedSpinner = require('react-native-gifted-spinner');

module.exports = React.createClass({
module.exports = createReactClass({
mixins: [WidgetMixin],

getDefaultProps() {
Expand Down
16 changes: 9 additions & 7 deletions widgets/ModalWidget.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import {
View,
Text,
Expand All @@ -16,7 +18,7 @@ var TimerMixin = require('react-timer-mixin');

var moment = require('moment');

module.exports = React.createClass({
module.exports = createReactClass({
mixins: [TimerMixin, WidgetMixin],

getDefaultProps() {
Expand All @@ -31,12 +33,12 @@ module.exports = React.createClass({
},

propTypes: {
type: React.PropTypes.string,
scrollEnabled: React.PropTypes.bool,
disclosure: React.PropTypes.bool,
cancelable: React.PropTypes.bool,
displayValue: React.PropTypes.string,
onClose: React.PropTypes.func
type: PropTypes.string,
scrollEnabled: PropTypes.bool,
disclosure: PropTypes.bool,
cancelable: PropTypes.bool,
displayValue: PropTypes.string,
onClose: PropTypes.func
},

getInitialState() {
Expand Down
9 changes: 5 additions & 4 deletions widgets/NoticeWidget.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
var React = require('react');
var {
import React from 'react';
import createReactClass from 'create-react-class';
import {
View,
Text
} = require('react-native')
} from 'react-native';

var WidgetMixin = require('../mixins/WidgetMixin.js');



module.exports = React.createClass({
module.exports = createReactClass({
mixins: [WidgetMixin],

getDefaultProps() {
Expand Down
9 changes: 5 additions & 4 deletions widgets/OptionWidget.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
var React = require('react');
var {
import React from 'react';
import createReactClass from 'create-react-class';
import {
View,
Text,
TouchableHighlight,
Image,
PixelRatio
} = require('react-native')
} from 'react-native';

var WidgetMixin = require('../mixins/WidgetMixin.js');



module.exports = React.createClass({
module.exports = createReactClass({
mixins: [WidgetMixin],

getDefaultProps() {
Expand Down
9 changes: 5 additions & 4 deletions widgets/RowValueWidget.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
var React = require('react');
var {
import React from 'react';
import createReactClass from 'create-react-class';
import {
View,
Text,
TouchableHighlight,
Image,
PixelRatio
} = require('react-native')
} from 'react-native';

var WidgetMixin = require('../mixins/WidgetMixin.js');
var TimerMixin = require('react-timer-mixin');


module.exports = React.createClass({
module.exports = createReactClass({
mixins: [TimerMixin, WidgetMixin],

getDefaultProps() {
Expand Down
9 changes: 5 additions & 4 deletions widgets/RowWidget.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
var React = require('react');
var {
import React from 'react';
import createReactClass from 'create-react-class';
import {
View,
Text,
TouchableHighlight,
Image,
PixelRatio
} = require('react-native')
} from 'react-native';

var WidgetMixin = require('../mixins/WidgetMixin.js');
var TimerMixin = require('react-timer-mixin');


module.exports = React.createClass({
module.exports = createReactClass({
mixins: [TimerMixin, WidgetMixin],

getDefaultProps() {
Expand Down
9 changes: 5 additions & 4 deletions widgets/SelectCountryWidget.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
var React = require('react');
var {
import React from 'react';
import createReactClass from 'create-react-class';
import {
View, ListView, Text, TouchableHighlight, TextInput, Image, PixelRatio
} = require('react-native')
} from 'react-native';

var WidgetMixin = require('../mixins/WidgetMixin.js');
var OptionWidget = require('./OptionWidget.js');
Expand Down Expand Up @@ -260,7 +261,7 @@ var countries =
];


module.exports = React.createClass({
module.exports = createReactClass({
mixins: [WidgetMixin],

statics: {
Expand Down
Loading

0 comments on commit a7c93e2

Please sign in to comment.