10 examples of 'touchableopacity react native' in JavaScript

Every line of 'touchableopacity react native' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
6var Opacity = function Opacity() {
7 return React.createElement(Grommet, {
8 theme: grommet
9 }, React.createElement(Box, {
10 gap: "small",
11 direction: "row"
12 }, React.createElement(Image, {
13 src: "//v2.grommet.io/assets/IMG_4245.jpg"
14 }), React.createElement(Image, {
15 opacity: "strong",
16 src: "//v2.grommet.io/assets/IMG_4245.jpg"
17 })), React.createElement(Box, {
18 gap: "small",
19 direction: "row"
20 }, React.createElement(Image, {
21 opacity: "medium",
22 src: "//v2.grommet.io/assets/IMG_4245.jpg"
23 }), React.createElement(Image, {
24 opacity: "weak",
25 src: "//v2.grommet.io/assets/IMG_4245.jpg"
26 })), React.createElement(Box, {
27 gap: "small",
28 direction: "row"
29 }, React.createElement(Image, {
30 opacity: false,
31 src: "//v2.grommet.io/assets/IMG_4245.jpg"
32 }), React.createElement(Image, {
33 opacity: true,
34 src: "//v2.grommet.io/assets/IMG_4245.jpg"
35 })), React.createElement(Box, {
36 gap: "small",
37 direction: "row"
38 }, React.createElement(Image, {
39 opacity: "0.6",
40 src: "//v2.grommet.io/assets/IMG_4245.jpg"
41 })));
42};
63render() {
64 const props = this.getThemeProps();
65
66 return (
67
68 );
69}
40render() {
41 const _a = this.props, { onLongPress, accessibilityRole, activeOpacity, hitSlop, style, disabled } = _a, otherProps = __rest(_a, ["onLongPress", "accessibilityRole", "activeOpacity", "hitSlop", "style", "disabled"]);
42 if (Platform.OS === 'android') {
43 return (React.createElement(TouchableNativeFeedback, { disabled: disabled, onPress: this.onPress, onLongPress: onLongPress, accessible: true, testID: this.testId, useForeground: true, hitSlop: hitSlop, background: TouchableNativeFeedback.SelectableBackground(), accessibilityLabel: this.accessibilityLabel, accessibilityRole: accessibilityRole === undefined ? 'button' : accessibilityRole, onLayout: this.props.onLayout },
44 React.createElement(View, Object.assign({ style: style }, otherProps))));
45 }
46 else {
47 return (React.createElement(TouchableOpacity, { disabled: disabled, onPress: this.onPress, onLongPress: onLongPress, accessible: true, testID: this.testId, activeOpacity: activeOpacity, style: style, hitSlop: hitSlop, accessibilityLabel: this.accessibilityLabel, accessibilityRole: accessibilityRole === undefined ? 'button' : accessibilityRole, onLayout: this.props.onLayout }, otherProps.children));
48 }
49}
34setOpacity: function setOpacity(opacity) {
35 var overlay = React.findDOMNode(this);
36 overlay.style.opacity = opacity;
37},
37constructor(props) {
38 super(props);
39
40 const {throttleTime, throttleOptions} = this.props;
41
42 this.onPress = _.throttle(this.onPress.bind(this), throttleTime, throttleOptions);
43 this.onPressIn = this.onPressIn.bind(this);
44 this.onPressOut = this.onPressOut.bind(this);
45}
268set opacity( opacity: number ) {
269 this._opacity = opacity;
270 // 子孫要素全てに反映させる
271 traverse( this.target, applyOpacity, opacity );
272}
13render() {
14 return (
15
16 {this.props.children}
17
18 );
19}
6function TouchableHighlight({ options = {} }) {
7 const [pressCount, setPressCount] = React.useState(0);
8
9 function onPress() {
10 console.log("Pressed!");
11 setPressCount(pressCount + 1);
12 }
13
14 function onLongPress() {
15 console.log("LONG PRESSED");
16 }
17
18 const { bind, active, hover } = useTouchable({
19 onPress,
20 onLongPress,
21 behavior: "button",
22 ...options
23 });
24
25 return (
26 <div>
27 {pressCount}
28 <div>
29 This is a touchable highlight
30 </div>
31 </div>
32 );
33}
35export function touchableBackground(color, fixRadius) {
36 if (isAndroid) {
37 if (Platform["Version"] &gt;= 21) {
38 return TouchableNativeFeedback.Ripple(
39 color || "rgba(255,255,255,0.75)",
40 fixRadius
41 );
42 } else {
43 TouchableNativeFeedback.SelectableBackground();
44 }
45 }
46 return undefined;
47}
122checkPress() {
123 if (this.swipeSts === 'opened') {
124 this.timingClose();
125 }
126 return this.swipeSts !== 'none';
127}

Related snippets