2015-10-30 11:11:04 +00:00
|
|
|
/**
|
2018-09-11 22:27:47 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2015-10-30 11:11:04 +00:00
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-10-30 11:11:04 +00:00
|
|
|
*
|
2018-05-11 20:32:37 +00:00
|
|
|
* @format
|
2015-10-30 11:11:04 +00:00
|
|
|
* @flow
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
2016-04-09 03:36:40 +00:00
|
|
|
var React = require('react');
|
|
|
|
var ReactNative = require('react-native');
|
2018-05-11 20:32:37 +00:00
|
|
|
var {Text, View, TouchableOpacity} = ReactNative;
|
2015-10-30 11:11:04 +00:00
|
|
|
|
2017-08-18 01:36:54 +00:00
|
|
|
class TransparentHitTestExample extends React.Component<{}> {
|
2016-07-26 08:00:02 +00:00
|
|
|
render() {
|
2015-10-30 11:11:04 +00:00
|
|
|
return (
|
|
|
|
<View style={{flex: 1}}>
|
|
|
|
<TouchableOpacity onPress={() => alert('Hi!')}>
|
|
|
|
<Text>HELLO!</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
2018-05-11 20:32:37 +00:00
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
position: 'absolute',
|
|
|
|
backgroundColor: 'green',
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
bottom: 0,
|
|
|
|
right: 0,
|
|
|
|
opacity: 0.0,
|
|
|
|
}}
|
|
|
|
/>
|
2015-10-30 11:11:04 +00:00
|
|
|
</View>
|
|
|
|
);
|
2016-07-26 08:00:02 +00:00
|
|
|
}
|
|
|
|
}
|
2015-10-30 11:11:04 +00:00
|
|
|
|
|
|
|
exports.title = '<TransparentHitTestExample>';
|
|
|
|
exports.displayName = 'TransparentHitTestExample';
|
|
|
|
exports.description = 'Transparent view receiving touch events';
|
|
|
|
exports.examples = [
|
|
|
|
{
|
|
|
|
title: 'TransparentHitTestExample',
|
2018-05-11 20:32:37 +00:00
|
|
|
render(): React.Element<any> {
|
|
|
|
return <TransparentHitTestExample />;
|
|
|
|
},
|
|
|
|
},
|
2015-10-30 11:11:04 +00:00
|
|
|
];
|