From 8c2f44d64014daf60483fb60eca995cdbb3e01d4 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Sat, 2 May 2015 09:46:49 -0700 Subject: [PATCH] [react-native] Don't mutate props in TouchableBounce --- Libraries/Components/Touchable/TouchableBounce.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Libraries/Components/Touchable/TouchableBounce.js b/Libraries/Components/Touchable/TouchableBounce.js index 7cba22164..30d05210f 100644 --- a/Libraries/Components/Touchable/TouchableBounce.js +++ b/Libraries/Components/Touchable/TouchableBounce.js @@ -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; } });