11// @flow
22import 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' ;
55import styles from './style' ;
66
7- import type { valueXY } from '../types' ;
7+ import type { CopilotContext , valueXY } from '../types' ;
88
99
1010const rtl = I18nManager . isRTL ;
@@ -31,6 +31,10 @@ type State = {
3131} ;
3232
3333class ViewMask extends Component < Props , State > {
34+ static contextTypes = {
35+ _copilot : PropTypes . object ,
36+ }
37+
3438 state = {
3539 size : new Animated . ValueXY ( { x : 0 , y : 0 } ) ,
3640 position : new Animated . ValueXY ( { x : 0 , y : 0 } ) ,
@@ -42,6 +46,10 @@ class ViewMask extends Component<Props, State> {
4246 }
4347 }
4448
49+ context : {
50+ _copilot : CopilotContext ,
51+ }
52+
4553 animate = ( size : valueXY = this . props . size , position : valueXY = this . props . position ) : void => {
4654 if ( this . state . animated ) {
4755 Animated . parallel ( [
@@ -113,6 +121,17 @@ class ViewMask extends Component<Props, State> {
113121 } ,
114122 ] }
115123 />
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+ />
116135 </ View >
117136 ) ;
118137 }
0 commit comments