Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持OverlayView事件穿透 #348

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions components/ListRow/SwipeTouchableOpacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ export default class SwipeTouchableOpacity extends TouchableOpacity {
}

springClose() {
if(this.swipeSts==='none'){
return;
}
this.swipeSts = 'closing';
this.translateX = 0;
Animated.spring(this.state.translateX, {
Expand All @@ -140,6 +143,9 @@ export default class SwipeTouchableOpacity extends TouchableOpacity {
}

timingClose() {
if(this.swipeSts==='none'){
return;
}
this.swipeSts = 'closing';
this.translateX = 0;
Animated.timing(this.state.translateX, {
Expand All @@ -152,6 +158,9 @@ export default class SwipeTouchableOpacity extends TouchableOpacity {
}

timingOpen() {
if(this.swipeSts==='opened'){
return;
}
this.swipeSts = 'opening';
this.translateX = -this.props.swipeWidth;
Animated.timing(this.state.translateX, {
Expand Down
4 changes: 2 additions & 2 deletions components/ListRow/TouchableOpacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';

import {Platform, TouchableWithoutFeedback, Animated, ViewPropTypes} from 'react-native';
import Easing from 'react-native/Libraries/Animated/src/Easing';
import {Platform, TouchableWithoutFeedback, Animated, ViewPropTypes,Easing} from 'react-native';
// import Easing from 'react-native/Libraries/Animated/src/Easing';
import flattenStyle from 'react-native/Libraries/StyleSheet/flattenStyle';

if (Platform.constants.reactNativeVersion.major === 0 && Platform.constants.reactNativeVersion.minor < 62) {
Expand Down
5 changes: 4 additions & 1 deletion components/Overlay/OverlayView.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class OverlayView extends Component {
static propTypes = {
style: ViewPropTypes.style,
modal: PropTypes.bool,
blockTouch: PropTypes.bool,
animated: PropTypes.bool,
overlayOpacity: PropTypes.number,
overlayPointerEvents: ViewPropTypes.pointerEvents,
Expand All @@ -26,8 +27,9 @@ export default class OverlayView extends Component {

static defaultProps = {
modal: false,
blockTouch: true,
animated: false,
overlayPointerEvents: 'auto',
overlayPointerEvents: 'box-none',
autoKeyboardInsets: false,
closeOnHardwareBackPress: true,
};
Expand Down Expand Up @@ -172,6 +174,7 @@ export default class OverlayView extends Component {
<Animated.View
style={[styles.screen, {backgroundColor: '#000', opacity: this.state.overlayOpacity}]}
{...this.panResponder.panHandlers}
pointerEvents={this.props.blockTouch ? 'auto' : 'none'}
/>
<View style={this.buildStyle()} pointerEvents='box-none'>
{this.renderContent()}
Expand Down