[react-native] Don't mutate props in TouchableBounce

This commit is contained in:
Ben Alpert 2015-05-02 09:46:49 -07:00
parent 59997df1c1
commit 8c2f44d640
1 changed files with 4 additions and 7 deletions

View File

@ -11,14 +11,13 @@
*/
'use strict';
var NativeMethodsMixin = require('NativeMethodsMixin');
var React = require('React');
var POPAnimation = require('POPAnimation');
var AnimationExperimental = require('AnimationExperimental');
var NativeMethodsMixin = require('NativeMethodsMixin');
var POPAnimation = require('POPAnimation');
var React = require('React');
var Touchable = require('Touchable');
var merge = require('merge');
var copyProperties = require('copyProperties');
var onlyChild = require('onlyChild');
type State = {
@ -123,9 +122,8 @@ var TouchableBounce = React.createClass({
},
render: function() {
// Note(vjeux): use cloneWithProps once React has been upgraded
var child = onlyChild(this.props.children);
copyProperties(child.props, {
return React.cloneElement(child, {
accessible: true,
testID: this.props.testID,
onStartShouldSetResponder: this.touchableHandleStartShouldSetResponder,
@ -135,7 +133,6 @@ var TouchableBounce = React.createClass({
onResponderRelease: this.touchableHandleResponderRelease,
onResponderTerminate: this.touchableHandleResponderTerminate
});
return child;
}
});