1
1
// @flow
2
2
import React , { Component } from 'react' ;
3
-
4
- import { View , Animated , I18nManager } from 'react-native' ;
3
+ import PropTypes from 'prop-types' ;
4
+ import { View , Animated , I18nManager , TouchableOpacity } from 'react-native' ;
5
5
import styles from './style' ;
6
6
7
- import type { valueXY } from '../types' ;
7
+ import type { CopilotContext , valueXY } from '../types' ;
8
8
9
9
10
10
const rtl = I18nManager . isRTL ;
@@ -31,6 +31,10 @@ type State = {
31
31
} ;
32
32
33
33
class ViewMask extends Component < Props , State > {
34
+ static contextTypes = {
35
+ _copilot : PropTypes . object ,
36
+ }
37
+
34
38
state = {
35
39
size : new Animated . ValueXY ( { x : 0 , y : 0 } ) ,
36
40
position : new Animated . ValueXY ( { x : 0 , y : 0 } ) ,
@@ -42,6 +46,10 @@ class ViewMask extends Component<Props, State> {
42
46
}
43
47
}
44
48
49
+ context : {
50
+ _copilot : CopilotContext ,
51
+ }
52
+
45
53
animate = ( size : valueXY = this . props . size , position : valueXY = this . props . position ) : void => {
46
54
if ( this . state . animated ) {
47
55
Animated . parallel ( [
@@ -113,6 +121,17 @@ class ViewMask extends Component<Props, State> {
113
121
} ,
114
122
] }
115
123
/>
124
+ < TouchableOpacity
125
+ style = { {
126
+ backgroundColor : 'transparent' ,
127
+ [ start ] : this . props . position . x ,
128
+ [ end ] : ( this . props . layout . width - ( this . props . size . x + this . props . position . x ) ) ,
129
+ top : this . props . position . y ,
130
+ width : this . props . size . x ,
131
+ height : this . props . size . y ,
132
+ } }
133
+ onPress = { this . context . _copilot . getCurrentStep ( ) . target . props . children . props . onPress || null }
134
+ />
116
135
</ View >
117
136
) ;
118
137
}
0 commit comments