Skip to content

Commit

Permalink
add ripple radius example
Browse files Browse the repository at this point in the history
  • Loading branch information
vonovak committed Feb 14, 2020
1 parent 5de2ce0 commit 7cd895d
Showing 1 changed file with 57 additions and 22 deletions.
79 changes: 57 additions & 22 deletions RNTester/js/examples/Touchable/TouchableExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,35 +401,63 @@ class TouchableDisabled extends React.Component<{...}> {
</TouchableWithoutFeedback>

{Platform.OS === 'android' && (
<TouchableNativeFeedback
onPress={() => console.log('custom TNF has been clicked')}
background={TouchableNativeFeedback.SelectableBackground()}>
<View style={[styles.row, styles.block]}>
<Text style={[styles.button, styles.nativeFeedbackButton]}>
Enabled TouchableNativeFeedback
</Text>
</View>
</TouchableNativeFeedback>
)}
<>
<TouchableNativeFeedback
onPress={() => console.log('custom TNF has been clicked')}
background={TouchableNativeFeedback.SelectableBackground()}>
<View style={[styles.row, styles.block]}>
<Text style={[styles.button, styles.nativeFeedbackButton]}>
Enabled TouchableNativeFeedback
</Text>
</View>
</TouchableNativeFeedback>

{Platform.OS === 'android' && (
<TouchableNativeFeedback
disabled={true}
onPress={() => console.log('custom TNF has been clicked')}
background={TouchableNativeFeedback.SelectableBackground()}>
<View style={[styles.row, styles.block]}>
<Text
style={[styles.disabledButton, styles.nativeFeedbackButton]}>
Disabled TouchableNativeFeedback
</Text>
</View>
</TouchableNativeFeedback>
<TouchableNativeFeedback
disabled={true}
onPress={() => console.log('custom TNF has been clicked')}
background={TouchableNativeFeedback.SelectableBackground()}>
<View style={[styles.row, styles.block]}>
<Text
style={[styles.disabledButton, styles.nativeFeedbackButton]}>
Disabled TouchableNativeFeedback
</Text>
</View>
</TouchableNativeFeedback>
</>
)}
</View>
);
}
}

function CustomRippleRadius() {
if (Platform.OS !== 'android') {
return null;
}
return (
<View style={[styles.row, styles.block, {justifyContent: 'space-around'}]}>
<TouchableNativeFeedback
onPress={() => console.log('custom TNF has been clicked')}
background={TouchableNativeFeedback.Ripple('orange', true, 30)}>
<View>
<Text style={[styles.button, styles.nativeFeedbackButton]}>
radius 30
</Text>
</View>
</TouchableNativeFeedback>
<TouchableNativeFeedback
onPress={() => console.log('custom TNF has been clicked')}
background={TouchableNativeFeedback.SelectableBackgroundBorderless(50)}>
<View>
<Text style={[styles.button, styles.nativeFeedbackButton]}>
radius 50
</Text>
</View>
</TouchableNativeFeedback>
</View>
);
}

const remoteImage = {
uri: 'https://www.facebook.com/favicon.ico',
};
Expand Down Expand Up @@ -611,4 +639,11 @@ exports.examples = [
return <TouchableDisabled />;
},
},
{
title: 'Custom Ripple Radius (Android-only)',
description: ('Ripple radius on TouchableNativeFeedback can be controlled': string),
render: function(): React.Element<any> {
return <CustomRippleRadius />;
},
},
];

0 comments on commit 7cd895d

Please sign in to comment.