update patch

This commit is contained in:
Ammar Ahmed
2021-06-13 22:52:55 +05:00
parent eea8f4e959
commit e877c9e5f1

View File

@@ -1,5 +1,5 @@
diff --git a/node_modules/react-native-actions-sheet/src/index.js b/node_modules/react-native-actions-sheet/src/index.js
index dfa8fad..d243c06 100644
index dfa8fad..f5144e9 100644
--- a/node_modules/react-native-actions-sheet/src/index.js
+++ b/node_modules/react-native-actions-sheet/src/index.js
@@ -72,7 +72,7 @@ export default class ActionSheet extends Component {
@@ -11,7 +11,7 @@ index dfa8fad..d243c06 100644
let scrollOffset = this.props.gestureEnabled
? offset + correction + this.props.extraScroll
: offset + correction + this.props.extraScroll;
@@ -188,7 +188,7 @@ export default class ActionSheet extends Component {
@@ -188,17 +188,15 @@ export default class ActionSheet extends Component {
resolve(height === 0 ? 20 : height);
}
);
@@ -20,15 +20,42 @@ index dfa8fad..d243c06 100644
});
};
@@ -196,7 +196,6 @@ export default class ActionSheet extends Component {
let { gestureEnabled, delayActionSheetDraw, delayActionSheetDrawTime } =
this.props;
if (!event?.nativeEvent) return;
-
_showModal = async (event) => {
- let { gestureEnabled, delayActionSheetDraw, delayActionSheetDrawTime } =
- this.props;
- if (!event?.nativeEvent) return;
+ let { gestureEnabled, delayActionSheetDraw, delayActionSheetDrawTime } = this.props;
+ if (!event?.nativeEvent) return;
let height = event.nativeEvent.layout.height;
-
if (this.layoutHasCalled) {
@@ -277,7 +276,7 @@ export default class ActionSheet extends Component {
this._returnToPrevScrollPosition(height);
this.actionSheetHeight = height;
@@ -227,12 +225,12 @@ export default class ActionSheet extends Component {
this.underlayScale.setValue(1);
this.underlayTranslateY.setValue(100);
if (!gestureEnabled) {
- //DeviceEventEmitter.emit("hasReachedTop");
this.props.onPositionChanged && this.props.onPositionChanged(true);
}
this.layoutHasCalled = true;
this.updateActionSheetPosition(scrollOffset);
}
+
};
_openAnimation = (scrollOffset) => {
@@ -241,7 +239,7 @@ export default class ActionSheet extends Component {
if (animated) {
this.transformValue.setValue(scrollOffset);
Animated.parallel([
- Animated.spring(this.transformValue, {
+ Animated.timing(this.transformValue, {
toValue: 0,
bounciness: bounceOnOpen ? bounciness : 1,
speed: openAnimationSpeed,
@@ -277,7 +275,7 @@ export default class ActionSheet extends Component {
let { springOffset, extraScroll } = this.props;
let verticalOffset = event.nativeEvent.contentOffset.y;
@@ -37,18 +64,18 @@ index dfa8fad..d243c06 100644
if (this.isRecoiling) return;
if (this.prevScroll < verticalOffset) {
@@ -321,16 +320,17 @@ export default class ActionSheet extends Component {
@@ -321,8 +319,8 @@ export default class ActionSheet extends Component {
};
updateActionSheetPosition(scrollPosition) {
- if (!this.props.drawUnderStatusBar) return;
if (scrollPosition > this.state.deviceHeight) {
- if (scrollPosition > this.state.deviceHeight) {
+ if (scrollPosition >= this.state.deviceHeight - 15) {
+ if (!this.props.drawUnderStatusBar) return;
this.indicatorTranslateY.setValue(0);
} else {
+ console.log(this.state.paddingTop);
this.indicatorTranslateY.setValue(-this.state.paddingTop);
}
@@ -330,7 +328,7 @@ export default class ActionSheet extends Component {
}
_returnToPrevScrollPosition(height) {
@@ -57,19 +84,23 @@ index dfa8fad..d243c06 100644
let scrollOffset =
height * this.currentOffsetFromBottom +
correction +
@@ -380,7 +380,7 @@ export default class ActionSheet extends Component {
@@ -380,9 +378,10 @@ export default class ActionSheet extends Component {
this.targetId = event.nativeEvent.target;
this.offsetY = event.nativeEvent.contentOffset.y;
- let correction = this.state.deviceHeight * 0.1;
+ let correction = this.state.deviceHeight * 0.15;
let distanceFromTop = this.actionSheetHeight + correction - this.offsetY;
+
if (distanceFromTop < 3) {
@@ -395,21 +395,13 @@ export default class ActionSheet extends Component {
if (this.isReachedTop) {
this.isReachedTop = true;
@@ -394,18 +393,10 @@ export default class ActionSheet extends Component {
this.props.onPositionChanged && this.props.onPositionChanged(false);
}
}
if (this.actionSheetHeight >= this.state.deviceHeight) {
- if (this.actionSheetHeight >= this.state.deviceHeight) {
- if (!this.props.drawUnderStatusBar) return;
- /* if (
- distanceFromTop < StatusBar.currentHeight &&
@@ -80,20 +111,30 @@ index dfa8fad..d243c06 100644
- StatusBar.currentHeight - distanceFromTop
- );
- } */
+
+ if (this.actionSheetHeight >= this.state.deviceHeight - 1) {
if (distanceFromTop < this.state.paddingTop) {
+ if (!this.props.drawUnderStatusBar) return;
this.indicatorTranslateY.setValue(
-this.state.paddingTop + (this.state.paddingTop - distanceFromTop)
);
} else {
+ console.log('setting',this.state.paddingTop)
this.indicatorTranslateY.setValue(-this.state.paddingTop);
}
}
@@ -541,10 +533,11 @@ export default class ActionSheet extends Component {
@@ -536,15 +527,22 @@ export default class ActionSheet extends Component {
this._onKeyboardHide
);
}
-
+ timeout = null;
_onDeviceLayout = async (_event) => {
+
let event = { ..._event };
let safeMarginFromTop = 0;
- let safeMarginFromTop = 0;
+ if (this.timeout) {
+ clearTimeout(this.timeout);
+ }
+
+ this.timeout = setTimeout(async () => {
+ let safeMarginFromTop = 0;
+ let measuredPadding = Platform.OS === "ios" ? await this.measure() : StatusBar.currentHeight;
if (!this.props.drawUnderStatusBar) {
if (Platform.OS === "android" && !this.props.statusBarTranslucent) return;
@@ -104,7 +145,7 @@ index dfa8fad..d243c06 100644
}
let height = event.nativeEvent.layout.height - safeMarginFromTop;
@@ -562,16 +555,13 @@ export default class ActionSheet extends Component {
@@ -562,16 +560,16 @@ export default class ActionSheet extends Component {
deviceHeight: height,
deviceWidth: width,
portrait: height > width,
@@ -114,6 +155,9 @@ index dfa8fad..d243c06 100644
- : await this.measure(),
+ paddingTop:measuredPadding,
});
+ },1)
+
+
};
getInitialScrollPosition() {
@@ -123,7 +167,7 @@ index dfa8fad..d243c06 100644
let scrollPosition = this.props.gestureEnabled
? this.actionSheetHeight * this.props.initialOffsetFromBottom +
correction +
@@ -626,7 +616,7 @@ export default class ActionSheet extends Component {
@@ -626,7 +624,7 @@ export default class ActionSheet extends Component {
<SafeAreaView ref={this.safeAreaViewRef} style={styles.safearea}>
<View />
</SafeAreaView>
@@ -132,3 +176,30 @@ index dfa8fad..d243c06 100644
<FlatList
bounces={false}
keyboardShouldPersistTaps={keyboardShouldPersistTaps}
@@ -676,7 +674,7 @@ export default class ActionSheet extends Component {
onTouchStart={this._onTouchStart}
onTouchEnd={this._onTouchEnd}
style={{
- height: this.state.deviceHeight * 1.1,
+ height: this.state.deviceHeight * 1.15,
width: "100%",
zIndex: 10,
}}
@@ -685,7 +683,7 @@ export default class ActionSheet extends Component {
onPress={this._onTouchBackdrop}
onLongPress={this._onTouchBackdrop}
style={{
- height: this.state.deviceHeight * 1.1,
+ height: this.state.deviceHeight * 1.15,
width: "100%",
}}
/>
@@ -714,7 +712,7 @@ export default class ActionSheet extends Component {
<Animated.View
onLayout={this._showModal}
style={{
- maxHeight: "100%",
+ maxHeight: this.state.deviceHeight,
transform: [
{
translateY: this.indicatorTranslateY,