浏览代码

[RN] "The View is never the target of touch events"

In preparation for "pinch to zoom" support in desktop streams on mobile, make
certain Views not intervene in touch event handling. While the modification is
necessary for "pinch to zoom" which is coming later, it really makes sense for
the modified Views to not be involved in touching because they're used to aid
layout and/or animations and are to behave to the user as if they're not there.
master
Zoltan Bettenbuk 7 年前
父节点
当前提交
cb70c084b3

+ 3
- 1
react/features/base/media/components/native/VideoTrack.js 查看文件

@@ -58,7 +58,9 @@ class VideoTrack extends AbstractVideoTrack {
58 58
         return (
59 59
             <View style = { styles.video } >
60 60
                 { super.render() }
61
-                <Animated.View style = { animatedStyles } />
61
+                <Animated.View
62
+                    pointerEvents = 'none'
63
+                    style = { animatedStyles } />
62 64
             </View>
63 65
         );
64 66
     }

+ 4
- 2
react/features/base/participants/components/ParticipantView.native.js 查看文件

@@ -158,8 +158,10 @@ class ParticipantView extends Component<Props> {
158 158
         };
159 159
 
160 160
         return (
161
-            <View style = { containerStyle } >
162
-                <Text style = { styles.connectionInfoText } >
161
+            <View
162
+                pointerEvents = 'box-none'
163
+                style = { containerStyle }>
164
+                <Text style = { styles.connectionInfoText }>
163 165
                     { t(messageKey, { displayName }) }
164 166
                 </Text>
165 167
             </View>

+ 9
- 2
react/features/base/react/components/native/Container.js 查看文件

@@ -43,10 +43,17 @@ export default class Container extends AbstractContainer {
43 43
             return null;
44 44
         }
45 45
 
46
-        let element = super._render(View, props);
46
+        const onClickOrTouchFeedback = onClick || touchFeedback;
47
+        let element
48
+            = super._render(
49
+                View,
50
+                {
51
+                    pointerEvents: onClickOrTouchFeedback ? 'auto' : 'box-none',
52
+                    ...props
53
+                });
47 54
 
48 55
         // onClick & touchFeedback
49
-        if (element && (onClick || touchFeedback)) {
56
+        if (element && onClickOrTouchFeedback) {
50 57
             element
51 58
                 = React.createElement(
52 59
                     touchFeedback

+ 9
- 3
react/features/base/react/components/native/TintedView.js 查看文件

@@ -135,9 +135,15 @@ export default class TintedView extends Component<Props, State> {
135 135
     render() {
136 136
         // XXX Don't tint the children, tint the background only.
137 137
         return (
138
-            <View style = { BASE_STYLE }>
139
-                <View style = { this.state.style } />
140
-                <View style = { BASE_STYLE }>
138
+            <View
139
+                pointerEvents = 'box-none'
140
+                style = { BASE_STYLE }>
141
+                <View
142
+                    pointerEvents = 'none'
143
+                    style = { this.state.style } />
144
+                <View
145
+                    pointerEvents = 'box-none'
146
+                    style = { BASE_STYLE }>
141 147
                     { this.props.children }
142 148
                 </View>
143 149
             </View>

+ 3
- 1
react/features/conference/components/Conference.native.js 查看文件

@@ -218,7 +218,9 @@ class Conference extends Component<Props> {
218 218
                         </TintedView>
219 219
                 }
220 220
 
221
-                <View style = { styles.toolboxAndFilmstripContainer } >
221
+                <View
222
+                    pointerEvents = 'box-none'
223
+                    style = { styles.toolboxAndFilmstripContainer }>
222 224
                     {/*
223 225
                       * The Toolbox is in a stacking layer bellow the Filmstrip.
224 226
                       */}

+ 2
- 0
react/features/toolbox/components/Toolbox.native.js 查看文件

@@ -188,6 +188,7 @@ class Toolbox extends Component<Props> {
188 188
         return (
189 189
             <View
190 190
                 key = 'primaryToolbar'
191
+                pointerEvents = 'box-none'
191 192
                 style = { styles.primaryToolbar }>
192 193
                 <AudioMuteButton buttonStyles = { audioButtonStyles } />
193 194
                 <HangupButton />
@@ -219,6 +220,7 @@ class Toolbox extends Component<Props> {
219 220
         return (
220 221
             <View
221 222
                 key = 'secondaryToolbar'
223
+                pointerEvents = 'box-none'
222 224
                 style = { styles.secondaryToolbar }>
223 225
                 {
224 226
                     AudioRouteButton

正在加载...
取消
保存