[react-native] Don't mutate props in TouchableBounce
This commit is contained in:
parent
59997df1c1
commit
8c2f44d640
|
@ -11,14 +11,13 @@
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var NativeMethodsMixin = require('NativeMethodsMixin');
|
|
||||||
var React = require('React');
|
|
||||||
var POPAnimation = require('POPAnimation');
|
|
||||||
var AnimationExperimental = require('AnimationExperimental');
|
var AnimationExperimental = require('AnimationExperimental');
|
||||||
|
var NativeMethodsMixin = require('NativeMethodsMixin');
|
||||||
|
var POPAnimation = require('POPAnimation');
|
||||||
|
var React = require('React');
|
||||||
var Touchable = require('Touchable');
|
var Touchable = require('Touchable');
|
||||||
|
|
||||||
var merge = require('merge');
|
var merge = require('merge');
|
||||||
var copyProperties = require('copyProperties');
|
|
||||||
var onlyChild = require('onlyChild');
|
var onlyChild = require('onlyChild');
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
@ -123,9 +122,8 @@ var TouchableBounce = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
// Note(vjeux): use cloneWithProps once React has been upgraded
|
|
||||||
var child = onlyChild(this.props.children);
|
var child = onlyChild(this.props.children);
|
||||||
copyProperties(child.props, {
|
return React.cloneElement(child, {
|
||||||
accessible: true,
|
accessible: true,
|
||||||
testID: this.props.testID,
|
testID: this.props.testID,
|
||||||
onStartShouldSetResponder: this.touchableHandleStartShouldSetResponder,
|
onStartShouldSetResponder: this.touchableHandleStartShouldSetResponder,
|
||||||
|
@ -135,7 +133,6 @@ var TouchableBounce = React.createClass({
|
||||||
onResponderRelease: this.touchableHandleResponderRelease,
|
onResponderRelease: this.touchableHandleResponderRelease,
|
||||||
onResponderTerminate: this.touchableHandleResponderTerminate
|
onResponderTerminate: this.touchableHandleResponderTerminate
|
||||||
});
|
});
|
||||||
return child;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue