From ab98a1474cc0bf05cba3ade8de2649701bfae9b8 Mon Sep 17 00:00:00 2001 From: Thomas Carlson Date: Thu, 4 Oct 2018 21:39:57 +0200 Subject: [PATCH 1/2] Remove TimerMixin from TouchableWithoutFeedback --- Libraries/Components/Touchable/TouchableWithoutFeedback.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/Libraries/Components/Touchable/TouchableWithoutFeedback.js index 3a80684c672e..3e8a4bdfacb3 100755 --- a/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -13,7 +13,6 @@ const DeprecatedEdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const React = require('React'); const PropTypes = require('prop-types'); -const TimerMixin = require('react-timer-mixin'); const Touchable = require('Touchable'); const View = require('View'); @@ -80,7 +79,7 @@ export type Props = $ReadOnly<{| */ const TouchableWithoutFeedback = ((createReactClass({ displayName: 'TouchableWithoutFeedback', - mixins: [TimerMixin, Touchable.Mixin], + mixins: [Touchable.Mixin], propTypes: { accessible: PropTypes.bool, From 31fdc26211138a8bdc85e08d9c377ac1196a4183 Mon Sep 17 00:00:00 2001 From: Thomas Carlson Date: Thu, 4 Oct 2018 23:02:22 +0200 Subject: [PATCH 2/2] Add TouchableWithoutFeedback tests to RNTester including enabled/disabled tests. --- RNTester/js/TouchableExample.js | 66 +++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/RNTester/js/TouchableExample.js b/RNTester/js/TouchableExample.js index 05de4cc9912b..fa52cac64e75 100644 --- a/RNTester/js/TouchableExample.js +++ b/RNTester/js/TouchableExample.js @@ -21,6 +21,7 @@ var { TouchableOpacity, Platform, TouchableNativeFeedback, + TouchableWithoutFeedback, View, } = ReactNative; @@ -70,6 +71,12 @@ exports.examples = [ ); }, }, + { + title: '', + render: function() { + return ; + }, + }, { title: 'TouchableNativeFeedback with Animated child', description: @@ -150,6 +157,40 @@ exports.examples = [ }, ]; +class TouchableWithoutFeedbackBox extends React.Component<{}, $FlowFixMeState> { + state = { + timesPressed: 0, + }; + + textOnPress = () => { + this.setState({ + timesPressed: this.state.timesPressed + 1, + }); + }; + + render() { + var textLog = ''; + if (this.state.timesPressed > 1) { + textLog = this.state.timesPressed + 'x TouchableWithoutFeedback onPress'; + } else if (this.state.timesPressed > 0) { + textLog = 'TouchableWithoutFeedback onPress'; + } + + return ( + + + + Tap Here For No Feedback! + + + + {textLog} + + + ); + } +} + class TextOnPressBox extends React.Component<{}, $FlowFixMeState> { state = { timesPressed: 0, @@ -360,6 +401,31 @@ class TouchableDisabled extends React.Component<{}> { Enabled TouchableHighlight + console.log('TWOF has been clicked')} + disabled={true}> + + + Disabled TouchableWithoutFeedback + + + + + console.log('TWOF has been clicked')} + disabled={false}> + + + Enabled TouchableWithoutFeedback + + + + {Platform.OS === 'android' && (