Skip to content

Commit 4ffb70a

Browse files
JulienKodefacebook-github-bot
authored andcommitted
onPress animation with magnification
Summary: Related to: #15454 Motivation: Improve tvOS feeling for TouchableHighlight ![changewithaniamtion](https://user-images.githubusercontent.com/7658664/29193477-b99b4a10-7e25-11e7-8b31-e0e4ca9d7720.gif) - When you select the button he is focus and the underlay is show - When you press the button, there is an animation, but after the animation, the focus is on the button and the underlay is show Play with tvParallaxProperties on tvOS, test with and without patch just to see the actual behaviour ``` <TouchableHighlight tvParallaxProperties={{ enabled: true, shiftDistanceX: 0, shiftDistanceY: 0, tiltAngle: 0, magnification: 1.1, pressMagnification: 1.0, pressDuration: 0.3, }} underlayColor="black" onShowUnderlay={() => (console.log("onShowUnderlay")} onHideUnderlay={() => (console.log("onHideUnderlay")} onPress={() => (console.log("onPress")} > <Image style={styles.image} source={ uri: 'https://www.facebook.com/images/fb_icon_325x325.png' } /> </TouchableHighlight> ``` Closes facebook/react-native#15455 Differential Revision: D6887437 Pulled By: hramos fbshipit-source-id: e18b695068bc99643ba4006fb3f39215b38a74c1
1 parent c1c18c9 commit 4ffb70a

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

js/ListExampleShared.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ class ItemComponent extends React.PureComponent<{
6262
onPress={this._onPress}
6363
onShowUnderlay={this.props.onShowUnderlay}
6464
onHideUnderlay={this.props.onHideUnderlay}
65+
tvParallaxProperties={{
66+
pressMagnification: 1.1,
67+
}}
6568
style={horizontal ? styles.horizItem : styles.item}>
6669
<View style={[
6770
styles.row, horizontal && {width: HORIZ_WIDTH}, fixedHeight && {height: ITEM_HEIGHT}]}>

js/RNTesterList.ios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ const ComponentExamples: Array<RNTesterExample> = [
189189
{
190190
key: 'TouchableExample',
191191
module: require('./TouchableExample'),
192-
supportsTVOS: false,
192+
supportsTVOS: true,
193193
},
194194
{
195195
key: 'TransparentHitTestExample',

js/TouchableExample.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ exports.examples = [
5555
style={styles.wrapper}
5656
activeOpacity={1}
5757
animationVelocity={0}
58+
tvParallaxProperties={{pressMagnification: 1.3, pressDuration: 0.6}}
5859
underlayColor="rgb(210, 230, 255)"
5960
onPress={() => console.log('custom THW text - highlight')}>
6061
<View style={styles.wrapperCustom}>

0 commit comments

Comments
 (0)