Initial commit

This commit is contained in:
marianesaldana
2026-05-23 08:59:34 -06:00
commit 80dbd947e5
36446 changed files with 3729147 additions and 0 deletions

21
frontend/node_modules/@react-navigation/stack/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 React Navigation Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,5 @@
# `@react-navigation/stack`
Stack navigator for React Navigation.
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/stack-navigator/).

View File

@@ -0,0 +1,361 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.forBottomSheetAndroid = forBottomSheetAndroid;
exports.forFadeFromBottomAndroid = forFadeFromBottomAndroid;
exports.forFadeFromCenter = forFadeFromCenter;
exports.forHorizontalIOS = forHorizontalIOS;
exports.forModalPresentationIOS = forModalPresentationIOS;
exports.forNoAnimation = forNoAnimation;
exports.forRevealFromBottomAndroid = forRevealFromBottomAndroid;
exports.forScaleFromCenterAndroid = forScaleFromCenterAndroid;
exports.forVerticalIOS = forVerticalIOS;
var _reactNative = require("react-native");
var _conditional = _interopRequireDefault(require("../utils/conditional"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const {
add,
multiply
} = _reactNative.Animated;
/**
* Standard iOS-style slide in from the right.
*/
function forHorizontalIOS(_ref) {
let {
current,
next,
inverted,
layouts: {
screen
}
} = _ref;
const translateFocused = multiply(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [screen.width, 0],
extrapolate: 'clamp'
}), inverted);
const translateUnfocused = next ? multiply(next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, screen.width * -0.3],
extrapolate: 'clamp'
}), inverted) : 0;
const overlayOpacity = current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 0.07],
extrapolate: 'clamp'
});
const shadowOpacity = current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 0.3],
extrapolate: 'clamp'
});
return {
cardStyle: {
transform: [
// Translation for the animation of the current card
{
translateX: translateFocused
},
// Translation for the animation of the card on top of this
{
translateX: translateUnfocused
}]
},
overlayStyle: {
opacity: overlayOpacity
},
shadowStyle: {
shadowOpacity
}
};
}
/**
* Standard iOS-style slide in from the bottom (used for modals).
*/
function forVerticalIOS(_ref2) {
let {
current,
inverted,
layouts: {
screen
}
} = _ref2;
const translateY = multiply(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [screen.height, 0],
extrapolate: 'clamp'
}), inverted);
return {
cardStyle: {
transform: [{
translateY
}]
}
};
}
/**
* Standard iOS-style modal animation in iOS 13.
*/
function forModalPresentationIOS(_ref3) {
let {
index,
current,
next,
inverted,
layouts: {
screen
},
insets
} = _ref3;
const hasNotchIos = _reactNative.Platform.OS === 'ios' && !_reactNative.Platform.isPad && !_reactNative.Platform.isTV && insets.top > 20;
const isLandscape = screen.width > screen.height;
const topOffset = isLandscape ? 0 : 10;
const statusBarHeight = insets.top;
const aspectRatio = screen.height / screen.width;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
const isFirst = index === 0;
const translateY = multiply(progress.interpolate({
inputRange: [0, 1, 2],
outputRange: [screen.height, isFirst ? 0 : topOffset, (isFirst ? statusBarHeight : 0) - topOffset * aspectRatio]
}), inverted);
const overlayOpacity = progress.interpolate({
inputRange: [0, 1, 1.0001, 2],
outputRange: [0, 0.3, 1, 1]
});
const scale = isLandscape ? 1 : progress.interpolate({
inputRange: [0, 1, 2],
outputRange: [1, 1, screen.width ? 1 - topOffset * 2 / screen.width : 1]
});
const borderRadius = isLandscape ? 0 : isFirst ? progress.interpolate({
inputRange: [0, 1, 1.0001, 2],
outputRange: [0, 0, hasNotchIos ? 38 : 0, 10]
}) : 10;
return {
cardStyle: {
overflow: 'hidden',
borderTopLeftRadius: borderRadius,
borderTopRightRadius: borderRadius,
// We don't need these for the animation
// But different border radius for corners improves animation perf
borderBottomLeftRadius: hasNotchIos ? borderRadius : 0,
borderBottomRightRadius: hasNotchIos ? borderRadius : 0,
marginTop: isFirst ? 0 : statusBarHeight,
marginBottom: isFirst ? 0 : topOffset,
transform: [{
translateY
}, {
scale
}]
},
overlayStyle: {
opacity: overlayOpacity
}
};
}
/**
* Standard Android-style fade in from the bottom for Android Oreo.
*/
function forFadeFromBottomAndroid(_ref4) {
let {
current,
inverted,
layouts: {
screen
},
closing
} = _ref4;
const translateY = multiply(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [screen.height * 0.08, 0],
extrapolate: 'clamp'
}), inverted);
const opacity = (0, _conditional.default)(closing, current.progress, current.progress.interpolate({
inputRange: [0, 0.5, 0.9, 1],
outputRange: [0, 0.25, 0.7, 1],
extrapolate: 'clamp'
}));
return {
cardStyle: {
opacity,
transform: [{
translateY
}]
}
};
}
/**
* Standard Android-style reveal from the bottom for Android Pie.
*/
function forRevealFromBottomAndroid(_ref5) {
let {
current,
next,
inverted,
layouts: {
screen
}
} = _ref5;
const containerTranslateY = multiply(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [screen.height, 0],
extrapolate: 'clamp'
}), inverted);
const cardTranslateYFocused = multiply(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [screen.height * (95.9 / 100) * -1, 0],
extrapolate: 'clamp'
}), inverted);
const cardTranslateYUnfocused = next ? multiply(next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, screen.height * (2 / 100) * -1],
extrapolate: 'clamp'
}), inverted) : 0;
const overlayOpacity = current.progress.interpolate({
inputRange: [0, 0.36, 1],
outputRange: [0, 0.1, 0.1],
extrapolate: 'clamp'
});
return {
containerStyle: {
overflow: 'hidden',
transform: [{
translateY: containerTranslateY
}]
},
cardStyle: {
transform: [{
translateY: cardTranslateYFocused
}, {
translateY: cardTranslateYUnfocused
}]
},
overlayStyle: {
opacity: overlayOpacity
}
};
}
/**
* Standard Android-style zoom for Android 10.
*/
function forScaleFromCenterAndroid(_ref6) {
let {
current,
next,
closing
} = _ref6;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
const opacity = progress.interpolate({
inputRange: [0, 0.75, 0.875, 1, 1.0825, 1.2075, 2],
outputRange: [0, 0, 1, 1, 1, 1, 0]
});
const scale = (0, _conditional.default)(closing, current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0.925, 1],
extrapolate: 'clamp'
}), progress.interpolate({
inputRange: [0, 1, 2],
outputRange: [0.85, 1, 1.075]
}));
return {
cardStyle: {
opacity,
transform: [{
scale
}]
}
};
}
/**
* Standard bottom sheet slide in from the bottom for Android.
*/
function forBottomSheetAndroid(_ref7) {
let {
current,
inverted,
layouts: {
screen
},
closing
} = _ref7;
const translateY = multiply(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [screen.height * 0.8, 0],
extrapolate: 'clamp'
}), inverted);
const opacity = (0, _conditional.default)(closing, current.progress, current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}));
const overlayOpacity = current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 0.3],
extrapolate: 'clamp'
});
return {
cardStyle: {
opacity,
transform: [{
translateY
}]
},
overlayStyle: {
opacity: overlayOpacity
}
};
}
/**
* Simple fade animation for dialogs
*/
function forFadeFromCenter(_ref8) {
let {
current: {
progress
}
} = _ref8;
return {
cardStyle: {
opacity: progress.interpolate({
inputRange: [0, 0.5, 0.9, 1],
outputRange: [0, 0.25, 0.7, 1]
})
},
overlayStyle: {
opacity: progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 0.5],
extrapolate: 'clamp'
})
}
};
}
function forNoAnimation() {
return {};
}
//# sourceMappingURL=CardStyleInterpolators.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,264 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.forFade = forFade;
exports.forNoAnimation = forNoAnimation;
exports.forSlideLeft = forSlideLeft;
exports.forSlideRight = forSlideRight;
exports.forSlideUp = forSlideUp;
exports.forUIKit = forUIKit;
var _reactNative = require("react-native");
const {
add
} = _reactNative.Animated;
/**
* Standard UIKit style animation for the header where the title fades into the back button label.
*/
function forUIKit(_ref) {
let {
current,
next,
layouts
} = _ref;
const defaultOffset = 100;
const leftSpacing = 27;
// The title and back button title should cross-fade to each other
// When screen is fully open, the title should be in center, and back title should be on left
// When screen is closing, the previous title will animate to back title's position
// And back title will animate to title's position
// We achieve this by calculating the offsets needed to translate title to back title's position and vice-versa
const leftLabelOffset = layouts.leftLabel ? (layouts.screen.width - layouts.leftLabel.width) / 2 - leftSpacing : defaultOffset;
const titleLeftOffset = layouts.title ? (layouts.screen.width - layouts.title.width) / 2 - leftSpacing : defaultOffset;
// When the current title is animating to right, it is centered in the right half of screen in middle of transition
// The back title also animates in from this position
const rightOffset = layouts.screen.width / 4;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
return {
leftButtonStyle: {
opacity: progress.interpolate({
inputRange: [0.3, 1, 1.5],
outputRange: [0, 1, 0]
})
},
leftLabelStyle: {
transform: [{
translateX: progress.interpolate({
inputRange: [0, 1, 2],
outputRange: _reactNative.I18nManager.getConstants().isRTL ? [-rightOffset, 0, leftLabelOffset] : [leftLabelOffset, 0, -rightOffset]
})
}]
},
rightButtonStyle: {
opacity: progress.interpolate({
inputRange: [0.3, 1, 1.5],
outputRange: [0, 1, 0]
})
},
titleStyle: {
opacity: progress.interpolate({
inputRange: [0, 0.4, 1, 1.5],
outputRange: [0, 0.1, 1, 0]
}),
transform: [{
translateX: progress.interpolate({
inputRange: [0.5, 1, 2],
outputRange: _reactNative.I18nManager.getConstants().isRTL ? [-titleLeftOffset, 0, rightOffset] : [rightOffset, 0, -titleLeftOffset]
})
}]
},
backgroundStyle: {
transform: [{
translateX: progress.interpolate({
inputRange: [0, 1, 2],
outputRange: _reactNative.I18nManager.getConstants().isRTL ? [-layouts.screen.width, 0, layouts.screen.width] : [layouts.screen.width, 0, -layouts.screen.width]
})
}]
}
};
}
/**
* Simple fade animation for the header elements.
*/
function forFade(_ref2) {
let {
current,
next
} = _ref2;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
const opacity = progress.interpolate({
inputRange: [0, 1, 2],
outputRange: [0, 1, 0]
});
return {
leftButtonStyle: {
opacity
},
rightButtonStyle: {
opacity
},
titleStyle: {
opacity
},
backgroundStyle: {
opacity: progress.interpolate({
inputRange: [0, 1, 1.9, 2],
outputRange: [0, 1, 1, 0]
})
}
};
}
/**
* Simple translate animation to translate the header to left.
*/
function forSlideLeft(_ref3) {
let {
current,
next,
layouts: {
screen
}
} = _ref3;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
const translateX = progress.interpolate({
inputRange: [0, 1, 2],
outputRange: _reactNative.I18nManager.getConstants().isRTL ? [-screen.width, 0, screen.width] : [screen.width, 0, -screen.width]
});
const transform = [{
translateX
}];
return {
leftButtonStyle: {
transform
},
rightButtonStyle: {
transform
},
titleStyle: {
transform
},
backgroundStyle: {
transform
}
};
}
/**
* Simple translate animation to translate the header to right.
*/
function forSlideRight(_ref4) {
let {
current,
next,
layouts: {
screen
}
} = _ref4;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
const translateX = progress.interpolate({
inputRange: [0, 1, 2],
outputRange: _reactNative.I18nManager.getConstants().isRTL ? [screen.width, 0, -screen.width] : [-screen.width, 0, screen.width]
});
const transform = [{
translateX
}];
return {
leftButtonStyle: {
transform
},
rightButtonStyle: {
transform
},
titleStyle: {
transform
},
backgroundStyle: {
transform
}
};
}
/**
* Simple translate animation to translate the header to slide up.
*/
function forSlideUp(_ref5) {
let {
current,
next,
layouts: {
header
}
} = _ref5;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
const translateY = progress.interpolate({
inputRange: [0, 1, 2],
outputRange: [-header.height, 0, -header.height]
});
const transform = [{
translateY
}];
return {
leftButtonStyle: {
transform
},
rightButtonStyle: {
transform
},
titleStyle: {
transform
},
backgroundStyle: {
transform
}
};
}
function forNoAnimation() {
return {};
}
//# sourceMappingURL=HeaderStyleInterpolators.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,144 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SlideFromRightIOS = exports.ScaleFromCenterAndroid = exports.RevealFromBottomAndroid = exports.ModalTransition = exports.ModalSlideFromBottomIOS = exports.ModalPresentationIOS = exports.ModalFadeTransition = exports.FadeFromBottomAndroid = exports.DefaultTransition = exports.BottomSheetAndroid = void 0;
var _reactNative = require("react-native");
var _CardStyleInterpolators = require("./CardStyleInterpolators");
var _HeaderStyleInterpolators = require("./HeaderStyleInterpolators");
var _TransitionSpecs = require("./TransitionSpecs");
const ANDROID_VERSION_PIE = 28;
const ANDROID_VERSION_10 = 29;
/**
* Standard iOS navigation transition.
*/
const SlideFromRightIOS = {
gestureDirection: 'horizontal',
transitionSpec: {
open: _TransitionSpecs.TransitionIOSSpec,
close: _TransitionSpecs.TransitionIOSSpec
},
cardStyleInterpolator: _CardStyleInterpolators.forHorizontalIOS,
headerStyleInterpolator: _HeaderStyleInterpolators.forFade
};
/**
* Standard iOS navigation transition for modals.
*/
exports.SlideFromRightIOS = SlideFromRightIOS;
const ModalSlideFromBottomIOS = {
gestureDirection: 'vertical',
transitionSpec: {
open: _TransitionSpecs.TransitionIOSSpec,
close: _TransitionSpecs.TransitionIOSSpec
},
cardStyleInterpolator: _CardStyleInterpolators.forVerticalIOS,
headerStyleInterpolator: _HeaderStyleInterpolators.forFade
};
/**
* Standard iOS modal presentation style (introduced in iOS 13).
*/
exports.ModalSlideFromBottomIOS = ModalSlideFromBottomIOS;
const ModalPresentationIOS = {
gestureDirection: 'vertical',
transitionSpec: {
open: _TransitionSpecs.TransitionIOSSpec,
close: _TransitionSpecs.TransitionIOSSpec
},
cardStyleInterpolator: _CardStyleInterpolators.forModalPresentationIOS,
headerStyleInterpolator: _HeaderStyleInterpolators.forFade
};
/**
* Standard Android navigation transition when opening or closing an Activity on Android < 9 (Oreo).
*/
exports.ModalPresentationIOS = ModalPresentationIOS;
const FadeFromBottomAndroid = {
gestureDirection: 'vertical',
transitionSpec: {
open: _TransitionSpecs.FadeInFromBottomAndroidSpec,
close: _TransitionSpecs.FadeOutToBottomAndroidSpec
},
cardStyleInterpolator: _CardStyleInterpolators.forFadeFromBottomAndroid,
headerStyleInterpolator: _HeaderStyleInterpolators.forFade
};
/**
* Standard Android navigation transition when opening or closing an Activity on Android 9 (Pie).
*/
exports.FadeFromBottomAndroid = FadeFromBottomAndroid;
const RevealFromBottomAndroid = {
gestureDirection: 'vertical',
transitionSpec: {
open: _TransitionSpecs.RevealFromBottomAndroidSpec,
close: _TransitionSpecs.RevealFromBottomAndroidSpec
},
cardStyleInterpolator: _CardStyleInterpolators.forRevealFromBottomAndroid,
headerStyleInterpolator: _HeaderStyleInterpolators.forFade
};
/**
* Standard Android navigation transition when opening or closing an Activity on Android 10 (Q).
*/
exports.RevealFromBottomAndroid = RevealFromBottomAndroid;
const ScaleFromCenterAndroid = {
gestureDirection: 'horizontal',
transitionSpec: {
open: _TransitionSpecs.ScaleFromCenterAndroidSpec,
close: _TransitionSpecs.ScaleFromCenterAndroidSpec
},
cardStyleInterpolator: _CardStyleInterpolators.forScaleFromCenterAndroid,
headerStyleInterpolator: _HeaderStyleInterpolators.forFade
};
/**
* Standard bottom sheet slide transition for Android 10.
*/
exports.ScaleFromCenterAndroid = ScaleFromCenterAndroid;
const BottomSheetAndroid = {
gestureDirection: 'vertical',
transitionSpec: {
open: _TransitionSpecs.BottomSheetSlideInSpec,
close: _TransitionSpecs.BottomSheetSlideOutSpec
},
cardStyleInterpolator: _CardStyleInterpolators.forBottomSheetAndroid,
headerStyleInterpolator: _HeaderStyleInterpolators.forFade
};
/**
* Fade transition for transparent modals.
*/
exports.BottomSheetAndroid = BottomSheetAndroid;
const ModalFadeTransition = {
gestureDirection: 'vertical',
transitionSpec: {
open: _TransitionSpecs.BottomSheetSlideInSpec,
close: _TransitionSpecs.BottomSheetSlideOutSpec
},
cardStyleInterpolator: _CardStyleInterpolators.forFadeFromCenter,
headerStyleInterpolator: _HeaderStyleInterpolators.forFade
};
/**
* Default navigation transition for the current platform.
*/
exports.ModalFadeTransition = ModalFadeTransition;
const DefaultTransition = _reactNative.Platform.select({
ios: SlideFromRightIOS,
android: _reactNative.Platform.Version >= ANDROID_VERSION_10 ? ScaleFromCenterAndroid : _reactNative.Platform.Version >= ANDROID_VERSION_PIE ? RevealFromBottomAndroid : FadeFromBottomAndroid,
default: ScaleFromCenterAndroid
});
/**
* Default modal transition for the current platform.
*/
exports.DefaultTransition = DefaultTransition;
const ModalTransition = _reactNative.Platform.select({
ios: ModalPresentationIOS,
default: BottomSheetAndroid
});
exports.ModalTransition = ModalTransition;
//# sourceMappingURL=TransitionPresets.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["ANDROID_VERSION_PIE","ANDROID_VERSION_10","SlideFromRightIOS","gestureDirection","transitionSpec","open","TransitionIOSSpec","close","cardStyleInterpolator","forHorizontalIOS","headerStyleInterpolator","forFade","ModalSlideFromBottomIOS","forVerticalIOS","ModalPresentationIOS","forModalPresentationIOS","FadeFromBottomAndroid","FadeInFromBottomAndroidSpec","FadeOutToBottomAndroidSpec","forFadeFromBottomAndroid","RevealFromBottomAndroid","RevealFromBottomAndroidSpec","forRevealFromBottomAndroid","ScaleFromCenterAndroid","ScaleFromCenterAndroidSpec","forScaleFromCenterAndroid","BottomSheetAndroid","BottomSheetSlideInSpec","BottomSheetSlideOutSpec","forBottomSheetAndroid","ModalFadeTransition","forFadeCard","DefaultTransition","Platform","select","ios","android","Version","default","ModalTransition"],"sourceRoot":"../../../src","sources":["TransitionConfigs/TransitionPresets.tsx"],"mappings":";;;;;;AAAA;AAGA;AAUA;AACA;AAUA,MAAMA,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,kBAAkB,GAAG,EAAE;;AAE7B;AACA;AACA;AACO,MAAMC,iBAAmC,GAAG;EACjDC,gBAAgB,EAAE,YAAY;EAC9BC,cAAc,EAAE;IACdC,IAAI,EAAEC,kCAAiB;IACvBC,KAAK,EAAED;EAC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kBAAoC,GAAG;EAClDvB,gBAAgB,EAAE,UAAU;EAC5BC,cAAc,EAAE;IACdC,IAAI,EAAEsB,uCAAsB;IAC5BpB,KAAK,EAAEqB;EACT,CAAC;EACDpB,qBAAqB,EAAEqB,6CAAqB;EAC5CnB,uBAAuB,EAAEC;AAC3B,CAAC;;AAED;AACA;AACA;AAFA;AAGO,MAAMmB,mBAAqC,GAAG;EACnD3B,gBAAgB,EAAE,UAAU;EAC5BC,cAAc,EAAE;IACdC,IAAI,EAAEsB,uCAAsB;IAC5BpB,KAAK,EAAEqB;EACT,CAAC;EACDpB,qBAAqB,EAAEuB,yCAAW;EAClCrB,uBAAuB,EAAEC;AAC3B,CAAC;;AAED;AACA;AACA;AAFA;AAGO,MAAMqB,iBAAiB,GAAGC,qBAAQ,CAACC,MAAM,CAAC;EAC/CC,GAAG,EAAEjC,iBAAiB;EACtBkC,OAAO,EACLH,qBAAQ,CAACI,OAAO,IAAIpC,kBAAkB,GAClCsB,sBAAsB,GACtBU,qBAAQ,CAACI,OAAO,IAAIrC,mBAAmB,GACvCoB,uBAAuB,GACvBJ,qBAAqB;EAC3BsB,OAAO,EAAEf;AACX,CAAC,CAAC;;AAEF;AACA;AACA;AAFA;AAGO,MAAMgB,eAAe,GAAGN,qBAAQ,CAACC,MAAM,CAAC;EAC7CC,GAAG,EAAErB,oBAAoB;EACzBwB,OAAO,EAAEZ;AACX,CAAC,CAAC;AAAC"}

View File

@@ -0,0 +1,107 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TransitionIOSSpec = exports.ScaleFromCenterAndroidSpec = exports.RevealFromBottomAndroidSpec = exports.FadeOutToBottomAndroidSpec = exports.FadeInFromBottomAndroidSpec = exports.BottomSheetSlideOutSpec = exports.BottomSheetSlideInSpec = void 0;
var _reactNative = require("react-native");
/**
* Exact values from UINavigationController's animation configuration.
*/
const TransitionIOSSpec = {
animation: 'spring',
config: {
stiffness: 1000,
damping: 500,
mass: 3,
overshootClamping: true,
restDisplacementThreshold: 10,
restSpeedThreshold: 10
}
};
/**
* Configuration for activity open animation from Android Nougat.
* See http://aosp.opersys.com/xref/android-7.1.2_r37/xref/frameworks/base/core/res/res/anim/activity_open_enter.xml
*/
exports.TransitionIOSSpec = TransitionIOSSpec;
const FadeInFromBottomAndroidSpec = {
animation: 'timing',
config: {
duration: 350,
easing: _reactNative.Easing.out(_reactNative.Easing.poly(5))
}
};
/**
* Configuration for activity close animation from Android Nougat.
* See http://aosp.opersys.com/xref/android-7.1.2_r37/xref/frameworks/base/core/res/res/anim/activity_close_exit.xml
*/
exports.FadeInFromBottomAndroidSpec = FadeInFromBottomAndroidSpec;
const FadeOutToBottomAndroidSpec = {
animation: 'timing',
config: {
duration: 150,
easing: _reactNative.Easing.in(_reactNative.Easing.linear)
}
};
/**
* Approximate configuration for activity open animation from Android Pie.
* See http://aosp.opersys.com/xref/android-9.0.0_r47/xref/frameworks/base/core/res/res/anim/activity_open_enter.xml
*/
exports.FadeOutToBottomAndroidSpec = FadeOutToBottomAndroidSpec;
const RevealFromBottomAndroidSpec = {
animation: 'timing',
config: {
duration: 425,
// This is super rough approximation of the path used for the curve by android
// See http://aosp.opersys.com/xref/android-9.0.0_r47/xref/frameworks/base/core/res/res/interpolator/fast_out_extra_slow_in.xml
easing: _reactNative.Easing.bezier(0.35, 0.45, 0, 1)
}
};
/**
* Approximate configuration for activity open animation from Android Q.
* See http://aosp.opersys.com/xref/android-10.0.0_r2/xref/frameworks/base/core/res/res/anim/activity_open_enter.xml
*/
exports.RevealFromBottomAndroidSpec = RevealFromBottomAndroidSpec;
const ScaleFromCenterAndroidSpec = {
animation: 'timing',
config: {
duration: 400,
// This is super rough approximation of the path used for the curve by android
// See http://aosp.opersys.com/xref/android-10.0.0_r2/xref/frameworks/base/core/res/res/interpolator/fast_out_extra_slow_in.xml
easing: _reactNative.Easing.bezier(0.35, 0.45, 0, 1)
}
};
/**
* Configuration for bottom sheet slide in animation from Material Design.
* See https://github.com/material-components/material-components-android/blob/fd3639092e1ffef9dc11bcedf79f32801d85e898/lib/java/com/google/android/material/bottomsheet/res/anim/mtrl_bottom_sheet_slide_in.xml
*/
exports.ScaleFromCenterAndroidSpec = ScaleFromCenterAndroidSpec;
const BottomSheetSlideInSpec = {
animation: 'timing',
config: {
duration: 250,
// See https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/animation/AccelerateDecelerateInterpolator.java
easing: t => Math.cos((t + 1) * Math.PI) / 2.0 + 0.5
}
};
/**
* Configuration for bottom sheet slide out animation from Material Design.
* See https://github.com/material-components/material-components-android/blob/fd3639092e1ffef9dc11bcedf79f32801d85e898/lib/java/com/google/android/material/bottomsheet/res/anim/mtrl_bottom_sheet_slide_in.xml
*/
exports.BottomSheetSlideInSpec = BottomSheetSlideInSpec;
const BottomSheetSlideOutSpec = {
animation: 'timing',
config: {
duration: 200,
// See https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/animation/AccelerateInterpolator.java
easing: t => t === 1.0 ? 1 : Math.pow(t, 2)
}
};
exports.BottomSheetSlideOutSpec = BottomSheetSlideOutSpec;
//# sourceMappingURL=TransitionSpecs.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["TransitionIOSSpec","animation","config","stiffness","damping","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold","FadeInFromBottomAndroidSpec","duration","easing","Easing","out","poly","FadeOutToBottomAndroidSpec","in","linear","RevealFromBottomAndroidSpec","bezier","ScaleFromCenterAndroidSpec","BottomSheetSlideInSpec","t","Math","cos","PI","BottomSheetSlideOutSpec","pow"],"sourceRoot":"../../../src","sources":["TransitionConfigs/TransitionSpecs.tsx"],"mappings":";;;;;;AAAA;AAIA;AACA;AACA;AACO,MAAMA,iBAAiC,GAAG;EAC/CC,SAAS,EAAE,QAAQ;EACnBC,MAAM,EAAE;IACNC,SAAS,EAAE,IAAI;IACfC,OAAO,EAAE,GAAG;IACZC,IAAI,EAAE,CAAC;IACPC,iBAAiB,EAAE,IAAI;IACvBC,yB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;EACrD;AACF,CAAC;;AAED;AACA;AACA;AACA;AAHA;AAIO,MAAMC,uBAAuC,GAAG;EACrDzB,SAAS,EAAE,QAAQ;EACnBC,MAAM,EAAE;IACNQ,QAAQ,EAAE,GAAG;IACb;IACAC,MAAM,EAAGW,CAAC,IAAMA,CAAC,KAAK,GAAG,GAAG,CAAC,GAAGC,IAAI,CAACI,GAAG,CAACL,CAAC,EAAE,CAAC;EAC/C;AACF,CAAC;AAAC"}

View File

@@ -0,0 +1,69 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "CardAnimationContext", {
enumerable: true,
get: function () {
return _CardAnimationContext.default;
}
});
exports.CardStyleInterpolators = void 0;
Object.defineProperty(exports, "GestureHandlerRefContext", {
enumerable: true,
get: function () {
return _GestureHandlerRefContext.default;
}
});
Object.defineProperty(exports, "Header", {
enumerable: true,
get: function () {
return _Header.default;
}
});
exports.HeaderStyleInterpolators = void 0;
Object.defineProperty(exports, "StackView", {
enumerable: true,
get: function () {
return _StackView.default;
}
});
exports.TransitionSpecs = exports.TransitionPresets = void 0;
Object.defineProperty(exports, "createStackNavigator", {
enumerable: true,
get: function () {
return _createStackNavigator.default;
}
});
Object.defineProperty(exports, "useCardAnimation", {
enumerable: true,
get: function () {
return _useCardAnimation.default;
}
});
Object.defineProperty(exports, "useGestureHandlerRef", {
enumerable: true,
get: function () {
return _useGestureHandlerRef.default;
}
});
var CardStyleInterpolators = _interopRequireWildcard(require("./TransitionConfigs/CardStyleInterpolators"));
exports.CardStyleInterpolators = CardStyleInterpolators;
var HeaderStyleInterpolators = _interopRequireWildcard(require("./TransitionConfigs/HeaderStyleInterpolators"));
exports.HeaderStyleInterpolators = HeaderStyleInterpolators;
var TransitionPresets = _interopRequireWildcard(require("./TransitionConfigs/TransitionPresets"));
exports.TransitionPresets = TransitionPresets;
var TransitionSpecs = _interopRequireWildcard(require("./TransitionConfigs/TransitionSpecs"));
exports.TransitionSpecs = TransitionSpecs;
var _createStackNavigator = _interopRequireDefault(require("./navigators/createStackNavigator"));
var _Header = _interopRequireDefault(require("./views/Header/Header"));
var _StackView = _interopRequireDefault(require("./views/Stack/StackView"));
var _CardAnimationContext = _interopRequireDefault(require("./utils/CardAnimationContext"));
var _GestureHandlerRefContext = _interopRequireDefault(require("./utils/GestureHandlerRefContext"));
var _useCardAnimation = _interopRequireDefault(require("./utils/useCardAnimation"));
var _useGestureHandlerRef = _interopRequireDefault(require("./utils/useGestureHandlerRef"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAqF;AACrF;AAAyF;AACzF;AAA2E;AAC3E;AAAuE;AAKvE;AAKA;AACA;AAeA;AACA;AACA;AACA;AAA+E;AAAA;AAAA"}

View File

@@ -0,0 +1,84 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _native = require("@react-navigation/native");
var React = _interopRequireWildcard(require("react"));
var _warnOnce = _interopRequireDefault(require("warn-once"));
var _StackView = _interopRequireDefault(require("../views/Stack/StackView"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function StackNavigator(_ref) {
let {
id,
initialRouteName,
children,
screenListeners,
screenOptions,
...rest
} = _ref;
// @ts-expect-error: mode is deprecated
const mode = rest.mode;
(0, _warnOnce.default)(mode != null, `Stack Navigator: 'mode="${mode}"' is deprecated. Use 'presentation: "${mode}"' in 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/stack-navigator#presentation for more details.`);
// @ts-expect-error: headerMode='none' is deprecated
const headerMode = rest.headerMode;
(0, _warnOnce.default)(headerMode === 'none', `Stack Navigator: 'headerMode="none"' is deprecated. Use 'headerShown: false' in 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/stack-navigator/#headershown for more details.`);
(0, _warnOnce.default)(headerMode != null && headerMode !== 'none', `Stack Navigator: 'headerMode' is moved to 'options'. Moved it to 'screenOptions' to keep current behavior.\n\nSee https://reactnavigation.org/docs/stack-navigator/#headermode for more details.`);
// @ts-expect-error: headerMode='none' is deprecated
const keyboardHandlingEnabled = rest.keyboardHandlingEnabled;
(0, _warnOnce.default)(keyboardHandlingEnabled !== undefined, `Stack Navigator: 'keyboardHandlingEnabled' is moved to 'options'. Moved it to 'screenOptions' to keep current behavior.\n\nSee https://reactnavigation.org/docs/stack-navigator/#keyboardhandlingenabled for more details.`);
const defaultScreenOptions = {
presentation: mode,
headerShown: headerMode ? headerMode !== 'none' : true,
headerMode: headerMode && headerMode !== 'none' ? headerMode : undefined,
keyboardHandlingEnabled
};
const {
state,
descriptors,
navigation,
NavigationContent
} = (0, _native.useNavigationBuilder)(_native.StackRouter, {
id,
initialRouteName,
children,
screenListeners,
screenOptions,
defaultScreenOptions
});
React.useEffect(() => {
var _navigation$addListen;
return (// @ts-expect-error: there may not be a tab navigator in parent
(_navigation$addListen = navigation.addListener) === null || _navigation$addListen === void 0 ? void 0 : _navigation$addListen.call(navigation, 'tabPress', e => {
const isFocused = navigation.isFocused();
// Run the operation in the next frame so we're sure all listeners have been run
// This is necessary to know if preventDefault() has been called
requestAnimationFrame(() => {
if (state.index > 0 && isFocused && !e.defaultPrevented) {
// When user taps on already focused tab and we're inside the tab,
// reset the stack to replicate native behaviour
navigation.dispatch({
..._native.StackActions.popToTop(),
target: state.key
});
}
});
})
);
}, [navigation, state.index, state.key]);
return /*#__PURE__*/React.createElement(NavigationContent, null, /*#__PURE__*/React.createElement(_StackView.default, _extends({}, rest, {
state: state,
descriptors: descriptors,
navigation: navigation
})));
}
var _default = (0, _native.createNavigatorFactory)(StackNavigator);
exports.default = _default;
//# sourceMappingURL=createStackNavigator.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["StackNavigator","id","initialRouteName","children","screenListeners","screenOptions","rest","mode","warnOnce","headerMode","keyboardHandlingEnabled","undefined","defaultScreenOptions","presentation","headerShown","state","descriptors","navigation","NavigationContent","useNavigationBuilder","StackRouter","React","useEffect","addListener","e","isFocused","requestAnimationFrame","index","defaultPrevented","dispatch","StackActions","popToTop","target","key","createNavigatorFactory"],"sourceRoot":"../../../src","sources":["navigators/createStackNavigator.tsx"],"mappings":";;;;;;AAAA;AAYA;AACA;AAQA;AAAiD;AAAA;AAAA;AAAA;AAWjD,SAASA,cAAc,OAOb;EAAA,IAPc;IACtBC,EAAE;IACFC,gBAAgB;IAChBC,QAAQ;IACRC,eAAe;IACfC,aAAa;IACb,GAAGC;EACE,CAAC;EACN;EACA,MAAMC,IAAI,GAAGD,IAAI,CAACC,IAAoC;EAEtD,IAAAC,iBAAQ,EACND,IAAI,IAAI,IAAI,EACX,2BAA0BA,IAAK,yCAAwCA,IAAK,uHAAsH,CACpM;;EAED;EACA,MAAME,UAAU,GAAGH,IAAI,CAACG,UAAkD;EAE1E,IAAAD,iBAAQ,EACNC,UAAU,KAAK,MAAM,EACpB,iMAAgM,CAClM;EAED,IAAAD,iBAAQ,EACNC,UAAU,IAAI,IAAI,IAAIA,UAAU,KAAK,MAAM,EAC1C,kMAAiM,CACnM;;EAED;EACA,MAAMC,uBAAuB,GAAGJ,IAAI,CAACI,uBAAuB;EAE5D,IAAAF,iBAAQ,EACNE,uBAAuB,KAAKC,SAAS,EACpC,4NAA2N,CAC7N;EAED,MAAMC,oBAA4C,GAAG;IACnDC,YAAY,EAAEN,IAAI;IAClBO,WAAW,EAAEL,UAAU,GAAGA,UAAU,KAAK,MAAM,GAAG,IAAI;IACtDA,UAAU,EAAEA,UAAU,IAAIA,UAAU,KAAK,MAAM,GAAGA,UAAU,GAAGE,SAAS;IACxED;EACF,CAAC;EAED,MAAM;IAAEK,KAAK;IAAEC,WAAW;IAAEC,UAAU;IAAEC;EAAkB,CAAC,GACzD,IAAAC,4BAAoB,EAMlBC,mBAAW,EAAE;IACbnB,EAAE;IACFC,gBAAgB;IAChBC,QAAQ;IACRC,eAAe;IACfC,aAAa;IACbO;EACF,CAAC,CAAC;EAEJS,KAAK,CAACC,SAAS,CACb;IAAA;IAAA,OACE;MAAA,yBACAL,UAAU,CAACM,WAAW,0DAAtB,2BAAAN,UAAU,EAAe,UAAU,EAAGO,CAAC,IAAK;QAC1C,MAAMC,SAAS,GAAGR,UAAU,CAACQ,SAAS,EAAE;;QAExC;QACA;QACAC,qBAAqB,CAAC,MAAM;UAC1B,IACEX,KAAK,CAACY,KAAK,GAAG,CAAC,IACfF,SAAS,IACT,CAAED,CAAC,CAA2CI,gBAAgB,EAC9D;YACA;YACA;YACAX,UAAU,CAACY,QAAQ,CAAC;cAClB,GAAGC,oBAAY,CAACC,QAAQ,EAAE;cAC1BC,MAAM,EAAEjB,KAAK,CAACkB;YAChB,CAAC,CAAC;UACJ;QACF,CAAC,CAAC;MACJ,CAAC;IAAC;EAAA,GACJ,CAAChB,UAAU,EAAEF,KAAK,CAACY,KAAK,EAAEZ,KAAK,CAACkB,GAAG,CAAC,CACrC;EAED,oBACE,oBAAC,iBAAiB,qBAChB,oBAAC,kBAAS,eACJ3B,IAAI;IACR,KAAK,EAAES,KAAM;IACb,WAAW,EAAEC,WAAY;IACzB,UAAU,EAAEC;EAAW,GACvB,CACgB;AAExB;AAAC,eAEc,IAAAiB,8BAAsB,EAKnClC,cAAc,CAAC;AAAA"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.tsx"],"mappings":""}

View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var _default = /*#__PURE__*/React.createContext(undefined);
exports.default = _default;
//# sourceMappingURL=CardAnimationContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","createContext","undefined"],"sourceRoot":"../../../src","sources":["utils/CardAnimationContext.tsx"],"mappings":";;;;;;AAAA;AAA+B;AAAA;AAAA,4BAIhBA,KAAK,CAACC,aAAa,CAChCC,SAAS,CACV;AAAA"}

View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var _default = /*#__PURE__*/React.createContext(null);
exports.default = _default;
//# sourceMappingURL=GestureHandlerRefContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","createContext"],"sourceRoot":"../../../src","sources":["utils/GestureHandlerRefContext.tsx"],"mappings":";;;;;;AAAA;AAA+B;AAAA;AAAA,4BAEhBA,KAAK,CAACC,aAAa,CAExB,IAAI,CAAC;AAAA"}

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const ModalPresentationContext = /*#__PURE__*/React.createContext(false);
var _default = ModalPresentationContext;
exports.default = _default;
//# sourceMappingURL=ModalPresentationContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["ModalPresentationContext","React","createContext"],"sourceRoot":"../../../src","sources":["utils/ModalPresentationContext.tsx"],"mappings":";;;;;;AAAA;AAA+B;AAAA;AAE/B,MAAMA,wBAAwB,gBAAGC,KAAK,CAACC,aAAa,CAAC,KAAK,CAAC;AAAC,eAE7CF,wBAAwB;AAAA"}

View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = conditional;
var _reactNative = require("react-native");
const {
add,
multiply
} = _reactNative.Animated;
/**
* Use an Animated Node based on a condition. Similar to Reanimated's `cond`.
*
* @param condition Animated Node representing the condition, must be 0 or 1, 1 means `true`, 0 means `false`
* @param main Animated Node to use if the condition is `true`
* @param fallback Animated Node to use if the condition is `false`
*/
function conditional(condition, main, fallback) {
// To implement this behavior, we multiply the main node with the condition.
// So if condition is 0, result will be 0, and if condition is 1, result will be main node.
// Then we multiple reverse of the condition (0 if condition is 1) with the fallback.
// So if condition is 0, result will be fallback node, and if condition is 1, result will be 0,
// This way, one of them will always be 0, and other one will be the value we need.
// In the end we add them both together, 0 + value we need = value we need
return add(multiply(condition, main), multiply(condition.interpolate({
inputRange: [0, 1],
outputRange: [1, 0]
}), fallback));
}
//# sourceMappingURL=conditional.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["add","multiply","Animated","conditional","condition","main","fallback","interpolate","inputRange","outputRange"],"sourceRoot":"../../../src","sources":["utils/conditional.tsx"],"mappings":";;;;;;AAAA;AAEA,MAAM;EAAEA,GAAG;EAAEC;AAAS,CAAC,GAAGC,qBAAQ;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,WAAW,CACjCC,SAAgD,EAChDC,IAA4C,EAC5CC,QAAgD,EAChD;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAON,GAAG,CACRC,QAAQ,CAACG,SAAS,EAAEC,IAAI,CAAC,EACzBJ,QAAQ,CACNG,SAAS,CAACG,WAAW,CAAC;IACpBC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClBC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC;EACpB,CAAC,CAAC,EACFH,QAAQ,CACT,CACF;AACH"}

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = debounce;
function debounce(func, duration) {
let timeout;
return function () {
if (!timeout) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
// eslint-disable-next-line babel/no-invalid-this
func.apply(this, args);
timeout = setTimeout(() => {
timeout = undefined;
}, duration);
}
};
}
//# sourceMappingURL=debounce.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["debounce","func","duration","timeout","args","apply","setTimeout","undefined"],"sourceRoot":"../../../src","sources":["utils/debounce.tsx"],"mappings":";;;;;;AAAe,SAASA,QAAQ,CAC9BC,IAAO,EACPC,QAAgB,EACb;EACH,IAAIC,OAA4C;EAEhD,OAAO,YAA8B;IACnC,IAAI,CAACA,OAAO,EAAE;MAAA,kCADeC,IAAI;QAAJA,IAAI;MAAA;MAE/B;MACAH,IAAI,CAACI,KAAK,CAAC,IAAI,EAAED,IAAI,CAAC;MAEtBD,OAAO,GAAGG,UAAU,CAAC,MAAM;QACzBH,OAAO,GAAGI,SAAS;MACrB,CAAC,EAAEL,QAAQ,CAAC;IACd;EACF,CAAC;AACH"}

View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = findLastIndex;
function findLastIndex(array, callback) {
for (var i = array.length - 1; i >= 0; i--) {
if (callback(array[i])) {
return i;
}
}
return -1;
}
//# sourceMappingURL=findLastIndex.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["findLastIndex","array","callback","i","length"],"sourceRoot":"../../../src","sources":["utils/findLastIndex.tsx"],"mappings":";;;;;;AAAe,SAASA,aAAa,CACnCC,KAAU,EACVC,QAA+B,EAC/B;EACA,KAAK,IAAIC,CAAC,GAAGF,KAAK,CAACG,MAAM,GAAG,CAAC,EAAED,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC1C,IAAID,QAAQ,CAACD,KAAK,CAACE,CAAC,CAAC,CAAC,EAAE;MACtB,OAAOA,CAAC;IACV;EACF;EAEA,OAAO,CAAC,CAAC;AACX"}

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getDistanceForDirection;
var _getInvertedMultiplier = _interopRequireDefault(require("./getInvertedMultiplier"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getDistanceForDirection(layout, gestureDirection) {
const multiplier = (0, _getInvertedMultiplier.default)(gestureDirection);
switch (gestureDirection) {
case 'vertical':
case 'vertical-inverted':
return layout.height * multiplier;
case 'horizontal':
case 'horizontal-inverted':
return layout.width * multiplier;
}
}
//# sourceMappingURL=getDistanceForDirection.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getDistanceForDirection","layout","gestureDirection","multiplier","getInvertedMultiplier","height","width"],"sourceRoot":"../../../src","sources":["utils/getDistanceForDirection.tsx"],"mappings":";;;;;;AACA;AAA4D;AAE7C,SAASA,uBAAuB,CAC7CC,MAAc,EACdC,gBAAkC,EAC1B;EACR,MAAMC,UAAU,GAAG,IAAAC,8BAAqB,EAACF,gBAAgB,CAAC;EAE1D,QAAQA,gBAAgB;IACtB,KAAK,UAAU;IACf,KAAK,mBAAmB;MACtB,OAAOD,MAAM,CAACI,MAAM,GAAGF,UAAU;IACnC,KAAK,YAAY;IACjB,KAAK,qBAAqB;MACxB,OAAOF,MAAM,CAACK,KAAK,GAAGH,UAAU;EAAC;AAEvC"}

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getInvertedMultiplier;
var _reactNative = require("react-native");
function getInvertedMultiplier(gestureDirection) {
switch (gestureDirection) {
case 'vertical':
return 1;
case 'vertical-inverted':
return -1;
case 'horizontal':
return _reactNative.I18nManager.getConstants().isRTL ? -1 : 1;
case 'horizontal-inverted':
return _reactNative.I18nManager.getConstants().isRTL ? 1 : -1;
}
}
//# sourceMappingURL=getInvertedMultiplier.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getInvertedMultiplier","gestureDirection","I18nManager","getConstants","isRTL"],"sourceRoot":"../../../src","sources":["utils/getInvertedMultiplier.tsx"],"mappings":";;;;;;AAAA;AAIe,SAASA,qBAAqB,CAC3CC,gBAAkC,EAC1B;EACR,QAAQA,gBAAgB;IACtB,KAAK,UAAU;MACb,OAAO,CAAC;IACV,KAAK,mBAAmB;MACtB,OAAO,CAAC,CAAC;IACX,KAAK,YAAY;MACf,OAAOC,wBAAW,CAACC,YAAY,EAAE,CAACC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC;IAClD,KAAK,qBAAqB;MACxB,OAAOF,wBAAW,CAACC,YAAY,EAAE,CAACC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;EAAC;AAEvD"}

View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = memoize;
function memoize(callback) {
let previous;
let result;
return function () {
let hasChanged = false;
for (var _len = arguments.length, dependencies = new Array(_len), _key = 0; _key < _len; _key++) {
dependencies[_key] = arguments[_key];
}
if (previous) {
if (previous.length !== dependencies.length) {
hasChanged = true;
} else {
for (let i = 0; i < previous.length; i++) {
if (previous[i] !== dependencies[i]) {
hasChanged = true;
break;
}
}
}
} else {
hasChanged = true;
}
previous = dependencies;
if (hasChanged || result === undefined) {
result = callback(...dependencies);
}
return result;
};
}
//# sourceMappingURL=memoize.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["memoize","callback","previous","result","hasChanged","dependencies","length","i","undefined"],"sourceRoot":"../../../src","sources":["utils/memoize.tsx"],"mappings":";;;;;;AAAe,SAASA,OAAO,CAC7BC,QAAmC,EACnC;EACA,IAAIC,QAA0B;EAC9B,IAAIC,MAA0B;EAE9B,OAAO,YAAmC;IACxC,IAAIC,UAAU,GAAG,KAAK;IAAC,kCADdC,YAAY;MAAZA,YAAY;IAAA;IAGrB,IAAIH,QAAQ,EAAE;MACZ,IAAIA,QAAQ,CAACI,MAAM,KAAKD,YAAY,CAACC,MAAM,EAAE;QAC3CF,UAAU,GAAG,IAAI;MACnB,CAAC,MAAM;QACL,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,QAAQ,CAACI,MAAM,EAAEC,CAAC,EAAE,EAAE;UACxC,IAAIL,QAAQ,CAACK,CAAC,CAAC,KAAKF,YAAY,CAACE,CAAC,CAAC,EAAE;YACnCH,UAAU,GAAG,IAAI;YACjB;UACF;QACF;MACF;IACF,CAAC,MAAM;MACLA,UAAU,GAAG,IAAI;IACnB;IAEAF,QAAQ,GAAGG,YAAY;IAEvB,IAAID,UAAU,IAAID,MAAM,KAAKK,SAAS,EAAE;MACtCL,MAAM,GAAGF,QAAQ,CAAC,GAAGI,YAAY,CAAC;IACpC;IAEA,OAAOF,MAAM;EACf,CAAC;AACH"}

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useCardAnimation;
var React = _interopRequireWildcard(require("react"));
var _CardAnimationContext = _interopRequireDefault(require("./CardAnimationContext"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function useCardAnimation() {
const animation = React.useContext(_CardAnimationContext.default);
if (animation === undefined) {
throw new Error("Couldn't find values for card animation. Are you inside a screen in Stack?");
}
return animation;
}
//# sourceMappingURL=useCardAnimation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useCardAnimation","animation","React","useContext","CardAnimationContext","undefined","Error"],"sourceRoot":"../../../src","sources":["utils/useCardAnimation.tsx"],"mappings":";;;;;;AAAA;AAEA;AAA0D;AAAA;AAAA;AAE3C,SAASA,gBAAgB,GAAG;EACzC,MAAMC,SAAS,GAAGC,KAAK,CAACC,UAAU,CAACC,6BAAoB,CAAC;EAExD,IAAIH,SAAS,KAAKI,SAAS,EAAE;IAC3B,MAAM,IAAIC,KAAK,CACb,4EAA4E,CAC7E;EACH;EAEA,OAAOL,SAAS;AAClB"}

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useGestureHandlerRef;
var React = _interopRequireWildcard(require("react"));
var _GestureHandlerRefContext = _interopRequireDefault(require("./GestureHandlerRefContext"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function useGestureHandlerRef() {
const ref = React.useContext(_GestureHandlerRefContext.default);
if (ref === undefined) {
throw new Error("Couldn't find a ref for gesture handler. Are you inside a screen in Stack?");
}
return ref;
}
//# sourceMappingURL=useGestureHandlerRef.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useGestureHandlerRef","ref","React","useContext","StackGestureRefContext","undefined","Error"],"sourceRoot":"../../../src","sources":["utils/useGestureHandlerRef.tsx"],"mappings":";;;;;;AAAA;AAEA;AAAgE;AAAA;AAAA;AAEjD,SAASA,oBAAoB,GAAG;EAC7C,MAAMC,GAAG,GAAGC,KAAK,CAACC,UAAU,CAACC,iCAAsB,CAAC;EAEpD,IAAIH,GAAG,KAAKI,SAAS,EAAE;IACrB,MAAM,IAAIC,KAAK,CACb,4EAA4E,CAC7E;EACH;EAEA,OAAOL,GAAG;AACZ"}

View File

@@ -0,0 +1,96 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useKeyboardManager;
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function useKeyboardManager(isEnabled) {
// Numeric id of the previously focused text input
// When a gesture didn't change the tab, we can restore the focused input with this
const previouslyFocusedTextInputRef = React.useRef(undefined);
const startTimestampRef = React.useRef(0);
const keyboardTimeoutRef = React.useRef();
const clearKeyboardTimeout = React.useCallback(() => {
if (keyboardTimeoutRef.current !== undefined) {
clearTimeout(keyboardTimeoutRef.current);
keyboardTimeoutRef.current = undefined;
}
}, []);
const onPageChangeStart = React.useCallback(() => {
if (!isEnabled()) {
return;
}
clearKeyboardTimeout();
const input = _reactNative.TextInput.State.currentlyFocusedInput();
// When a page change begins, blur the currently focused input
input === null || input === void 0 ? void 0 : input.blur();
// Store the id of this input so we can refocus it if change was cancelled
previouslyFocusedTextInputRef.current = input;
// Store timestamp for touch start
startTimestampRef.current = Date.now();
}, [clearKeyboardTimeout, isEnabled]);
const onPageChangeConfirm = React.useCallback(force => {
if (!isEnabled()) {
return;
}
clearKeyboardTimeout();
if (force) {
// Always dismiss input, even if we don't have a ref to it
// We might not have the ref if onPageChangeStart was never called
// This can happen if page change was not from a gesture
_reactNative.Keyboard.dismiss();
} else {
const input = previouslyFocusedTextInputRef.current;
// Dismiss the keyboard only if an input was a focused before
// This makes sure we don't dismiss input on going back and focusing an input
input === null || input === void 0 ? void 0 : input.blur();
}
// Cleanup the ID on successful page change
previouslyFocusedTextInputRef.current = undefined;
}, [clearKeyboardTimeout, isEnabled]);
const onPageChangeCancel = React.useCallback(() => {
if (!isEnabled()) {
return;
}
clearKeyboardTimeout();
// The page didn't change, we should restore the focus of text input
const input = previouslyFocusedTextInputRef.current;
if (input) {
// If the interaction was super short we should make sure keyboard won't hide again.
// Too fast input refocus will result only in keyboard flashing on screen and hiding right away.
// During first ~100ms keyboard will be dismissed no matter what,
// so we have to make sure it won't interrupt input refocus logic.
// That's why when the interaction is shorter than 100ms we add delay so it won't hide once again.
// Subtracting timestamps makes us sure the delay is executed only when needed.
if (Date.now() - startTimestampRef.current < 100) {
keyboardTimeoutRef.current = setTimeout(() => {
input === null || input === void 0 ? void 0 : input.focus();
previouslyFocusedTextInputRef.current = undefined;
}, 100);
} else {
input === null || input === void 0 ? void 0 : input.focus();
previouslyFocusedTextInputRef.current = undefined;
}
}
}, [clearKeyboardTimeout, isEnabled]);
React.useEffect(() => {
return () => clearKeyboardTimeout();
}, [clearKeyboardTimeout]);
return {
onPageChangeStart,
onPageChangeConfirm,
onPageChangeCancel
};
}
//# sourceMappingURL=useKeyboardManager.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useKeyboardManager","isEnabled","previouslyFocusedTextInputRef","React","useRef","undefined","startTimestampRef","keyboardTimeoutRef","clearKeyboardTimeout","useCallback","current","clearTimeout","onPageChangeStart","input","TextInput","State","currentlyFocusedInput","blur","Date","now","onPageChangeConfirm","force","Keyboard","dismiss","onPageChangeCancel","setTimeout","focus","useEffect"],"sourceRoot":"../../../src","sources":["utils/useKeyboardManager.tsx"],"mappings":";;;;;;AAAA;AACA;AAAkE;AAAA;AAInD,SAASA,kBAAkB,CAACC,SAAwB,EAAE;EACnE;EACA;EACA,MAAMC,6BAA6B,GAAGC,KAAK,CAACC,MAAM,CAAWC,SAAS,CAAC;EACvE,MAAMC,iBAAiB,GAAGH,KAA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kB,GAAGrB,KAAK,CAACM,WAAW,CAAC,MAAM;IACjD,IAAI,CAACR,SAAS,EAAE,EAAE;MAChB;IACF;IAEAO,oBAAoB,EAAE;;IAEtB;IACA,MAAMK,KAAK,GAAGX,6BAA6B,CAACQ,OAAO;IAEnD,IAAIG,KAAK,EAAE;MACT;;MAEA;MACA;MACA;MACA;MACA;MACA,IAAIK,IAAI,CAACC,GAAG,EAAE,GAAGb,iBAAiB,CAACI,OAAO,GAAG,GAAG,EAAE;QAChDH,kBAAkB,CAACG,OAAO,GAAGe,UAAU,CAAC,MAAM;UAC5CZ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEa,KAAK,EAAE;UACdxB,6BAA6B,CAACQ,OAAO,GAAGL,SAAS;QACnD,CAAC,EAAE,GAAG,CAAC;MACT,CAAC,MAAM;QACLQ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEa,KAAK,EAAE;QACdxB,6BAA6B,CAACQ,OAAO,GAAGL,SAAS;MACnD;IACF;EACF,CAAC,EAAE,CAACG,oBAAoB,EAAEP,SAAS,CAAC,CAAC;EAErCE,KAAK,CAACwB,SAAS,CAAC,MAAM;IACpB,OAAO,MAAMnB,oBAAoB,EAAE;EACrC,CAAC,EAAE,CAACA,oBAAoB,CAAC,CAAC;EAE1B,OAAO;IACLI,iBAAiB;IACjBQ,mBAAmB;IACnBI;EACF,CAAC;AACH"}

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _GestureHandlerNative = require("./GestureHandlerNative");
Object.keys(_GestureHandlerNative).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _GestureHandlerNative[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _GestureHandlerNative[key];
}
});
});
//# sourceMappingURL=GestureHandler.android.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["views/GestureHandler.android.tsx"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _GestureHandlerNative = require("./GestureHandlerNative");
Object.keys(_GestureHandlerNative).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _GestureHandlerNative[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _GestureHandlerNative[key];
}
});
});
//# sourceMappingURL=GestureHandler.ios.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["views/GestureHandler.ios.tsx"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}

View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PanGestureHandler = exports.GestureState = exports.GestureHandlerRootView = void 0;
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const Dummy = _ref => {
let {
children
} = _ref;
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
};
const PanGestureHandler = Dummy;
exports.PanGestureHandler = PanGestureHandler;
const GestureHandlerRootView = _reactNative.View;
exports.GestureHandlerRootView = GestureHandlerRootView;
const GestureState = {
UNDETERMINED: 0,
FAILED: 1,
BEGAN: 2,
CANCELLED: 3,
ACTIVE: 4,
END: 5
};
exports.GestureState = GestureState;
//# sourceMappingURL=GestureHandler.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["Dummy","children","PanGestureHandler","GestureHandlerRootView","View","GestureState","UNDETERMINED","FAILED","BEGAN","CANCELLED","ACTIVE","END"],"sourceRoot":"../../../src","sources":["views/GestureHandler.tsx"],"mappings":";;;;;;AAAA;AACA;AAAoC;AAAA;AAGpC,MAAMA,KAAU,GAAG;EAAA,IAAC;IAAEC;EAAwC,CAAC;EAAA,oBAC7D,0CAAGA,QAAQ,CAAI;AAAA,CAChB;AAEM,MAAMC,iBAAiB,GAC5BF,KAAyD;AAAC;AAErD,MAAMG,sBAAsB,GAAGC,iBAAI;AAAC;AAEpC,MAAMC,YAAY,GAAG;EAC1BC,YAAY,EAAE,CAAC;EACfC,MAAM,EAAE,CAAC;EACTC,KAAK,EAAE,CAAC;EACRC,SAAS,EAAE,CAAC;EACZC,MAAM,EAAE,CAAC;EACTC,GAAG,EAAE;AACP,CAAC;AAAC"}

View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "GestureHandlerRootView", {
enumerable: true,
get: function () {
return _reactNativeGestureHandler.GestureHandlerRootView;
}
});
Object.defineProperty(exports, "GestureState", {
enumerable: true,
get: function () {
return _reactNativeGestureHandler.State;
}
});
exports.PanGestureHandler = PanGestureHandler;
var React = _interopRequireWildcard(require("react"));
var _reactNativeGestureHandler = require("react-native-gesture-handler");
var _GestureHandlerRefContext = _interopRequireDefault(require("../utils/GestureHandlerRefContext"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function PanGestureHandler(props) {
const gestureRef = React.useRef(null);
return /*#__PURE__*/React.createElement(_GestureHandlerRefContext.default.Provider, {
value: gestureRef
}, /*#__PURE__*/React.createElement(_reactNativeGestureHandler.PanGestureHandler, _extends({}, props, {
ref: gestureRef
})));
}
//# sourceMappingURL=GestureHandlerNative.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["PanGestureHandler","props","gestureRef","React","useRef"],"sourceRoot":"../../../src","sources":["views/GestureHandlerNative.tsx"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AACA;AAKA;AAAyE;AAAA;AAAA;AAAA;AAElE,SAASA,iBAAiB,CAACC,KAAkC,EAAE;EACpE,MAAMC,UAAU,GAAGC,KAAK,CAACC,MAAM,CAA0B,IAAI,CAAC;EAE9D,oBACE,oBAAC,iCAAwB,CAAC,QAAQ;IAAC,KAAK,EAAEF;EAAW,gBACnD,oBAAC,4CAAuB,eAAKD,KAAK;IAAE,GAAG,EAAEC;EAAW,GAAG,CACrB;AAExC"}

View File

@@ -0,0 +1,63 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _elements = require("@react-navigation/elements");
var _native = require("@react-navigation/native");
var React = _interopRequireWildcard(require("react"));
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
var _debounce = _interopRequireDefault(require("../../utils/debounce"));
var _ModalPresentationContext = _interopRequireDefault(require("../../utils/ModalPresentationContext"));
var _HeaderSegment = _interopRequireDefault(require("./HeaderSegment"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var _default = /*#__PURE__*/React.memo(function Header(_ref) {
let {
back,
layout,
progress,
options,
route,
navigation,
styleInterpolator
} = _ref;
const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
let previousTitle;
// The label for the left back button shows the title of the previous screen
// If a custom label is specified, we use it, otherwise use previous screen's title
if (options.headerBackTitle !== undefined) {
previousTitle = options.headerBackTitle;
} else if (back) {
previousTitle = back.title;
}
// eslint-disable-next-line react-hooks/exhaustive-deps
const goBack = React.useCallback((0, _debounce.default)(() => {
if (navigation.isFocused() && navigation.canGoBack()) {
navigation.dispatch({
..._native.StackActions.pop(),
source: route.key
});
}
}, 50), [navigation, route.key]);
const isModal = React.useContext(_ModalPresentationContext.default);
const isParentHeaderShown = React.useContext(_elements.HeaderShownContext);
const statusBarHeight = options.headerStatusBarHeight !== undefined ? options.headerStatusBarHeight : isModal || isParentHeaderShown ? 0 : insets.top;
return /*#__PURE__*/React.createElement(_HeaderSegment.default, _extends({}, options, {
title: (0, _elements.getHeaderTitle)(options, route.name),
progress: progress,
layout: layout,
modal: isModal,
headerBackTitle: options.headerBackTitle !== undefined ? options.headerBackTitle : previousTitle,
headerStatusBarHeight: statusBarHeight,
onGoBack: back ? goBack : undefined,
styleInterpolator: styleInterpolator
}));
});
exports.default = _default;
//# sourceMappingURL=Header.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","memo","Header","back","layout","progress","options","route","navigation","styleInterpolator","insets","useSafeAreaInsets","previousTitle","headerBackTitle","undefined","title","goBack","useCallback","debounce","isFocused","canGoBack","dispatch","StackActions","pop","source","key","isModal","useContext","ModalPresentationContext","isParentHeaderShown","HeaderShownContext","statusBarHeight","headerStatusBarHeight","top","getHeaderTitle","name"],"sourceRoot":"../../../../src","sources":["views/Header/Header.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAGA;AACA;AACA;AAA4C;AAAA;AAAA;AAA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,EAAE9B,QAAS;IACnB,MAAM,EAAED,MAAO;IACf,KAAK,EAAEsB,OAAQ;IACf,eAAe,EACbpB,OAAO,CAACO,eAAe,KAAKC,SAAS,GACjCR,OAAO,CAACO,eAAe,GACvBD,aACL;IACD,qBAAqB,EAAEmB,eAAgB;IACvC,QAAQ,EAAE5B,IAAI,GAAGa,MAAM,GAAGF,SAAU;IACpC,iBAAiB,EAAEL;EAAkB,GACrC;AAEN,CAAC,CAAC;AAAA"}

View File

@@ -0,0 +1,128 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = HeaderContainer;
var _elements = require("@react-navigation/elements");
var _native = require("@react-navigation/native");
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _HeaderStyleInterpolators = require("../../TransitionConfigs/HeaderStyleInterpolators");
var _Header = _interopRequireDefault(require("./Header"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function HeaderContainer(_ref) {
let {
mode,
scenes,
layout,
getPreviousScene,
getFocusedRoute,
onContentHeightChange,
style
} = _ref;
const focusedRoute = getFocusedRoute();
const parentHeaderBack = React.useContext(_elements.HeaderBackContext);
return /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
pointerEvents: "box-none",
style: style
}, scenes.slice(-3).map((scene, i, self) => {
var _self, _self2;
if (mode === 'screen' && i !== self.length - 1 || !scene) {
return null;
}
const {
header,
headerMode,
headerShown = true,
headerTransparent,
headerStyleInterpolator
} = scene.descriptor.options;
if (headerMode !== mode || !headerShown) {
return null;
}
const isFocused = focusedRoute.key === scene.descriptor.route.key;
const previousScene = getPreviousScene({
route: scene.descriptor.route
});
let headerBack = parentHeaderBack;
if (previousScene) {
const {
options,
route
} = previousScene.descriptor;
headerBack = previousScene ? {
title: (0, _elements.getHeaderTitle)(options, route.name)
} : parentHeaderBack;
}
// If the screen is next to a headerless screen, we need to make the header appear static
// This makes the header look like it's moving with the screen
const previousDescriptor = (_self = self[i - 1]) === null || _self === void 0 ? void 0 : _self.descriptor;
const nextDescriptor = (_self2 = self[i + 1]) === null || _self2 === void 0 ? void 0 : _self2.descriptor;
const {
headerShown: previousHeaderShown = true,
headerMode: previousHeaderMode
} = (previousDescriptor === null || previousDescriptor === void 0 ? void 0 : previousDescriptor.options) || {};
// If any of the next screens don't have a header or header is part of the screen
// Then we need to move this header offscreen so that it doesn't cover it
const nextHeaderlessScene = self.slice(i + 1).find(scene => {
const {
headerShown: currentHeaderShown = true,
headerMode: currentHeaderMode
} = (scene === null || scene === void 0 ? void 0 : scene.descriptor.options) || {};
return currentHeaderShown === false || currentHeaderMode === 'screen';
});
const {
gestureDirection: nextHeaderlessGestureDirection
} = (nextHeaderlessScene === null || nextHeaderlessScene === void 0 ? void 0 : nextHeaderlessScene.descriptor.options) || {};
const isHeaderStatic = (previousHeaderShown === false || previousHeaderMode === 'screen') &&
// We still need to animate when coming back from next scene
// A hacky way to check this is if the next scene exists
!nextDescriptor || nextHeaderlessScene;
const props = {
layout,
back: headerBack,
progress: scene.progress,
options: scene.descriptor.options,
route: scene.descriptor.route,
navigation: scene.descriptor.navigation,
styleInterpolator: mode === 'float' ? isHeaderStatic ? nextHeaderlessGestureDirection === 'vertical' || nextHeaderlessGestureDirection === 'vertical-inverted' ? _HeaderStyleInterpolators.forSlideUp : nextHeaderlessGestureDirection === 'horizontal-inverted' ? _HeaderStyleInterpolators.forSlideRight : _HeaderStyleInterpolators.forSlideLeft : headerStyleInterpolator : _HeaderStyleInterpolators.forNoAnimation
};
return /*#__PURE__*/React.createElement(_native.NavigationContext.Provider, {
key: scene.descriptor.route.key,
value: scene.descriptor.navigation
}, /*#__PURE__*/React.createElement(_native.NavigationRouteContext.Provider, {
value: scene.descriptor.route
}, /*#__PURE__*/React.createElement(_reactNative.View, {
onLayout: onContentHeightChange ? e => {
const {
height
} = e.nativeEvent.layout;
onContentHeightChange({
route: scene.descriptor.route,
height
});
} : undefined,
pointerEvents: isFocused ? 'box-none' : 'none',
accessibilityElementsHidden: !isFocused,
importantForAccessibility: isFocused ? 'auto' : 'no-hide-descendants',
style:
// Avoid positioning the focused header absolutely
// Otherwise accessibility tools don't seem to be able to find it
mode === 'float' && !isFocused || headerTransparent ? styles.header : null
}, header !== undefined ? header(props) : /*#__PURE__*/React.createElement(_Header.default, props))));
}));
}
const styles = _reactNative.StyleSheet.create({
header: {
position: 'absolute',
top: 0,
left: 0,
right: 0
}
});
//# sourceMappingURL=HeaderContainer.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["HeaderContainer","mode","scenes","layout","getPreviousScene","getFocusedRoute","onContentHeightChange","style","focusedRoute","parentHeaderBack","React","useContext","HeaderBackContext","slice","map","scene","i","self","length","header","headerMode","headerShown","headerTransparent","headerStyleInterpolator","descriptor","options","isFocused","key","route","previousScene","headerBack","title","getHeaderTitle","name","previousDescriptor","nextDescriptor","previousHeaderShown","previousHeaderMode","nextHeaderlessScene","find","currentHeaderShown","currentHeaderMode","gestureDirection","nextHeaderlessGestureDirection","isHeaderStatic","props","back","progress","navigation","styleInterpolator","forSlideUp","forSlideRight","forSlideLeft","forNoAnimation","e","height","nativeEvent","undefined","styles","StyleSheet","create","position","top","left","right"],"sourceRoot":"../../../../src","sources":["views/Header/HeaderContainer.tsx"],"mappings":";;;;;;AAAA;AACA;AAMA;AACA;AAEA;AAaA;AAA8B;AAAA;AAAA;AAef,SAASA,eAAe,OAQ7B;EAAA,IAR8B;IACtCC,IAAI;IACJC,MAAM;IACNC,MAAM;IACNC,gBAAgB;IAChBC,eAAe;IACfC,qBAAqB;IACrBC;EACK,CAAC;EACN,MAAMC,YAAY,GAAGH,eAAe,EAAE;EACtC,MAAMI,gBAAgB,GAAGC,KAAK,CAACC,UAAU,CAACC,2BAAiB,CAAC;EAE5D,oBACE,oBAAC,qBAAQ,CAAC,IAAI;IAAC,aAAa,EAAC,UAAU;IAAC,KAAK,EAAEL;EAAM,GAClDL,MAAM,CAACW,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,CAACC,KAAK,EAAEC,CAAC,EAAEC,IAAI,KAAK;IAAA;IACxC,IAAKhB,IAAI,KAAK,QAAQ,IAAIe,CAAC,KAAKC,IAAI,CAACC,MAAM,GAAG,CAAC,IAAK,CAACH,KAAK,EAAE;MAC1D,OAAO,IAAI;IACb;IAEA,MAAM;MACJI,MAAM;MACNC,UAAU;MACVC,WAAW,GAAG,IAAI;MAClBC,iBAAiB;MACjBC;IACF,CAAC,GAAGR,KAAK,CAACS,UAAU,CAACC,OAAO;IAE5B,IAAIL,UAAU,KAAKnB,IAAI,IAAI,CAACoB,WAAW,EAAE;MACvC,OAAO,IAAI;IACb;IAEA,MAAMK,SAAS,GAAGlB,YAAY,CAACmB,GAAG,KAAKZ,KAAK,CAACS,UAAU,CAACI,KAAK,CAACD,GAAG;IACjE,MAAME,aAAa,GAAGzB,gBAAgB,CAAC;MACrCwB,KAAK,EAAEb,KAAK,CAACS,UAAU,CAACI;IAC1B,CAAC,CAAC;IAEF,IAAIE,UAAU,GAAGrB,gBA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,iBAAiB,GACjDoC,MAAM,CAACvC,MAAM,GACb;IACL,GAEAA,MAAM,KAAKsC,SAAS,GAAGtC,MAAM,CAAC0B,KAAK,CAAC,gBAAG,oBAAC,eAAM,EAAKA,KAAK,CAAI,CACxD,CACyB,CACP;EAEjC,CAAC,CAAC,CACY;AAEpB;AAEA,MAAMa,MAAM,GAAGC,uBAAU,CAACC,MAAM,CAAC;EAC/BzC,MAAM,EAAE;IACN0C,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE;EACT;AACF,CAAC,CAAC"}

View File

@@ -0,0 +1,139 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = HeaderSegment;
var _elements = require("@react-navigation/elements");
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _memoize = _interopRequireDefault(require("../../utils/memoize"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function HeaderSegment(props) {
const [leftLabelLayout, setLeftLabelLayout] = React.useState(undefined);
const [titleLayout, setTitleLayout] = React.useState(undefined);
const handleTitleLayout = e => {
const {
height,
width
} = e.nativeEvent.layout;
setTitleLayout(titleLayout => {
if (titleLayout && height === titleLayout.height && width === titleLayout.width) {
return titleLayout;
}
return {
height,
width
};
});
};
const handleLeftLabelLayout = e => {
const {
height,
width
} = e.nativeEvent.layout;
if (leftLabelLayout && height === leftLabelLayout.height && width === leftLabelLayout.width) {
return;
}
setLeftLabelLayout({
height,
width
});
};
const getInterpolatedStyle = (0, _memoize.default)((styleInterpolator, layout, current, next, titleLayout, leftLabelLayout, headerHeight) => styleInterpolator({
current: {
progress: current
},
next: next && {
progress: next
},
layouts: {
header: {
height: headerHeight,
width: layout.width
},
screen: layout,
title: titleLayout,
leftLabel: leftLabelLayout
}
}));
const {
progress,
layout,
modal,
onGoBack,
headerTitle: title,
headerLeft: left = onGoBack ? props => /*#__PURE__*/React.createElement(_elements.HeaderBackButton, props) : undefined,
headerRight: right,
headerBackImage,
headerBackTitle,
headerBackTitleVisible = _reactNative.Platform.OS === 'ios',
headerTruncatedBackTitle,
headerBackAccessibilityLabel,
headerBackTestID,
headerBackAllowFontScaling,
headerBackTitleStyle,
headerTitleContainerStyle,
headerLeftContainerStyle,
headerRightContainerStyle,
headerBackgroundContainerStyle,
headerStyle: customHeaderStyle,
headerStatusBarHeight,
styleInterpolator,
...rest
} = props;
const defaultHeight = (0, _elements.getDefaultHeaderHeight)(layout, modal, headerStatusBarHeight);
const {
height = defaultHeight
} = _reactNative.StyleSheet.flatten(customHeaderStyle || {});
const {
titleStyle,
leftButtonStyle,
leftLabelStyle,
rightButtonStyle,
backgroundStyle
} = getInterpolatedStyle(styleInterpolator, layout, progress.current, progress.next, titleLayout, headerBackTitle ? leftLabelLayout : undefined, typeof height === 'number' ? height : defaultHeight);
const headerLeft = left ? props => left({
...props,
backImage: headerBackImage,
accessibilityLabel: headerBackAccessibilityLabel,
testID: headerBackTestID,
allowFontScaling: headerBackAllowFontScaling,
onPress: onGoBack,
label: headerBackTitle,
truncatedLabel: headerTruncatedBackTitle,
labelStyle: [leftLabelStyle, headerBackTitleStyle],
onLabelLayout: handleLeftLabelLayout,
screenLayout: layout,
titleLayout,
canGoBack: Boolean(onGoBack)
}) : undefined;
const headerRight = right ? props => right({
...props,
canGoBack: Boolean(onGoBack)
}) : undefined;
const headerTitle = typeof title !== 'function' ? props => /*#__PURE__*/React.createElement(_elements.HeaderTitle, _extends({}, props, {
onLayout: handleTitleLayout
})) : props => title({
...props,
onLayout: handleTitleLayout
});
return /*#__PURE__*/React.createElement(_elements.Header, _extends({
modal: modal,
layout: layout,
headerTitle: headerTitle,
headerLeft: headerLeft,
headerLeftLabelVisible: headerBackTitleVisible,
headerRight: headerRight,
headerTitleContainerStyle: [titleStyle, headerTitleContainerStyle],
headerLeftContainerStyle: [leftButtonStyle, headerLeftContainerStyle],
headerRightContainerStyle: [rightButtonStyle, headerRightContainerStyle],
headerBackgroundContainerStyle: [backgroundStyle, headerBackgroundContainerStyle],
headerStyle: customHeaderStyle,
headerStatusBarHeight: headerStatusBarHeight
}, rest));
}
//# sourceMappingURL=HeaderSegment.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["HeaderSegment","props","leftLabelLayout","setLeftLabelLayout","React","useState","undefined","titleLayout","setTitleLayout","handleTitleLayout","e","height","width","nativeEvent","layout","handleLeftLabelLayout","getInterpolatedStyle","memoize","styleInterpolator","current","next","headerHeight","progress","layouts","header","screen","title","leftLabel","modal","onGoBack","headerTitle","headerLeft","left","headerRight","right","headerBackImage","headerBackTitle","headerBackTitleVisible","Platform","OS","headerTruncatedBackTitle","headerBackAccessibilityLabel","headerBackTestID","headerBackAllowFontScaling","headerBackTitleStyle","headerTitleContainerStyle","headerLeftContainerStyle","headerRightContainerStyle","headerBackgroundContainerStyle","headerStyle","customHeaderStyle","headerStatusBarHeight","rest","defaultHeight","getDefaultHeaderHeight","StyleSheet","flatten","titleStyle","leftButtonStyle","leftLabelStyle","rightButtonStyle","backgroundStyle","backImage","accessibilityLabel","testID","allowFontScaling","onPress","label","truncatedLabel","labelStyle","onLabelLayout","screenLayout","canGoBack","Boolean","onLayout"],"sourceRoot":"../../../../src","sources":["views/Header/HeaderSegment.tsx"],"mappings":";;;;;;AAAA;AAOA;AACA;AAcA;AAA0C;AAAA;AAAA;AAAA;AAY3B,SAASA,aAAa,CAACC,KAAY,EAAE;EAClD,MAAM,CAACC,eAAe,EAAEC,kBAAkB,CAAC,GAAGC,KAAK,CAACC,QAAQ,CAE1DC,SAAS,CAAC;EAEZ,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGJ,KAAK,CAACC,QAAQ,CAClDC,SAAS,CACV;EAED,MAAMG,iBAAiB,GAAIC,CAAoB,IAAK;IAClD,MAAM;MAAEC,MAAM;MAAEC;IAAM,CAAC,GAAGF,CAAC,CAACG,WAAW,CAACC,MAAM;IAE9CN,cAAc,CAAED,WAAW,IAAK;MAC9B,IACEA,WAAW,IACXI,MAAM,KAAKJ,WAAW,CAACI,MAAM,IAC7BC,KAAK,KAAKL,WAAW,CAACK,KAAK,EAC3B;QACA,OAAOL,WAAW;MACpB;MAEA,OAAO;QAAEI,MAAM;QAAEC;MAAM,CAAC;IAC1B,CAAC,CAAC;EACJ,CAAC;EAED,MAAMG,qBAAqB,GAAIL,CAAoB,IAAK;IACtD,MAAM;MAAEC,MAAM;MAAEC;IAAM,CAAC,GAAGF,CAAC,CAACG,WAAW,CAACC,MAAM;IAE9C,IACEZ,eAAe,IACfS,MAAM,KAAKT,eAAe,CAACS,MAAM,IACjCC,KAAK,KAAKV,eAAe,CAACU,KAAK,EAC/B;MACA;IACF;IAEAT,kBAAkB,CAAC;MAAEQ,MAA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AEyE,QAAQ,EAAEjE;EAAkB,CAAC,CAAC;EAEjE,oBACE,oBAAC,gBAAM;IACL,KAAK,EAAEmB,KAAM;IACb,MAAM,EAAEd,MAAO;IACf,WAAW,EAAEgB,WAAY;IACzB,UAAU,EAAEC,UAAW;IACvB,sBAAsB,EAAEM,sBAAuB;IAC/C,WAAW,EAAEJ,WAAY;IACzB,yBAAyB,EAAE,CAACwB,UAAU,EAAEZ,yBAAyB,CAAE;IACnE,wBAAwB,EAAE,CAACa,eAAe,EAAEZ,wBAAwB,CAAE;IACtE,yBAAyB,EAAE,CAACc,gBAAgB,EAAEb,yBAAyB,CAAE;IACzE,8BAA8B,EAAE,CAC9Bc,eAAe,EACfb,8BAA8B,CAC9B;IACF,WAAW,EAAEE,iBAAkB;IAC/B,qBAAqB,EAAEC;EAAsB,GACzCC,IAAI,EACR;AAEN"}

View File

@@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = ModalStatusBarManager;
var _native = require("@react-navigation/native");
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function ModalStatusBarManager(_ref) {
var _flattenedStyle$trans, _flattenedStyle$trans2;
let {
dark,
layout,
insets,
style
} = _ref;
const {
dark: darkTheme
} = (0, _native.useTheme)();
const [overlapping, setOverlapping] = React.useState(true);
const scale = 1 - 20 / layout.width;
const offset = (insets.top - 34) * scale;
const flattenedStyle = _reactNative.StyleSheet.flatten(style);
const translateY = flattenedStyle === null || flattenedStyle === void 0 ? void 0 : (_flattenedStyle$trans = flattenedStyle.transform) === null || _flattenedStyle$trans === void 0 ? void 0 : (_flattenedStyle$trans2 = _flattenedStyle$trans.find(s => s.translateY !== undefined)) === null || _flattenedStyle$trans2 === void 0 ? void 0 : _flattenedStyle$trans2.translateY;
React.useEffect(() => {
const listener = _ref2 => {
let {
value
} = _ref2;
setOverlapping(value < offset);
};
const sub = translateY === null || translateY === void 0 ? void 0 : translateY.addListener(listener);
return () => translateY === null || translateY === void 0 ? void 0 : translateY.removeListener(sub);
}, [offset, translateY]);
const darkContent = dark ?? !darkTheme;
return /*#__PURE__*/React.createElement(_reactNative.StatusBar, {
animated: true,
barStyle: overlapping && darkContent ? 'dark-content' : 'light-content'
});
}
//# sourceMappingURL=ModalStatusBarManager.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["ModalStatusBarManager","dark","layout","insets","style","darkTheme","useTheme","overlapping","setOverlapping","React","useState","scale","width","offset","top","flattenedStyle","StyleSheet","flatten","translateY","transform","find","s","undefined","useEffect","listener","value","sub","addListener","removeListener","darkContent"],"sourceRoot":"../../../src","sources":["views/ModalStatusBarManager.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AAAqD;AAAA;AAYtC,SAASA,qBAAqB,OAKnC;EAAA;EAAA,IALoC;IAC5CC,IAAI;IACJC,MAAM;IACNC,MAAM;IACNC;EACK,CAAC;EACN,MAAM;IAAEH,IAAI,EAAEI;EAAU,CAAC,GAAG,IAAAC,gBAAQ,GAAE;EACtC,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,KAAK,CAACC,QAAQ,CAAC,IAAI,CAAC;EAE1D,MAAMC,KAAK,GAAG,CAAC,GAAG,EAAE,GAAGT,MAAM,CAACU,KAAK;EACnC,MAAMC,MAAM,GAAG,CAACV,MAAM,CAACW,GAAG,GAAG,EAAE,IAAIH,KAAK;EAExC,MAAMI,cAAc,GAAGC,uBAAU,CAACC,OAAO,CAACb,KAAK,CAAC;EAChD,MAAMc,UAAU,GAAGH,cAAc,aAAdA,cAAc,gDAAdA,cAAc,CAAEI,SAAS,oFAAzB,sBAA2BC,IAAI,CAC/CC,CAAM,IAAKA,CAAC,CAACH,UAAU,KAAKI,SAAS,CACvC,2DAFkB,uBAEhBJ,UAAU;EAEbT,KAAK,CAACc,SAAS,CAAC,MAAM;IACpB,MAAMC,QAAQ,GAAG,SAAkC;MAAA,IAAjC;QAAEC;MAAyB,CAAC;MAC5CjB,cAAc,CAACiB,KAAK,GAAGZ,MAAM,CAAC;IAChC,CAAC;IAED,MAAMa,GAAG,GAAGR,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAES,WAAW,CAACH,QAAQ,CAAC;IAE7C,OAAO,MAAMN,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEU,cAAc,CAACF,GAAG,CAAC;EAC9C,CAAC,EAAE,CAACb,MAAM,EAAEK,UAAU,CAAC,CAAC;EAExB,MAAMW,WAAW,GAAG5B,IAAI,IAAI,CAACI,SAAS;EAEtC,oBACE,oBAAC,sBAAS;IACR,QAAQ;IACR,QAAQ,EAAEE,WAAW,IAAIsB,WAAW,GAAG,cAAc,GAAG;EAAgB,EACxE;AAEN"}

View File

@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.MaybeScreenContainer = exports.MaybeScreen = void 0;
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
let Screens;
try {
Screens = require('react-native-screens');
} catch (e) {
// Ignore
}
const MaybeScreenContainer = _ref => {
let {
enabled,
...rest
} = _ref;
if (Screens != null) {
return /*#__PURE__*/React.createElement(Screens.ScreenContainer, _extends({
enabled: enabled
}, rest));
}
return /*#__PURE__*/React.createElement(_reactNative.View, rest);
};
exports.MaybeScreenContainer = MaybeScreenContainer;
const MaybeScreen = _ref2 => {
let {
enabled,
active,
...rest
} = _ref2;
if (Screens != null) {
return /*#__PURE__*/React.createElement(Screens.Screen, _extends({
enabled: enabled,
activityState: active
}, rest));
}
return /*#__PURE__*/React.createElement(_reactNative.View, rest);
};
exports.MaybeScreen = MaybeScreen;
//# sourceMappingURL=Screens.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["Screens","require","e","MaybeScreenContainer","enabled","rest","MaybeScreen","active"],"sourceRoot":"../../../src","sources":["views/Screens.tsx"],"mappings":";;;;;;AAAA;AACA;AAAyD;AAAA;AAAA;AAEzD,IAAIA,OAA0D;AAE9D,IAAI;EACFA,OAAO,GAAGC,OAAO,CAAC,sBAAsB,CAAC;AAC3C,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV;AAAA;AAGK,MAAMC,oBAAoB,GAAG,QAM9B;EAAA,IAN+B;IACnCC,OAAO;IACP,GAAGC;EAIL,CAAC;EACC,IAAIL,OAAO,IAAI,IAAI,EAAE;IACnB,oBAAO,oBAAC,OAAO,CAAC,eAAe;MAAC,OAAO,EAAEI;IAAQ,GAAKC,IAAI,EAAI;EAChE;EAEA,oBAAO,oBAAC,iBAAI,EAAKA,IAAI,CAAI;AAC3B,CAAC;AAAC;AAEK,MAAMC,WAAW,GAAG,SASrB;EAAA,IATsB;IAC1BF,OAAO;IACPG,MAAM;IACN,GAAGF;EAML,CAAC;EACC,IAAIL,OAAO,IAAI,IAAI,EAAE;IACnB,oBACE,oBAAC,OAAO,CAAC,MAAM;MAAC,OAAO,EAAEI,OAAQ;MAAC,aAAa,EAAEG;IAAO,GAAKF,IAAI,EAAI;EAEzE;EAEA,oBAAO,oBAAC,iBAAI,EAAKA,IAAI,CAAI;AAC3B,CAAC;AAAC"}

View File

@@ -0,0 +1,476 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getIsModalPresentation = exports.default = void 0;
var _color = _interopRequireDefault(require("color"));
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _CardStyleInterpolators = require("../../TransitionConfigs/CardStyleInterpolators");
var _CardAnimationContext = _interopRequireDefault(require("../../utils/CardAnimationContext"));
var _getDistanceForDirection = _interopRequireDefault(require("../../utils/getDistanceForDirection"));
var _getInvertedMultiplier = _interopRequireDefault(require("../../utils/getInvertedMultiplier"));
var _memoize = _interopRequireDefault(require("../../utils/memoize"));
var _GestureHandler = require("../GestureHandler");
var _ModalStatusBarManager = _interopRequireDefault(require("../ModalStatusBarManager"));
var _CardSheet = _interopRequireDefault(require("./CardSheet"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
const GESTURE_VELOCITY_IMPACT = 0.3;
const TRUE = 1;
const FALSE = 0;
/**
* The distance of touch start from the edge of the screen where the gesture will be recognized
*/
const GESTURE_RESPONSE_DISTANCE_HORIZONTAL = 50;
const GESTURE_RESPONSE_DISTANCE_VERTICAL = 135;
const useNativeDriver = _reactNative.Platform.OS !== 'web';
const hasOpacityStyle = style => {
if (style) {
const flattenedStyle = _reactNative.StyleSheet.flatten(style);
return flattenedStyle.opacity != null;
}
return false;
};
class Card extends React.Component {
static defaultProps = {
shadowEnabled: false,
gestureEnabled: true,
gestureVelocityImpact: GESTURE_VELOCITY_IMPACT,
overlay: _ref => {
let {
style
} = _ref;
return style ? /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
pointerEvents: "none",
style: [styles.overlay, style]
}) : null;
}
};
componentDidMount() {
this.animate({
closing: this.props.closing
});
this.isCurrentlyMounted = true;
}
componentDidUpdate(prevProps) {
const {
layout,
gestureDirection,
closing
} = this.props;
const {
width,
height
} = layout;
if (width !== prevProps.layout.width) {
this.layout.width.setValue(width);
}
if (height !== prevProps.layout.height) {
this.layout.height.setValue(height);
}
if (gestureDirection !== prevProps.gestureDirection) {
this.inverted.setValue((0, _getInvertedMultiplier.default)(gestureDirection));
}
const toValue = this.getAnimateToValue(this.props);
if (this.getAnimateToValue(prevProps) !== toValue || this.lastToValue !== toValue) {
// We need to trigger the animation when route was closed
// Thr route might have been closed by a `POP` action or by a gesture
// When route was closed due to a gesture, the animation would've happened already
// It's still important to trigger the animation so that `onClose` is called
// If `onClose` is not called, cleanup step won't be performed for gestures
this.animate({
closing
});
}
}
componentWillUnmount() {
this.props.gesture.stopAnimation();
this.isCurrentlyMounted = false;
this.handleEndInteraction();
}
isCurrentlyMounted = false;
isClosing = new _reactNative.Animated.Value(FALSE);
inverted = new _reactNative.Animated.Value((0, _getInvertedMultiplier.default)(this.props.gestureDirection));
layout = {
width: new _reactNative.Animated.Value(this.props.layout.width),
height: new _reactNative.Animated.Value(this.props.layout.height)
};
isSwiping = new _reactNative.Animated.Value(FALSE);
animate = _ref2 => {
let {
closing,
velocity
} = _ref2;
const {
gesture,
transitionSpec,
onOpen,
onClose,
onTransition
} = this.props;
const toValue = this.getAnimateToValue({
...this.props,
closing
});
this.lastToValue = toValue;
this.isClosing.setValue(closing ? TRUE : FALSE);
const spec = closing ? transitionSpec.close : transitionSpec.open;
const animation = spec.animation === 'spring' ? _reactNative.Animated.spring : _reactNative.Animated.timing;
this.setPointerEventsEnabled(!closing);
this.handleStartInteraction();
clearTimeout(this.pendingGestureCallback);
onTransition === null || onTransition === void 0 ? void 0 : onTransition({
closing,
gesture: velocity !== undefined
});
animation(gesture, {
...spec.config,
velocity,
toValue,
useNativeDriver,
isInteraction: false
}).start(_ref3 => {
let {
finished
} = _ref3;
this.handleEndInteraction();
clearTimeout(this.pendingGestureCallback);
if (finished) {
if (closing) {
onClose();
} else {
onOpen();
}
if (this.isCurrentlyMounted) {
// Make sure to re-open screen if it wasn't removed
this.forceUpdate();
}
}
});
};
getAnimateToValue = _ref4 => {
let {
closing,
layout,
gestureDirection
} = _ref4;
if (!closing) {
return 0;
}
return (0, _getDistanceForDirection.default)(layout, gestureDirection);
};
setPointerEventsEnabled = enabled => {
var _this$ref$current;
const pointerEvents = enabled ? 'box-none' : 'none';
(_this$ref$current = this.ref.current) === null || _this$ref$current === void 0 ? void 0 : _this$ref$current.setPointerEvents(pointerEvents);
};
handleStartInteraction = () => {
if (this.interactionHandle === undefined) {
this.interactionHandle = _reactNative.InteractionManager.createInteractionHandle();
}
};
handleEndInteraction = () => {
if (this.interactionHandle !== undefined) {
_reactNative.InteractionManager.clearInteractionHandle(this.interactionHandle);
this.interactionHandle = undefined;
}
};
handleGestureStateChange = _ref5 => {
let {
nativeEvent
} = _ref5;
const {
layout,
onClose,
onGestureBegin,
onGestureCanceled,
onGestureEnd,
gestureDirection,
gestureVelocityImpact
} = this.props;
switch (nativeEvent.state) {
case _GestureHandler.GestureState.ACTIVE:
this.isSwiping.setValue(TRUE);
this.handleStartInteraction();
onGestureBegin === null || onGestureBegin === void 0 ? void 0 : onGestureBegin();
break;
case _GestureHandler.GestureState.CANCELLED:
{
this.isSwiping.setValue(FALSE);
this.handleEndInteraction();
const velocity = gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? nativeEvent.velocityY : nativeEvent.velocityX;
this.animate({
closing: this.props.closing,
velocity
});
onGestureCanceled === null || onGestureCanceled === void 0 ? void 0 : onGestureCanceled();
break;
}
case _GestureHandler.GestureState.END:
{
this.isSwiping.setValue(FALSE);
let distance;
let translation;
let velocity;
if (gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted') {
distance = layout.height;
translation = nativeEvent.translationY;
velocity = nativeEvent.velocityY;
} else {
distance = layout.width;
translation = nativeEvent.translationX;
velocity = nativeEvent.velocityX;
}
const closing = (translation + velocity * gestureVelocityImpact) * (0, _getInvertedMultiplier.default)(gestureDirection) > distance / 2 ? velocity !== 0 || translation !== 0 : this.props.closing;
this.animate({
closing,
velocity
});
if (closing) {
// We call onClose with a delay to make sure that the animation has already started
// This will make sure that the state update caused by this doesn't affect start of animation
this.pendingGestureCallback = setTimeout(() => {
onClose();
// Trigger an update after we dispatch the action to remove the screen
// This will make sure that we check if the screen didn't get removed so we can cancel the animation
this.forceUpdate();
}, 32);
}
onGestureEnd === null || onGestureEnd === void 0 ? void 0 : onGestureEnd();
break;
}
}
};
// Memoize this to avoid extra work on re-render
getInterpolatedStyle = (0, _memoize.default)((styleInterpolator, animation) => styleInterpolator(animation));
// Keep track of the animation context when deps changes.
getCardAnimation = (0, _memoize.default)((interpolationIndex, current, next, layout, insetTop, insetRight, insetBottom, insetLeft) => ({
index: interpolationIndex,
current: {
progress: current
},
next: next && {
progress: next
},
closing: this.isClosing,
swiping: this.isSwiping,
inverted: this.inverted,
layouts: {
screen: layout
},
insets: {
top: insetTop,
right: insetRight,
bottom: insetBottom,
left: insetLeft
}
}));
gestureActivationCriteria() {
const {
layout,
gestureDirection,
gestureResponseDistance
} = this.props;
const enableTrackpadTwoFingerGesture = true;
const distance = gestureResponseDistance !== undefined ? gestureResponseDistance : gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? GESTURE_RESPONSE_DISTANCE_VERTICAL : GESTURE_RESPONSE_DISTANCE_HORIZONTAL;
if (gestureDirection === 'vertical') {
return {
maxDeltaX: 15,
minOffsetY: 5,
hitSlop: {
bottom: -layout.height + distance
},
enableTrackpadTwoFingerGesture
};
} else if (gestureDirection === 'vertical-inverted') {
return {
maxDeltaX: 15,
minOffsetY: -5,
hitSlop: {
top: -layout.height + distance
},
enableTrackpadTwoFingerGesture
};
} else {
const hitSlop = -layout.width + distance;
const invertedMultiplier = (0, _getInvertedMultiplier.default)(gestureDirection);
if (invertedMultiplier === 1) {
return {
minOffsetX: 5,
maxDeltaY: 20,
hitSlop: {
right: hitSlop
},
enableTrackpadTwoFingerGesture
};
} else {
return {
minOffsetX: -5,
maxDeltaY: 20,
hitSlop: {
left: hitSlop
},
enableTrackpadTwoFingerGesture
};
}
}
}
ref = /*#__PURE__*/React.createRef();
render() {
const {
styleInterpolator,
interpolationIndex,
current,
gesture,
next,
layout,
insets,
overlay,
overlayEnabled,
shadowEnabled,
gestureEnabled,
gestureDirection,
pageOverflowEnabled,
headerDarkContent,
children,
containerStyle: customContainerStyle,
contentStyle,
...rest
} = this.props;
const interpolationProps = this.getCardAnimation(interpolationIndex, current, next, layout, insets.top, insets.right, insets.bottom, insets.left);
const interpolatedStyle = this.getInterpolatedStyle(styleInterpolator, interpolationProps);
const {
containerStyle,
cardStyle,
overlayStyle,
shadowStyle
} = interpolatedStyle;
const handleGestureEvent = gestureEnabled ? _reactNative.Animated.event([{
nativeEvent: gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? {
translationY: gesture
} : {
translationX: gesture
}
}], {
useNativeDriver
}) : undefined;
const {
backgroundColor
} = _reactNative.StyleSheet.flatten(contentStyle || {});
const isTransparent = typeof backgroundColor === 'string' ? (0, _color.default)(backgroundColor).alpha() === 0 : false;
return /*#__PURE__*/React.createElement(_CardAnimationContext.default.Provider, {
value: interpolationProps
},
// StatusBar messes with translucent status bar on Android
// So we should only enable it on iOS
_reactNative.Platform.OS === 'ios' && overlayEnabled && next && getIsModalPresentation(styleInterpolator) ? /*#__PURE__*/React.createElement(_ModalStatusBarManager.default, {
dark: headerDarkContent,
layout: layout,
insets: insets,
style: cardStyle
}) : null, /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
style: {
// This is a dummy style that doesn't actually change anything visually.
// Animated needs the animated value to be used somewhere, otherwise things don't update properly.
// If we disable animations and hide header, it could end up making the value unused.
// So we have this dummy style that will always be used regardless of what else changed.
opacity: current
}
// Make sure that this view isn't removed. If this view is removed, our style with animated value won't apply
,
collapsable: false
}), /*#__PURE__*/React.createElement(_reactNative.View, _extends({
pointerEvents: "box-none"
// Make sure this view is not removed on the new architecture, as it causes focus loss during navigation on Android.
// This can happen when the view flattening results in different trees - due to `overflow` style changing in a parent.
,
collapsable: false
}, rest), overlayEnabled ? /*#__PURE__*/React.createElement(_reactNative.View, {
pointerEvents: "box-none",
style: _reactNative.StyleSheet.absoluteFill
}, overlay({
style: overlayStyle
})) : null, /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
style: [styles.container, containerStyle, customContainerStyle],
pointerEvents: "box-none"
}, /*#__PURE__*/React.createElement(_GestureHandler.PanGestureHandler, _extends({
enabled: layout.width !== 0 && gestureEnabled,
onGestureEvent: handleGestureEvent,
onHandlerStateChange: this.handleGestureStateChange
}, this.gestureActivationCriteria()), /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
needsOffscreenAlphaCompositing: hasOpacityStyle(cardStyle),
style: [styles.container, cardStyle]
}, shadowEnabled && shadowStyle && !isTransparent ? /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
style: [styles.shadow, gestureDirection === 'horizontal' ? [styles.shadowHorizontal, styles.shadowLeft] : gestureDirection === 'horizontal-inverted' ? [styles.shadowHorizontal, styles.shadowRight] : gestureDirection === 'vertical' ? [styles.shadowVertical, styles.shadowTop] : [styles.shadowVertical, styles.shadowBottom], {
backgroundColor
}, shadowStyle],
pointerEvents: "none"
}) : null, /*#__PURE__*/React.createElement(_CardSheet.default, {
ref: this.ref,
enabled: pageOverflowEnabled,
layout: layout,
style: contentStyle
}, children))))));
}
}
exports.default = Card;
const getIsModalPresentation = cardStyleInterpolator => {
return cardStyleInterpolator === _CardStyleInterpolators.forModalPresentationIOS ||
// Handle custom modal presentation interpolators as well
cardStyleInterpolator.name === 'forModalPresentationIOS';
};
exports.getIsModalPresentation = getIsModalPresentation;
const styles = _reactNative.StyleSheet.create({
container: {
flex: 1
},
overlay: {
flex: 1,
backgroundColor: '#000'
},
shadow: {
position: 'absolute',
shadowRadius: 5,
shadowColor: '#000',
shadowOpacity: 0.3
},
shadowHorizontal: {
top: 0,
bottom: 0,
width: 3,
shadowOffset: {
width: -1,
height: 1
}
},
shadowLeft: {
left: 0
},
shadowRight: {
right: 0
},
shadowVertical: {
left: 0,
right: 0,
height: 3,
shadowOffset: {
width: 1,
height: -1
}
},
shadowTop: {
top: 0
},
shadowBottom: {
bottom: 0
}
});
//# sourceMappingURL=Card.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,263 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _elements = require("@react-navigation/elements");
var _native = require("@react-navigation/native");
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _ModalPresentationContext = _interopRequireDefault(require("../../utils/ModalPresentationContext"));
var _useKeyboardManager = _interopRequireDefault(require("../../utils/useKeyboardManager"));
var _Card = _interopRequireDefault(require("./Card"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const EPSILON = 0.1;
function CardContainer(_ref) {
let {
interpolationIndex,
index,
active,
closing,
gesture,
focused,
modal,
getPreviousScene,
getFocusedRoute,
headerDarkContent,
hasAbsoluteFloatHeader,
headerHeight,
onHeaderHeightChange,
isParentHeaderShown,
isNextScreenTransparent,
detachCurrentScreen,
layout,
onCloseRoute,
onOpenRoute,
onGestureCancel,
onGestureEnd,
onGestureStart,
onTransitionEnd,
onTransitionStart,
renderHeader,
renderScene,
safeAreaInsetBottom,
safeAreaInsetLeft,
safeAreaInsetRight,
safeAreaInsetTop,
scene
} = _ref;
const parentHeaderHeight = React.useContext(_elements.HeaderHeightContext);
const {
onPageChangeStart,
onPageChangeCancel,
onPageChangeConfirm
} = (0, _useKeyboardManager.default)(React.useCallback(() => {
const {
options,
navigation
} = scene.descriptor;
return navigation.isFocused() && options.keyboardHandlingEnabled !== false;
}, [scene.descriptor]));
const handleOpen = () => {
const {
route
} = scene.descriptor;
onTransitionEnd({
route
}, false);
onOpenRoute({
route
});
};
const handleClose = () => {
const {
route
} = scene.descriptor;
onTransitionEnd({
route
}, true);
onCloseRoute({
route
});
};
const handleGestureBegin = () => {
const {
route
} = scene.descriptor;
onPageChangeStart();
onGestureStart({
route
});
};
const handleGestureCanceled = () => {
const {
route
} = scene.descriptor;
onPageChangeCancel();
onGestureCancel({
route
});
};
const handleGestureEnd = () => {
const {
route
} = scene.descriptor;
onGestureEnd({
route
});
};
const handleTransition = _ref2 => {
let {
closing,
gesture
} = _ref2;
const {
route
} = scene.descriptor;
if (!gesture) {
onPageChangeConfirm === null || onPageChangeConfirm === void 0 ? void 0 : onPageChangeConfirm(true);
} else if (active && closing) {
onPageChangeConfirm === null || onPageChangeConfirm === void 0 ? void 0 : onPageChangeConfirm(false);
} else {
onPageChangeCancel === null || onPageChangeCancel === void 0 ? void 0 : onPageChangeCancel();
}
onTransitionStart === null || onTransitionStart === void 0 ? void 0 : onTransitionStart({
route
}, closing);
};
const insets = {
top: safeAreaInsetTop,
right: safeAreaInsetRight,
bottom: safeAreaInsetBottom,
left: safeAreaInsetLeft
};
const {
colors
} = (0, _native.useTheme)();
const [pointerEvents, setPointerEvents] = React.useState('box-none');
React.useEffect(() => {
var _scene$progress$next, _scene$progress$next$;
const listener = (_scene$progress$next = scene.progress.next) === null || _scene$progress$next === void 0 ? void 0 : (_scene$progress$next$ = _scene$progress$next.addListener) === null || _scene$progress$next$ === void 0 ? void 0 : _scene$progress$next$.call(_scene$progress$next, _ref3 => {
let {
value
} = _ref3;
setPointerEvents(value <= EPSILON ? 'box-none' : 'none');
});
return () => {
if (listener) {
var _scene$progress$next2, _scene$progress$next3;
(_scene$progress$next2 = scene.progress.next) === null || _scene$progress$next2 === void 0 ? void 0 : (_scene$progress$next3 = _scene$progress$next2.removeListener) === null || _scene$progress$next3 === void 0 ? void 0 : _scene$progress$next3.call(_scene$progress$next2, listener);
}
};
}, [pointerEvents, scene.progress.next]);
const {
presentation,
animationEnabled,
cardOverlay,
cardOverlayEnabled,
cardShadowEnabled,
cardStyle,
cardStyleInterpolator,
gestureDirection,
gestureEnabled,
gestureResponseDistance,
gestureVelocityImpact,
headerMode,
headerShown,
transitionSpec
} = scene.descriptor.options;
const previousScene = getPreviousScene({
route: scene.descriptor.route
});
let backTitle;
if (previousScene) {
const {
options,
route
} = previousScene.descriptor;
backTitle = (0, _elements.getHeaderTitle)(options, route.name);
}
const headerBack = React.useMemo(() => backTitle !== undefined ? {
title: backTitle
} : undefined, [backTitle]);
return /*#__PURE__*/React.createElement(_Card.default, {
interpolationIndex: interpolationIndex,
gestureDirection: gestureDirection,
layout: layout,
insets: insets,
gesture: gesture,
current: scene.progress.current,
next: scene.progress.next,
closing: closing,
onOpen: handleOpen,
onClose: handleClose,
overlay: cardOverlay,
overlayEnabled: cardOverlayEnabled,
shadowEnabled: cardShadowEnabled,
onTransition: handleTransition,
onGestureBegin: handleGestureBegin,
onGestureCanceled: handleGestureCanceled,
onGestureEnd: handleGestureEnd,
gestureEnabled: index === 0 ? false : gestureEnabled,
gestureResponseDistance: gestureResponseDistance,
gestureVelocityImpact: gestureVelocityImpact,
transitionSpec: transitionSpec,
styleInterpolator: cardStyleInterpolator,
accessibilityElementsHidden: !focused,
importantForAccessibility: focused ? 'auto' : 'no-hide-descendants',
pointerEvents: active ? 'box-none' : pointerEvents,
pageOverflowEnabled: headerMode !== 'float' && presentation !== 'modal',
headerDarkContent: headerDarkContent,
containerStyle: hasAbsoluteFloatHeader && headerMode !== 'screen' ? {
marginTop: headerHeight
} : null,
contentStyle: [{
backgroundColor: presentation === 'transparentModal' ? 'transparent' : colors.background
}, cardStyle],
style: [{
// This is necessary to avoid unfocused larger pages increasing scroll area
// The issue can be seen on the web when a smaller screen is pushed over a larger one
overflow: active ? undefined : 'hidden',
display:
// Hide unfocused screens when animation isn't enabled
// This is also necessary for a11y on web
animationEnabled === false && isNextScreenTransparent === false && detachCurrentScreen !== false && !focused ? 'none' : 'flex'
}, _reactNative.StyleSheet.absoluteFill]
}, /*#__PURE__*/React.createElement(_reactNative.View, {
style: styles.container
}, /*#__PURE__*/React.createElement(_ModalPresentationContext.default.Provider, {
value: modal
}, /*#__PURE__*/React.createElement(_reactNative.View, {
style: styles.scene
}, /*#__PURE__*/React.createElement(_elements.HeaderBackContext.Provider, {
value: headerBack
}, /*#__PURE__*/React.createElement(_elements.HeaderShownContext.Provider, {
value: isParentHeaderShown || headerShown !== false
}, /*#__PURE__*/React.createElement(_elements.HeaderHeightContext.Provider, {
value: headerShown ? headerHeight : parentHeaderHeight ?? 0
}, renderScene({
route: scene.descriptor.route
}))))), headerMode !== 'float' ? renderHeader({
mode: 'screen',
layout,
scenes: [previousScene, scene],
getPreviousScene,
getFocusedRoute,
onContentHeightChange: onHeaderHeightChange
}) : null)));
}
var _default = /*#__PURE__*/React.memo(CardContainer);
exports.default = _default;
const styles = _reactNative.StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column-reverse'
},
scene: {
flex: 1
}
});
//# sourceMappingURL=CardContainer.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
// This component will render a page which overflows the screen
// if the container fills the body by comparing the size
// This lets the document.body handle scrolling of the content
// It's necessary for mobile browsers to be able to hide address bar on scroll
var _default = /*#__PURE__*/React.forwardRef(function CardSheet(_ref, ref) {
let {
enabled,
layout,
style,
...rest
} = _ref;
const [fill, setFill] = React.useState(false);
// To avoid triggering a rerender in Card during animation we had to move
// the state to CardSheet. The `setPointerEvents` is then hoisted back to the Card.
const [pointerEvents, setPointerEvents] = React.useState('auto');
React.useImperativeHandle(ref, () => {
return {
setPointerEvents
};
});
React.useEffect(() => {
if (typeof document === 'undefined' || !document.body) {
// Only run when DOM is available
return;
}
const width = document.body.clientWidth;
const height = document.body.clientHeight;
setFill(width === layout.width && height === layout.height);
}, [layout.height, layout.width]);
return /*#__PURE__*/React.createElement(_reactNative.View, _extends({}, rest, {
pointerEvents: pointerEvents,
style: [enabled && fill ? styles.page : styles.card, style]
}));
});
exports.default = _default;
const styles = _reactNative.StyleSheet.create({
page: {
minHeight: '100%'
},
card: {
flex: 1,
overflow: 'hidden'
}
});
//# sourceMappingURL=CardSheet.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","forwardRef","CardSheet","ref","enabled","layout","style","rest","fill","setFill","useState","pointerEvents","setPointerEvents","useImperativeHandle","useEffect","document","body","width","clientWidth","height","clientHeight","styles","page","card","StyleSheet","create","minHeight","flex","overflow"],"sourceRoot":"../../../../src","sources":["views/Stack/CardSheet.tsx"],"mappings":";;;;;;AAAA;AACA;AAA2D;AAAA;AAAA;AAY3D;AACA;AACA;AACA;AAAA,4BACeA,KAAK,CAACC,UAAU,CAAsB,SAASC,SAAS,OAErEC,GAAG,EACH;EAAA,IAFA;IAAEC,OAAO;IAAEC,MAAM;IAAEC,KAAK;IAAE,GAAGC;EAAK,CAAC;EAGnC,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGT,KAAK,CAACU,QAAQ,CAAC,KAAK,CAAC;EAC7C;EACA;EACA,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GACrCZ,KAAK,CAACU,QAAQ,CAA6B,MAAM,CAAC;EAEpDV,KAAK,CAACa,mBAAmB,CAACV,GAAG,EAAE,MAAM;IACnC,OAAO;MAAES;IAAiB,CAAC;EAC7B,CAAC,CAAC;EAEFZ,KAAK,CAACc,SAAS,CAAC,MAAM;IACpB,IAAI,OAAOC,QAAQ,KAAK,WAAW,IAAI,CAACA,QAAQ,CAACC,IAAI,EAAE;MACrD;MACA;IACF;IAEA,MAAMC,KAAK,GAAGF,QAAQ,CAACC,IAAI,CAACE,WAAW;IACvC,MAAMC,MAAM,GAAGJ,QAAQ,CAACC,IAAI,CAACI,YAAY;IAEzCX,OAAO,CAACQ,KAAK,KAAKZ,MAAM,CAACY,KAAK,IAAIE,MAAM,KAAKd,MAAM,CAACc,MAAM,CAAC;EAC7D,CAAC,EAAE,CAACd,MAAM,CAACc,MAAM,EAAEd,MAAM,CAACY,KAAK,CAAC,CAAC;EAEjC,oBACE,oBAAC,iBAAI,eACCV,IAAI;IACR,aAAa,EAAEI,aAAc;IAC7B,KAAK,EAAE,CAACP,OAAO,IAAII,IAAI,GAAGa,MAAM,CAACC,IAAI,GAAGD,MAAM,CAACE,IAAI,EAAEjB,KAAK;EAAE,GAC5D;AAEN,CAAC,CAAC;AAAA;AAEF,MAAMe,MAAM,GAAGG,uBAAU,CAACC,MAAM,CAAC;EAC/BH,IAAI,EAAE;IACJI,SAAS,EAAE;EACb,CAAC;EACDH,IAAI,EAAE;IACJI,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC"}

View File

@@ -0,0 +1,452 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _elements = require("@react-navigation/elements");
var _color = _interopRequireDefault(require("color"));
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _CardStyleInterpolators = require("../../TransitionConfigs/CardStyleInterpolators");
var _TransitionPresets = require("../../TransitionConfigs/TransitionPresets");
var _findLastIndex = _interopRequireDefault(require("../../utils/findLastIndex"));
var _getDistanceForDirection = _interopRequireDefault(require("../../utils/getDistanceForDirection"));
var _Screens = require("../Screens");
var _Card = require("./Card");
var _CardContainer = _interopRequireDefault(require("./CardContainer"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const EPSILON = 1e-5;
const STATE_INACTIVE = 0;
const STATE_TRANSITIONING_OR_BELOW_TOP = 1;
const STATE_ON_TOP = 2;
const FALLBACK_DESCRIPTOR = Object.freeze({
options: {}
});
const getInterpolationIndex = (scenes, index) => {
const {
cardStyleInterpolator
} = scenes[index].descriptor.options;
// Start from current card and count backwards the number of cards with same interpolation
let interpolationIndex = 0;
for (let i = index - 1; i >= 0; i--) {
var _scenes$i;
const cardStyleInterpolatorCurrent = (_scenes$i = scenes[i]) === null || _scenes$i === void 0 ? void 0 : _scenes$i.descriptor.options.cardStyleInterpolator;
if (cardStyleInterpolatorCurrent !== cardStyleInterpolator) {
break;
}
interpolationIndex++;
}
return interpolationIndex;
};
const getIsModal = (scene, interpolationIndex, isParentModal) => {
if (isParentModal) {
return true;
}
const {
cardStyleInterpolator
} = scene.descriptor.options;
const isModalPresentation = (0, _Card.getIsModalPresentation)(cardStyleInterpolator);
const isModal = isModalPresentation && interpolationIndex !== 0;
return isModal;
};
const getHeaderHeights = (scenes, insets, isParentHeaderShown, isParentModal, layout, previous) => {
return scenes.reduce((acc, curr, index) => {
const {
headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top,
headerStyle
} = curr.descriptor.options;
const style = _reactNative.StyleSheet.flatten(headerStyle || {});
const height = 'height' in style && typeof style.height === 'number' ? style.height : previous[curr.route.key];
const interpolationIndex = getInterpolationIndex(scenes, index);
const isModal = getIsModal(curr, interpolationIndex, isParentModal);
acc[curr.route.key] = typeof height === 'number' ? height : (0, _elements.getDefaultHeaderHeight)(layout, isModal, headerStatusBarHeight);
return acc;
}, {});
};
const getDistanceFromOptions = (layout, descriptor) => {
const {
presentation,
gestureDirection = presentation === 'modal' ? _TransitionPresets.ModalTransition.gestureDirection : _TransitionPresets.DefaultTransition.gestureDirection
} = (descriptor === null || descriptor === void 0 ? void 0 : descriptor.options) || {};
return (0, _getDistanceForDirection.default)(layout, gestureDirection);
};
const getProgressFromGesture = (gesture, layout, descriptor) => {
const distance = getDistanceFromOptions({
// Make sure that we have a non-zero distance, otherwise there will be incorrect progress
// This causes blank screen on web if it was previously inside container with display: none
width: Math.max(1, layout.width),
height: Math.max(1, layout.height)
}, descriptor);
if (distance > 0) {
return gesture.interpolate({
inputRange: [0, distance],
outputRange: [1, 0]
});
}
return gesture.interpolate({
inputRange: [distance, 0],
outputRange: [0, 1]
});
};
class CardStack extends React.Component {
static getDerivedStateFromProps(props, state) {
if (props.routes === state.routes && props.descriptors === state.descriptors) {
return null;
}
const gestures = props.routes.reduce((acc, curr) => {
const descriptor = props.descriptors[curr.key];
const {
animationEnabled
} = (descriptor === null || descriptor === void 0 ? void 0 : descriptor.options) || {};
acc[curr.key] = state.gestures[curr.key] || new _reactNative.Animated.Value(props.openingRouteKeys.includes(curr.key) && animationEnabled !== false ? getDistanceFromOptions(state.layout, descriptor) : 0);
return acc;
}, {});
const scenes = props.routes.map((route, index, self) => {
const previousRoute = self[index - 1];
const nextRoute = self[index + 1];
const oldScene = state.scenes[index];
const currentGesture = gestures[route.key];
const previousGesture = previousRoute ? gestures[previousRoute.key] : undefined;
const nextGesture = nextRoute ? gestures[nextRoute.key] : undefined;
const descriptor = props.descriptors[route.key] || state.descriptors[route.key] || (oldScene ? oldScene.descriptor : FALLBACK_DESCRIPTOR);
const nextDescriptor = props.descriptors[nextRoute === null || nextRoute === void 0 ? void 0 : nextRoute.key] || state.descriptors[nextRoute === null || nextRoute === void 0 ? void 0 : nextRoute.key];
const previousDescriptor = props.descriptors[previousRoute === null || previousRoute === void 0 ? void 0 : previousRoute.key] || state.descriptors[previousRoute === null || previousRoute === void 0 ? void 0 : previousRoute.key];
// When a screen is not the last, it should use next screen's transition config
// Many transitions also animate the previous screen, so using 2 different transitions doesn't look right
// For example combining a slide and a modal transition would look wrong otherwise
// With this approach, combining different transition styles in the same navigator mostly looks right
// This will still be broken when 2 transitions have different idle state (e.g. modal presentation),
// but majority of the transitions look alright
const optionsForTransitionConfig = index !== self.length - 1 && nextDescriptor && nextDescriptor.options.presentation !== 'transparentModal' ? nextDescriptor.options : descriptor.options;
let defaultTransitionPreset = optionsForTransitionConfig.presentation === 'modal' ? _TransitionPresets.ModalTransition : optionsForTransitionConfig.presentation === 'transparentModal' ? _TransitionPresets.ModalFadeTransition : _TransitionPresets.DefaultTransition;
const {
animationEnabled = _reactNative.Platform.OS !== 'web' && _reactNative.Platform.OS !== 'windows' && _reactNative.Platform.OS !== 'macos',
gestureEnabled = _reactNative.Platform.OS === 'ios' && animationEnabled,
gestureDirection = defaultTransitionPreset.gestureDirection,
transitionSpec = defaultTransitionPreset.transitionSpec,
cardStyleInterpolator = animationEnabled === false ? _CardStyleInterpolators.forNoAnimation : defaultTransitionPreset.cardStyleInterpolator,
headerStyleInterpolator = defaultTransitionPreset.headerStyleInterpolator,
cardOverlayEnabled = _reactNative.Platform.OS !== 'ios' && optionsForTransitionConfig.presentation !== 'transparentModal' || (0, _Card.getIsModalPresentation)(cardStyleInterpolator)
} = optionsForTransitionConfig;
const headerMode = descriptor.options.headerMode ?? (!(optionsForTransitionConfig.presentation === 'modal' || optionsForTransitionConfig.presentation === 'transparentModal' || (nextDescriptor === null || nextDescriptor === void 0 ? void 0 : nextDescriptor.options.presentation) === 'modal' || (nextDescriptor === null || nextDescriptor === void 0 ? void 0 : nextDescriptor.options.presentation) === 'transparentModal' || (0, _Card.getIsModalPresentation)(cardStyleInterpolator)) && _reactNative.Platform.OS === 'ios' && descriptor.options.header === undefined ? 'float' : 'screen');
const scene = {
route,
descriptor: {
...descriptor,
options: {
...descriptor.options,
animationEnabled,
cardOverlayEnabled,
cardStyleInterpolator,
gestureDirection,
gestureEnabled,
headerStyleInterpolator,
transitionSpec,
headerMode
}
},
progress: {
current: getProgressFromGesture(currentGesture, state.layout, descriptor),
next: nextGesture && (nextDescriptor === null || nextDescriptor === void 0 ? void 0 : nextDescriptor.options.presentation) !== 'transparentModal' ? getProgressFromGesture(nextGesture, state.layout, nextDescriptor) : undefined,
previous: previousGesture ? getProgressFromGesture(previousGesture, state.layout, previousDescriptor) : undefined
},
__memo: [state.layout, descriptor, nextDescriptor, previousDescriptor, currentGesture, nextGesture, previousGesture]
};
if (oldScene && scene.__memo.every((it, i) => {
// @ts-expect-error: we haven't added __memo to the annotation to prevent usage elsewhere
return oldScene.__memo[i] === it;
})) {
return oldScene;
}
return scene;
});
return {
routes: props.routes,
scenes,
gestures,
descriptors: props.descriptors,
headerHeights: getHeaderHeights(scenes, props.insets, props.isParentHeaderShown, props.isParentModal, state.layout, state.headerHeights)
};
}
constructor(props) {
super(props);
this.state = {
routes: [],
scenes: [],
gestures: {},
layout: _elements.SafeAreaProviderCompat.initialMetrics.frame,
descriptors: this.props.descriptors,
// Used when card's header is null and mode is float to make transition
// between screens with headers and those without headers smooth.
// This is not a great heuristic here. We don't know synchronously
// on mount what the header height is so we have just used the most
// common cases here.
headerHeights: {}
};
}
handleLayout = e => {
const {
height,
width
} = e.nativeEvent.layout;
const layout = {
width,
height
};
this.setState((state, props) => {
if (height === state.layout.height && width === state.layout.width) {
return null;
}
return {
layout,
headerHeights: getHeaderHeights(state.scenes, props.insets, props.isParentHeaderShown, props.isParentModal, layout, state.headerHeights)
};
});
};
handleHeaderLayout = _ref => {
let {
route,
height
} = _ref;
this.setState(_ref2 => {
let {
headerHeights
} = _ref2;
const previousHeight = headerHeights[route.key];
if (previousHeight === height) {
return null;
}
return {
headerHeights: {
...headerHeights,
[route.key]: height
}
};
});
};
getFocusedRoute = () => {
const {
state
} = this.props;
return state.routes[state.index];
};
getPreviousScene = _ref3 => {
let {
route
} = _ref3;
const {
getPreviousRoute
} = this.props;
const {
scenes
} = this.state;
const previousRoute = getPreviousRoute({
route
});
if (previousRoute) {
const previousScene = scenes.find(scene => scene.descriptor.route.key === previousRoute.key);
return previousScene;
}
return undefined;
};
render() {
const {
insets,
state,
routes,
closingRouteKeys,
onOpenRoute,
onCloseRoute,
renderHeader,
renderScene,
isParentHeaderShown,
isParentModal,
onTransitionStart,
onTransitionEnd,
onGestureStart,
onGestureEnd,
onGestureCancel,
detachInactiveScreens = _reactNative.Platform.OS === 'web' || _reactNative.Platform.OS === 'android' || _reactNative.Platform.OS === 'ios'
} = this.props;
const {
scenes,
layout,
gestures,
headerHeights
} = this.state;
const focusedRoute = state.routes[state.index];
const focusedHeaderHeight = headerHeights[focusedRoute.key];
const isFloatHeaderAbsolute = this.state.scenes.slice(-2).some(scene => {
const options = scene.descriptor.options ?? {};
const {
headerMode,
headerTransparent,
headerShown = true
} = options;
if (headerTransparent || headerShown === false || headerMode === 'screen') {
return true;
}
return false;
});
let activeScreensLimit = 1;
for (let i = scenes.length - 1; i >= 0; i--) {
const {
options
} = scenes[i].descriptor;
const {
// By default, we don't want to detach the previous screen of the active one for modals
detachPreviousScreen = options.presentation === 'transparentModal' ? false : (0, _Card.getIsModalPresentation)(options.cardStyleInterpolator) ? i !== (0, _findLastIndex.default)(scenes, scene => {
const {
cardStyleInterpolator
} = scene.descriptor.options;
return cardStyleInterpolator === _CardStyleInterpolators.forModalPresentationIOS || (cardStyleInterpolator === null || cardStyleInterpolator === void 0 ? void 0 : cardStyleInterpolator.name) === 'forModalPresentationIOS';
}) : true
} = options;
if (detachPreviousScreen === false) {
activeScreensLimit++;
} else {
// Check at least last 2 screens before stopping
// This will make sure that screen isn't detached when another screen is animating on top of the transparent one
// For example, (Opaque -> Transparent -> Opaque)
if (i <= scenes.length - 2) {
break;
}
}
}
const floatingHeader = /*#__PURE__*/React.createElement(React.Fragment, {
key: "header"
}, renderHeader({
mode: 'float',
layout,
scenes,
getPreviousScene: this.getPreviousScene,
getFocusedRoute: this.getFocusedRoute,
onContentHeightChange: this.handleHeaderLayout,
style: [styles.floating, isFloatHeaderAbsolute && [
// Without this, the header buttons won't be touchable on Android when headerTransparent: true
{
height: focusedHeaderHeight
}, styles.absolute]]
}));
return /*#__PURE__*/React.createElement(_elements.Background, null, isFloatHeaderAbsolute ? null : floatingHeader, /*#__PURE__*/React.createElement(_Screens.MaybeScreenContainer, {
enabled: detachInactiveScreens,
style: styles.container,
onLayout: this.handleLayout
}, routes.map((route, index, self) => {
var _scenes, _scenes2;
const focused = focusedRoute.key === route.key;
const gesture = gestures[route.key];
const scene = scenes[index];
// For the screens that shouldn't be active, the value is 0
// For those that should be active, but are not the top screen, the value is 1
// For those on top of the stack and with interaction enabled, the value is 2
// For the old implementation, it stays the same it was
let isScreenActive = 1;
if (index < self.length - activeScreensLimit - 1) {
// screen should be inactive because it is too deep in the stack
isScreenActive = STATE_INACTIVE;
} else {
const sceneForActivity = scenes[self.length - 1];
const outputValue = index === self.length - 1 ? STATE_ON_TOP // the screen is on top after the transition
: index >= self.length - activeScreensLimit ? STATE_TRANSITIONING_OR_BELOW_TOP // the screen should stay active after the transition, it is not on top but is in activeLimit
: STATE_INACTIVE; // the screen should be active only during the transition, it is at the edge of activeLimit
isScreenActive = sceneForActivity ? sceneForActivity.progress.current.interpolate({
inputRange: [0, 1 - EPSILON, 1],
outputRange: [1, 1, outputValue],
extrapolate: 'clamp'
}) : STATE_TRANSITIONING_OR_BELOW_TOP;
}
const {
headerShown = true,
headerTransparent,
headerStyle,
headerTintColor,
freezeOnBlur
} = scene.descriptor.options;
const safeAreaInsetTop = insets.top;
const safeAreaInsetRight = insets.right;
const safeAreaInsetBottom = insets.bottom;
const safeAreaInsetLeft = insets.left;
const headerHeight = headerShown !== false ? headerHeights[route.key] : 0;
let headerDarkContent;
if (headerShown) {
if (typeof headerTintColor === 'string') {
headerDarkContent = (0, _color.default)(headerTintColor).isDark();
} else {
const flattenedHeaderStyle = _reactNative.StyleSheet.flatten(headerStyle);
if (flattenedHeaderStyle && 'backgroundColor' in flattenedHeaderStyle && typeof flattenedHeaderStyle.backgroundColor === 'string') {
headerDarkContent = !(0, _color.default)(flattenedHeaderStyle.backgroundColor).isDark();
}
}
}
// Start from current card and count backwards the number of cards with same interpolation
const interpolationIndex = getInterpolationIndex(scenes, index);
const isModal = getIsModal(scene, interpolationIndex, isParentModal);
const isNextScreenTransparent = ((_scenes = scenes[index + 1]) === null || _scenes === void 0 ? void 0 : _scenes.descriptor.options.presentation) === 'transparentModal';
const detachCurrentScreen = ((_scenes2 = scenes[index + 1]) === null || _scenes2 === void 0 ? void 0 : _scenes2.descriptor.options.detachPreviousScreen) !== false;
return /*#__PURE__*/React.createElement(_Screens.MaybeScreen, {
key: route.key,
style: _reactNative.StyleSheet.absoluteFill,
enabled: detachInactiveScreens,
active: isScreenActive,
freezeOnBlur: freezeOnBlur,
pointerEvents: "box-none"
}, /*#__PURE__*/React.createElement(_CardContainer.default, {
index: index,
interpolationIndex: interpolationIndex,
modal: isModal,
active: index === self.length - 1,
focused: focused,
closing: closingRouteKeys.includes(route.key),
layout: layout,
gesture: gesture,
scene: scene,
safeAreaInsetTop: safeAreaInsetTop,
safeAreaInsetRight: safeAreaInsetRight,
safeAreaInsetBottom: safeAreaInsetBottom,
safeAreaInsetLeft: safeAreaInsetLeft,
onGestureStart: onGestureStart,
onGestureCancel: onGestureCancel,
onGestureEnd: onGestureEnd,
headerHeight: headerHeight,
isParentHeaderShown: isParentHeaderShown,
onHeaderHeightChange: this.handleHeaderLayout,
getPreviousScene: this.getPreviousScene,
getFocusedRoute: this.getFocusedRoute,
headerDarkContent: headerDarkContent,
hasAbsoluteFloatHeader: isFloatHeaderAbsolute && !headerTransparent,
renderHeader: renderHeader,
renderScene: renderScene,
onOpenRoute: onOpenRoute,
onCloseRoute: onCloseRoute,
onTransitionStart: onTransitionStart,
onTransitionEnd: onTransitionEnd,
isNextScreenTransparent: isNextScreenTransparent,
detachCurrentScreen: detachCurrentScreen
}));
})), isFloatHeaderAbsolute ? floatingHeader : null);
}
}
exports.default = CardStack;
const styles = _reactNative.StyleSheet.create({
container: {
flex: 1
},
absolute: {
position: 'absolute',
top: 0,
left: 0,
right: 0
},
floating: {
zIndex: 1
}
});
//# sourceMappingURL=CardStack.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,349 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _elements = require("@react-navigation/elements");
var _native = require("@react-navigation/native");
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
var _ModalPresentationContext = _interopRequireDefault(require("../../utils/ModalPresentationContext"));
var _GestureHandler = require("../GestureHandler");
var _HeaderContainer = _interopRequireDefault(require("../Header/HeaderContainer"));
var _CardStack = _interopRequireDefault(require("./CardStack"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
const GestureHandlerWrapper = _GestureHandler.GestureHandlerRootView ?? _reactNative.View;
/**
* Compare two arrays with primitive values as the content.
* We need to make sure that both values and order match.
*/
const isArrayEqual = (a, b) => a.length === b.length && a.every((it, index) => it === b[index]);
class StackView extends React.Component {
static getDerivedStateFromProps(props, state) {
// If there was no change in routes, we don't need to compute anything
if ((props.state.routes === state.previousRoutes || isArrayEqual(props.state.routes.map(r => r.key), state.previousRoutes.map(r => r.key))) && state.routes.length) {
let routes = state.routes;
let previousRoutes = state.previousRoutes;
let descriptors = props.descriptors;
let previousDescriptors = state.previousDescriptors;
if (props.descriptors !== state.previousDescriptors) {
descriptors = state.routes.reduce((acc, route) => {
acc[route.key] = props.descriptors[route.key] || state.descriptors[route.key];
return acc;
}, {});
previousDescriptors = props.descriptors;
}
if (props.state.routes !== state.previousRoutes) {
// if any route objects have changed, we should update them
const map = props.state.routes.reduce((acc, route) => {
acc[route.key] = route;
return acc;
}, {});
routes = state.routes.map(route => map[route.key] || route);
previousRoutes = props.state.routes;
}
return {
routes,
previousRoutes,
descriptors,
previousDescriptors
};
}
// Here we determine which routes were added or removed to animate them
// We keep a copy of the route being removed in local state to be able to animate it
let routes = props.state.index < props.state.routes.length - 1 ?
// Remove any extra routes from the state
// The last visible route should be the focused route, i.e. at current index
props.state.routes.slice(0, props.state.index + 1) : props.state.routes;
// Now we need to determine which routes were added and removed
let {
openingRouteKeys,
closingRouteKeys,
replacingRouteKeys,
previousRoutes
} = state;
const previousFocusedRoute = previousRoutes[previousRoutes.length - 1];
const nextFocusedRoute = routes[routes.length - 1];
const isAnimationEnabled = key => {
const descriptor = props.descriptors[key] || state.descriptors[key];
return descriptor ? descriptor.options.animationEnabled !== false : true;
};
const getAnimationTypeForReplace = key => {
const descriptor = props.descriptors[key] || state.descriptors[key];
return descriptor.options.animationTypeForReplace ?? 'push';
};
if (previousFocusedRoute && previousFocusedRoute.key !== nextFocusedRoute.key) {
// We only need to animate routes if the focused route changed
// Animating previous routes won't be visible coz the focused route is on top of everything
if (!previousRoutes.some(r => r.key === nextFocusedRoute.key)) {
// A new route has come to the focus, we treat this as a push
// A replace can also trigger this, the animation should look like push
if (isAnimationEnabled(nextFocusedRoute.key) && !openingRouteKeys.includes(nextFocusedRoute.key)) {
// In this case, we need to animate pushing the focused route
// We don't care about animating any other added routes because they won't be visible
openingRouteKeys = [...openingRouteKeys, nextFocusedRoute.key];
closingRouteKeys = closingRouteKeys.filter(key => key !== nextFocusedRoute.key);
replacingRouteKeys = replacingRouteKeys.filter(key => key !== nextFocusedRoute.key);
if (!routes.some(r => r.key === previousFocusedRoute.key)) {
// The previous focused route isn't present in state, we treat this as a replace
openingRouteKeys = openingRouteKeys.filter(key => key !== previousFocusedRoute.key);
if (getAnimationTypeForReplace(nextFocusedRoute.key) === 'pop') {
closingRouteKeys = [...closingRouteKeys, previousFocusedRoute.key];
// By default, new routes have a push animation, so we add it to `openingRouteKeys` before
// But since user configured it to animate the old screen like a pop, we need to add this without animation
// So remove it from `openingRouteKeys` which will remove the animation
openingRouteKeys = openingRouteKeys.filter(key => key !== nextFocusedRoute.key);
// Keep the route being removed at the end to animate it out
routes = [...routes, previousFocusedRoute];
} else {
replacingRouteKeys = [...replacingRouteKeys, previousFocusedRoute.key];
closingRouteKeys = closingRouteKeys.filter(key => key !== previousFocusedRoute.key);
// Keep the old route in the state because it's visible under the new route, and removing it will feel abrupt
// We need to insert it just before the focused one (the route being pushed)
// After the push animation is completed, routes being replaced will be removed completely
routes = routes.slice();
routes.splice(routes.length - 1, 0, previousFocusedRoute);
}
}
}
} else if (!routes.some(r => r.key === previousFocusedRoute.key)) {
// The previously focused route was removed, we treat this as a pop
if (isAnimationEnabled(previousFocusedRoute.key) && !closingRouteKeys.includes(previousFocusedRoute.key)) {
closingRouteKeys = [...closingRouteKeys, previousFocusedRoute.key];
// Sometimes a route can be closed before the opening animation finishes
// So we also need to remove it from the opening list
openingRouteKeys = openingRouteKeys.filter(key => key !== previousFocusedRoute.key);
replacingRouteKeys = replacingRouteKeys.filter(key => key !== previousFocusedRoute.key);
// Keep a copy of route being removed in the state to be able to animate it
routes = [...routes, previousFocusedRoute];
}
} else {
// Looks like some routes were re-arranged and no focused routes were added/removed
// i.e. the currently focused route already existed and the previously focused route still exists
// We don't know how to animate this
}
} else if (replacingRouteKeys.length || closingRouteKeys.length) {
// Keep the routes we are closing or replacing if animation is enabled for them
routes = routes.slice();
routes.splice(routes.length - 1, 0, ...state.routes.filter(_ref => {
let {
key
} = _ref;
return isAnimationEnabled(key) ? replacingRouteKeys.includes(key) || closingRouteKeys.includes(key) : false;
}));
}
if (!routes.length) {
throw new Error('There should always be at least one route in the navigation state.');
}
const descriptors = routes.reduce((acc, route) => {
acc[route.key] = props.descriptors[route.key] || state.descriptors[route.key];
return acc;
}, {});
return {
routes,
previousRoutes: props.state.routes,
previousDescriptors: props.descriptors,
openingRouteKeys,
closingRouteKeys,
replacingRouteKeys,
descriptors
};
}
state = {
routes: [],
previousRoutes: [],
previousDescriptors: {},
openingRouteKeys: [],
closingRouteKeys: [],
replacingRouteKeys: [],
descriptors: {}
};
getPreviousRoute = _ref2 => {
let {
route
} = _ref2;
const {
closingRouteKeys,
replacingRouteKeys
} = this.state;
const routes = this.state.routes.filter(r => r.key === route.key || !closingRouteKeys.includes(r.key) && !replacingRouteKeys.includes(r.key));
const index = routes.findIndex(r => r.key === route.key);
return routes[index - 1];
};
renderScene = _ref3 => {
let {
route
} = _ref3;
const descriptor = this.state.descriptors[route.key] || this.props.descriptors[route.key];
if (!descriptor) {
return null;
}
return descriptor.render();
};
renderHeader = props => {
return /*#__PURE__*/React.createElement(_HeaderContainer.default, props);
};
handleOpenRoute = _ref4 => {
let {
route
} = _ref4;
const {
state,
navigation
} = this.props;
const {
closingRouteKeys,
replacingRouteKeys
} = this.state;
if (closingRouteKeys.some(key => key === route.key) && replacingRouteKeys.every(key => key !== route.key) && state.routeNames.includes(route.name) && !state.routes.some(r => r.key === route.key)) {
// If route isn't present in current state, but was closing, assume that a close animation was cancelled
// So we need to add this route back to the state
navigation.navigate(route);
} else {
this.setState(state => ({
routes: state.replacingRouteKeys.length ? state.routes.filter(r => !state.replacingRouteKeys.includes(r.key)) : state.routes,
openingRouteKeys: state.openingRouteKeys.filter(key => key !== route.key),
closingRouteKeys: state.closingRouteKeys.filter(key => key !== route.key),
replacingRouteKeys: []
}));
}
};
handleCloseRoute = _ref5 => {
let {
route
} = _ref5;
const {
state,
navigation
} = this.props;
if (state.routes.some(r => r.key === route.key)) {
// If a route exists in state, trigger a pop
// This will happen in when the route was closed from the card component
// e.g. When the close animation triggered from a gesture ends
navigation.dispatch({
..._native.StackActions.pop(),
source: route.key,
target: state.key
});
} else {
// We need to clean up any state tracking the route and pop it immediately
this.setState(state => ({
routes: state.routes.filter(r => r.key !== route.key),
openingRouteKeys: state.openingRouteKeys.filter(key => key !== route.key),
closingRouteKeys: state.closingRouteKeys.filter(key => key !== route.key)
}));
}
};
handleTransitionStart = (_ref6, closing) => {
let {
route
} = _ref6;
return this.props.navigation.emit({
type: 'transitionStart',
data: {
closing
},
target: route.key
});
};
handleTransitionEnd = (_ref7, closing) => {
let {
route
} = _ref7;
return this.props.navigation.emit({
type: 'transitionEnd',
data: {
closing
},
target: route.key
});
};
handleGestureStart = _ref8 => {
let {
route
} = _ref8;
this.props.navigation.emit({
type: 'gestureStart',
target: route.key
});
};
handleGestureEnd = _ref9 => {
let {
route
} = _ref9;
this.props.navigation.emit({
type: 'gestureEnd',
target: route.key
});
};
handleGestureCancel = _ref10 => {
let {
route
} = _ref10;
this.props.navigation.emit({
type: 'gestureCancel',
target: route.key
});
};
render() {
const {
state,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
descriptors: _,
...rest
} = this.props;
const {
routes,
descriptors,
openingRouteKeys,
closingRouteKeys
} = this.state;
return /*#__PURE__*/React.createElement(GestureHandlerWrapper, {
style: styles.container
}, /*#__PURE__*/React.createElement(_elements.SafeAreaProviderCompat, null, /*#__PURE__*/React.createElement(_reactNativeSafeAreaContext.SafeAreaInsetsContext.Consumer, null, insets => /*#__PURE__*/React.createElement(_ModalPresentationContext.default.Consumer, null, isParentModal => /*#__PURE__*/React.createElement(_elements.HeaderShownContext.Consumer, null, isParentHeaderShown => /*#__PURE__*/React.createElement(_CardStack.default, _extends({
insets: insets,
isParentHeaderShown: isParentHeaderShown,
isParentModal: isParentModal,
getPreviousRoute: this.getPreviousRoute,
routes: routes,
openingRouteKeys: openingRouteKeys,
closingRouteKeys: closingRouteKeys,
onOpenRoute: this.handleOpenRoute,
onCloseRoute: this.handleCloseRoute,
onTransitionStart: this.handleTransitionStart,
onTransitionEnd: this.handleTransitionEnd,
renderHeader: this.renderHeader,
renderScene: this.renderScene,
state: state,
descriptors: descriptors,
onGestureStart: this.handleGestureStart,
onGestureEnd: this.handleGestureEnd,
onGestureCancel: this.handleGestureCancel
}, rest)))))));
}
}
exports.default = StackView;
const styles = _reactNative.StyleSheet.create({
container: {
flex: 1
}
});
//# sourceMappingURL=StackView.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,346 @@
import { Animated, Platform } from 'react-native';
import conditional from '../utils/conditional';
const {
add,
multiply
} = Animated;
/**
* Standard iOS-style slide in from the right.
*/
export function forHorizontalIOS(_ref) {
let {
current,
next,
inverted,
layouts: {
screen
}
} = _ref;
const translateFocused = multiply(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [screen.width, 0],
extrapolate: 'clamp'
}), inverted);
const translateUnfocused = next ? multiply(next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, screen.width * -0.3],
extrapolate: 'clamp'
}), inverted) : 0;
const overlayOpacity = current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 0.07],
extrapolate: 'clamp'
});
const shadowOpacity = current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 0.3],
extrapolate: 'clamp'
});
return {
cardStyle: {
transform: [
// Translation for the animation of the current card
{
translateX: translateFocused
},
// Translation for the animation of the card on top of this
{
translateX: translateUnfocused
}]
},
overlayStyle: {
opacity: overlayOpacity
},
shadowStyle: {
shadowOpacity
}
};
}
/**
* Standard iOS-style slide in from the bottom (used for modals).
*/
export function forVerticalIOS(_ref2) {
let {
current,
inverted,
layouts: {
screen
}
} = _ref2;
const translateY = multiply(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [screen.height, 0],
extrapolate: 'clamp'
}), inverted);
return {
cardStyle: {
transform: [{
translateY
}]
}
};
}
/**
* Standard iOS-style modal animation in iOS 13.
*/
export function forModalPresentationIOS(_ref3) {
let {
index,
current,
next,
inverted,
layouts: {
screen
},
insets
} = _ref3;
const hasNotchIos = Platform.OS === 'ios' && !Platform.isPad && !Platform.isTV && insets.top > 20;
const isLandscape = screen.width > screen.height;
const topOffset = isLandscape ? 0 : 10;
const statusBarHeight = insets.top;
const aspectRatio = screen.height / screen.width;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
const isFirst = index === 0;
const translateY = multiply(progress.interpolate({
inputRange: [0, 1, 2],
outputRange: [screen.height, isFirst ? 0 : topOffset, (isFirst ? statusBarHeight : 0) - topOffset * aspectRatio]
}), inverted);
const overlayOpacity = progress.interpolate({
inputRange: [0, 1, 1.0001, 2],
outputRange: [0, 0.3, 1, 1]
});
const scale = isLandscape ? 1 : progress.interpolate({
inputRange: [0, 1, 2],
outputRange: [1, 1, screen.width ? 1 - topOffset * 2 / screen.width : 1]
});
const borderRadius = isLandscape ? 0 : isFirst ? progress.interpolate({
inputRange: [0, 1, 1.0001, 2],
outputRange: [0, 0, hasNotchIos ? 38 : 0, 10]
}) : 10;
return {
cardStyle: {
overflow: 'hidden',
borderTopLeftRadius: borderRadius,
borderTopRightRadius: borderRadius,
// We don't need these for the animation
// But different border radius for corners improves animation perf
borderBottomLeftRadius: hasNotchIos ? borderRadius : 0,
borderBottomRightRadius: hasNotchIos ? borderRadius : 0,
marginTop: isFirst ? 0 : statusBarHeight,
marginBottom: isFirst ? 0 : topOffset,
transform: [{
translateY
}, {
scale
}]
},
overlayStyle: {
opacity: overlayOpacity
}
};
}
/**
* Standard Android-style fade in from the bottom for Android Oreo.
*/
export function forFadeFromBottomAndroid(_ref4) {
let {
current,
inverted,
layouts: {
screen
},
closing
} = _ref4;
const translateY = multiply(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [screen.height * 0.08, 0],
extrapolate: 'clamp'
}), inverted);
const opacity = conditional(closing, current.progress, current.progress.interpolate({
inputRange: [0, 0.5, 0.9, 1],
outputRange: [0, 0.25, 0.7, 1],
extrapolate: 'clamp'
}));
return {
cardStyle: {
opacity,
transform: [{
translateY
}]
}
};
}
/**
* Standard Android-style reveal from the bottom for Android Pie.
*/
export function forRevealFromBottomAndroid(_ref5) {
let {
current,
next,
inverted,
layouts: {
screen
}
} = _ref5;
const containerTranslateY = multiply(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [screen.height, 0],
extrapolate: 'clamp'
}), inverted);
const cardTranslateYFocused = multiply(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [screen.height * (95.9 / 100) * -1, 0],
extrapolate: 'clamp'
}), inverted);
const cardTranslateYUnfocused = next ? multiply(next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, screen.height * (2 / 100) * -1],
extrapolate: 'clamp'
}), inverted) : 0;
const overlayOpacity = current.progress.interpolate({
inputRange: [0, 0.36, 1],
outputRange: [0, 0.1, 0.1],
extrapolate: 'clamp'
});
return {
containerStyle: {
overflow: 'hidden',
transform: [{
translateY: containerTranslateY
}]
},
cardStyle: {
transform: [{
translateY: cardTranslateYFocused
}, {
translateY: cardTranslateYUnfocused
}]
},
overlayStyle: {
opacity: overlayOpacity
}
};
}
/**
* Standard Android-style zoom for Android 10.
*/
export function forScaleFromCenterAndroid(_ref6) {
let {
current,
next,
closing
} = _ref6;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
const opacity = progress.interpolate({
inputRange: [0, 0.75, 0.875, 1, 1.0825, 1.2075, 2],
outputRange: [0, 0, 1, 1, 1, 1, 0]
});
const scale = conditional(closing, current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0.925, 1],
extrapolate: 'clamp'
}), progress.interpolate({
inputRange: [0, 1, 2],
outputRange: [0.85, 1, 1.075]
}));
return {
cardStyle: {
opacity,
transform: [{
scale
}]
}
};
}
/**
* Standard bottom sheet slide in from the bottom for Android.
*/
export function forBottomSheetAndroid(_ref7) {
let {
current,
inverted,
layouts: {
screen
},
closing
} = _ref7;
const translateY = multiply(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [screen.height * 0.8, 0],
extrapolate: 'clamp'
}), inverted);
const opacity = conditional(closing, current.progress, current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}));
const overlayOpacity = current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 0.3],
extrapolate: 'clamp'
});
return {
cardStyle: {
opacity,
transform: [{
translateY
}]
},
overlayStyle: {
opacity: overlayOpacity
}
};
}
/**
* Simple fade animation for dialogs
*/
export function forFadeFromCenter(_ref8) {
let {
current: {
progress
}
} = _ref8;
return {
cardStyle: {
opacity: progress.interpolate({
inputRange: [0, 0.5, 0.9, 1],
outputRange: [0, 0.25, 0.7, 1]
})
},
overlayStyle: {
opacity: progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 0.5],
extrapolate: 'clamp'
})
}
};
}
export function forNoAnimation() {
return {};
}
//# sourceMappingURL=CardStyleInterpolators.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,253 @@
import { Animated, I18nManager } from 'react-native';
const {
add
} = Animated;
/**
* Standard UIKit style animation for the header where the title fades into the back button label.
*/
export function forUIKit(_ref) {
let {
current,
next,
layouts
} = _ref;
const defaultOffset = 100;
const leftSpacing = 27;
// The title and back button title should cross-fade to each other
// When screen is fully open, the title should be in center, and back title should be on left
// When screen is closing, the previous title will animate to back title's position
// And back title will animate to title's position
// We achieve this by calculating the offsets needed to translate title to back title's position and vice-versa
const leftLabelOffset = layouts.leftLabel ? (layouts.screen.width - layouts.leftLabel.width) / 2 - leftSpacing : defaultOffset;
const titleLeftOffset = layouts.title ? (layouts.screen.width - layouts.title.width) / 2 - leftSpacing : defaultOffset;
// When the current title is animating to right, it is centered in the right half of screen in middle of transition
// The back title also animates in from this position
const rightOffset = layouts.screen.width / 4;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
return {
leftButtonStyle: {
opacity: progress.interpolate({
inputRange: [0.3, 1, 1.5],
outputRange: [0, 1, 0]
})
},
leftLabelStyle: {
transform: [{
translateX: progress.interpolate({
inputRange: [0, 1, 2],
outputRange: I18nManager.getConstants().isRTL ? [-rightOffset, 0, leftLabelOffset] : [leftLabelOffset, 0, -rightOffset]
})
}]
},
rightButtonStyle: {
opacity: progress.interpolate({
inputRange: [0.3, 1, 1.5],
outputRange: [0, 1, 0]
})
},
titleStyle: {
opacity: progress.interpolate({
inputRange: [0, 0.4, 1, 1.5],
outputRange: [0, 0.1, 1, 0]
}),
transform: [{
translateX: progress.interpolate({
inputRange: [0.5, 1, 2],
outputRange: I18nManager.getConstants().isRTL ? [-titleLeftOffset, 0, rightOffset] : [rightOffset, 0, -titleLeftOffset]
})
}]
},
backgroundStyle: {
transform: [{
translateX: progress.interpolate({
inputRange: [0, 1, 2],
outputRange: I18nManager.getConstants().isRTL ? [-layouts.screen.width, 0, layouts.screen.width] : [layouts.screen.width, 0, -layouts.screen.width]
})
}]
}
};
}
/**
* Simple fade animation for the header elements.
*/
export function forFade(_ref2) {
let {
current,
next
} = _ref2;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
const opacity = progress.interpolate({
inputRange: [0, 1, 2],
outputRange: [0, 1, 0]
});
return {
leftButtonStyle: {
opacity
},
rightButtonStyle: {
opacity
},
titleStyle: {
opacity
},
backgroundStyle: {
opacity: progress.interpolate({
inputRange: [0, 1, 1.9, 2],
outputRange: [0, 1, 1, 0]
})
}
};
}
/**
* Simple translate animation to translate the header to left.
*/
export function forSlideLeft(_ref3) {
let {
current,
next,
layouts: {
screen
}
} = _ref3;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
const translateX = progress.interpolate({
inputRange: [0, 1, 2],
outputRange: I18nManager.getConstants().isRTL ? [-screen.width, 0, screen.width] : [screen.width, 0, -screen.width]
});
const transform = [{
translateX
}];
return {
leftButtonStyle: {
transform
},
rightButtonStyle: {
transform
},
titleStyle: {
transform
},
backgroundStyle: {
transform
}
};
}
/**
* Simple translate animation to translate the header to right.
*/
export function forSlideRight(_ref4) {
let {
current,
next,
layouts: {
screen
}
} = _ref4;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
const translateX = progress.interpolate({
inputRange: [0, 1, 2],
outputRange: I18nManager.getConstants().isRTL ? [screen.width, 0, -screen.width] : [-screen.width, 0, screen.width]
});
const transform = [{
translateX
}];
return {
leftButtonStyle: {
transform
},
rightButtonStyle: {
transform
},
titleStyle: {
transform
},
backgroundStyle: {
transform
}
};
}
/**
* Simple translate animation to translate the header to slide up.
*/
export function forSlideUp(_ref5) {
let {
current,
next,
layouts: {
header
}
} = _ref5;
const progress = add(current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}), next ? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
extrapolate: 'clamp'
}) : 0);
const translateY = progress.interpolate({
inputRange: [0, 1, 2],
outputRange: [-header.height, 0, -header.height]
});
const transform = [{
translateY
}];
return {
leftButtonStyle: {
transform
},
rightButtonStyle: {
transform
},
titleStyle: {
transform
},
backgroundStyle: {
transform
}
};
}
export function forNoAnimation() {
return {};
}
//# sourceMappingURL=HeaderStyleInterpolators.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,128 @@
import { Platform } from 'react-native';
import { forBottomSheetAndroid, forFadeFromBottomAndroid, forFadeFromCenter as forFadeCard, forHorizontalIOS, forModalPresentationIOS, forRevealFromBottomAndroid, forScaleFromCenterAndroid, forVerticalIOS } from './CardStyleInterpolators';
import { forFade } from './HeaderStyleInterpolators';
import { BottomSheetSlideInSpec, BottomSheetSlideOutSpec, FadeInFromBottomAndroidSpec, FadeOutToBottomAndroidSpec, RevealFromBottomAndroidSpec, ScaleFromCenterAndroidSpec, TransitionIOSSpec } from './TransitionSpecs';
const ANDROID_VERSION_PIE = 28;
const ANDROID_VERSION_10 = 29;
/**
* Standard iOS navigation transition.
*/
export const SlideFromRightIOS = {
gestureDirection: 'horizontal',
transitionSpec: {
open: TransitionIOSSpec,
close: TransitionIOSSpec
},
cardStyleInterpolator: forHorizontalIOS,
headerStyleInterpolator: forFade
};
/**
* Standard iOS navigation transition for modals.
*/
export const ModalSlideFromBottomIOS = {
gestureDirection: 'vertical',
transitionSpec: {
open: TransitionIOSSpec,
close: TransitionIOSSpec
},
cardStyleInterpolator: forVerticalIOS,
headerStyleInterpolator: forFade
};
/**
* Standard iOS modal presentation style (introduced in iOS 13).
*/
export const ModalPresentationIOS = {
gestureDirection: 'vertical',
transitionSpec: {
open: TransitionIOSSpec,
close: TransitionIOSSpec
},
cardStyleInterpolator: forModalPresentationIOS,
headerStyleInterpolator: forFade
};
/**
* Standard Android navigation transition when opening or closing an Activity on Android < 9 (Oreo).
*/
export const FadeFromBottomAndroid = {
gestureDirection: 'vertical',
transitionSpec: {
open: FadeInFromBottomAndroidSpec,
close: FadeOutToBottomAndroidSpec
},
cardStyleInterpolator: forFadeFromBottomAndroid,
headerStyleInterpolator: forFade
};
/**
* Standard Android navigation transition when opening or closing an Activity on Android 9 (Pie).
*/
export const RevealFromBottomAndroid = {
gestureDirection: 'vertical',
transitionSpec: {
open: RevealFromBottomAndroidSpec,
close: RevealFromBottomAndroidSpec
},
cardStyleInterpolator: forRevealFromBottomAndroid,
headerStyleInterpolator: forFade
};
/**
* Standard Android navigation transition when opening or closing an Activity on Android 10 (Q).
*/
export const ScaleFromCenterAndroid = {
gestureDirection: 'horizontal',
transitionSpec: {
open: ScaleFromCenterAndroidSpec,
close: ScaleFromCenterAndroidSpec
},
cardStyleInterpolator: forScaleFromCenterAndroid,
headerStyleInterpolator: forFade
};
/**
* Standard bottom sheet slide transition for Android 10.
*/
export const BottomSheetAndroid = {
gestureDirection: 'vertical',
transitionSpec: {
open: BottomSheetSlideInSpec,
close: BottomSheetSlideOutSpec
},
cardStyleInterpolator: forBottomSheetAndroid,
headerStyleInterpolator: forFade
};
/**
* Fade transition for transparent modals.
*/
export const ModalFadeTransition = {
gestureDirection: 'vertical',
transitionSpec: {
open: BottomSheetSlideInSpec,
close: BottomSheetSlideOutSpec
},
cardStyleInterpolator: forFadeCard,
headerStyleInterpolator: forFade
};
/**
* Default navigation transition for the current platform.
*/
export const DefaultTransition = Platform.select({
ios: SlideFromRightIOS,
android: Platform.Version >= ANDROID_VERSION_10 ? ScaleFromCenterAndroid : Platform.Version >= ANDROID_VERSION_PIE ? RevealFromBottomAndroid : FadeFromBottomAndroid,
default: ScaleFromCenterAndroid
});
/**
* Default modal transition for the current platform.
*/
export const ModalTransition = Platform.select({
ios: ModalPresentationIOS,
default: BottomSheetAndroid
});
//# sourceMappingURL=TransitionPresets.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["Platform","forBottomSheetAndroid","forFadeFromBottomAndroid","forFadeFromCenter","forFadeCard","forHorizontalIOS","forModalPresentationIOS","forRevealFromBottomAndroid","forScaleFromCenterAndroid","forVerticalIOS","forFade","BottomSheetSlideInSpec","BottomSheetSlideOutSpec","FadeInFromBottomAndroidSpec","FadeOutToBottomAndroidSpec","RevealFromBottomAndroidSpec","ScaleFromCenterAndroidSpec","TransitionIOSSpec","ANDROID_VERSION_PIE","ANDROID_VERSION_10","SlideFromRightIOS","gestureDirection","transitionSpec","open","close","cardStyleInterpolator","headerStyleInterpolator","ModalSlideFromBottomIOS","ModalPresentationIOS","FadeFromBottomAndroid","RevealFromBottomAndroid","ScaleFromCenterAndroid","BottomSheetAndroid","ModalFadeTransition","DefaultTransition","select","ios","android","Version","default","ModalTransition"],"sourceRoot":"../../../src","sources":["TransitionConfigs/TransitionPresets.tsx"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAGvC,SACEC,qBAAqB,EACrBC,wBAAwB,EACxBC,iBAAiB,IAAIC,WAAW,EAChCC,gBAAgB,EAChBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,yBAAyB,EACzBC,cAAc,QACT,0BAA0B;AACjC,SAASC,OAAO,QAAQ,4BAA4B;AACpD,SACEC,sBAAsB,EACtBC,uBAAuB,EACvBC,2BAA2B,EAC3BC,0BAA0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ACjDmB,uBAAuB,EAAEhB;AAC3B,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMqB,sBAAwC,GAAG;EACtDV,gBAAgB,EAAE,YAAY;EAC9BC,cAAc,EAAE;IACdC,IAAI,EAAEP,0BAA0B;IAChCQ,KAAK,EAAER;EACT,CAAC;EACDS,qBAAqB,EAAEjB,yBAAyB;EAChDkB,uBAAuB,EAAEhB;AAC3B,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMsB,kBAAoC,GAAG;EAClDX,gBAAgB,EAAE,UAAU;EAC5BC,cAAc,EAAE;IACdC,IAAI,EAAEZ,sBAAsB;IAC5Ba,KAAK,EAAEZ;EACT,CAAC;EACDa,qBAAqB,EAAExB,qBAAqB;EAC5CyB,uBAAuB,EAAEhB;AAC3B,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMuB,mBAAqC,GAAG;EACnDZ,gBAAgB,EAAE,UAAU;EAC5BC,cAAc,EAAE;IACdC,IAAI,EAAEZ,sBAAsB;IAC5Ba,KAAK,EAAEZ;EACT,CAAC;EACDa,qBAAqB,EAAErB,WAAW;EAClCsB,uBAAuB,EAAEhB;AAC3B,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMwB,iBAAiB,GAAGlC,QAAQ,CAACmC,MAAM,CAAC;EAC/CC,GAAG,EAAEhB,iBAAiB;EACtBiB,OAAO,EACLrC,QAAQ,CAACsC,OAAO,IAAInB,kBAAkB,GAClCY,sBAAsB,GACtB/B,QAAQ,CAACsC,OAAO,IAAIpB,mBAAmB,GACvCY,uBAAuB,GACvBD,qBAAqB;EAC3BU,OAAO,EAAER;AACX,CAAC,CAAC;;AAEF;AACA;AACA;AACA,OAAO,MAAMS,eAAe,GAAGxC,QAAQ,CAACmC,MAAM,CAAC;EAC7CC,GAAG,EAAER,oBAAoB;EACzBW,OAAO,EAAEP;AACX,CAAC,CAAC"}

View File

@@ -0,0 +1,94 @@
import { Easing } from 'react-native';
/**
* Exact values from UINavigationController's animation configuration.
*/
export const TransitionIOSSpec = {
animation: 'spring',
config: {
stiffness: 1000,
damping: 500,
mass: 3,
overshootClamping: true,
restDisplacementThreshold: 10,
restSpeedThreshold: 10
}
};
/**
* Configuration for activity open animation from Android Nougat.
* See http://aosp.opersys.com/xref/android-7.1.2_r37/xref/frameworks/base/core/res/res/anim/activity_open_enter.xml
*/
export const FadeInFromBottomAndroidSpec = {
animation: 'timing',
config: {
duration: 350,
easing: Easing.out(Easing.poly(5))
}
};
/**
* Configuration for activity close animation from Android Nougat.
* See http://aosp.opersys.com/xref/android-7.1.2_r37/xref/frameworks/base/core/res/res/anim/activity_close_exit.xml
*/
export const FadeOutToBottomAndroidSpec = {
animation: 'timing',
config: {
duration: 150,
easing: Easing.in(Easing.linear)
}
};
/**
* Approximate configuration for activity open animation from Android Pie.
* See http://aosp.opersys.com/xref/android-9.0.0_r47/xref/frameworks/base/core/res/res/anim/activity_open_enter.xml
*/
export const RevealFromBottomAndroidSpec = {
animation: 'timing',
config: {
duration: 425,
// This is super rough approximation of the path used for the curve by android
// See http://aosp.opersys.com/xref/android-9.0.0_r47/xref/frameworks/base/core/res/res/interpolator/fast_out_extra_slow_in.xml
easing: Easing.bezier(0.35, 0.45, 0, 1)
}
};
/**
* Approximate configuration for activity open animation from Android Q.
* See http://aosp.opersys.com/xref/android-10.0.0_r2/xref/frameworks/base/core/res/res/anim/activity_open_enter.xml
*/
export const ScaleFromCenterAndroidSpec = {
animation: 'timing',
config: {
duration: 400,
// This is super rough approximation of the path used for the curve by android
// See http://aosp.opersys.com/xref/android-10.0.0_r2/xref/frameworks/base/core/res/res/interpolator/fast_out_extra_slow_in.xml
easing: Easing.bezier(0.35, 0.45, 0, 1)
}
};
/**
* Configuration for bottom sheet slide in animation from Material Design.
* See https://github.com/material-components/material-components-android/blob/fd3639092e1ffef9dc11bcedf79f32801d85e898/lib/java/com/google/android/material/bottomsheet/res/anim/mtrl_bottom_sheet_slide_in.xml
*/
export const BottomSheetSlideInSpec = {
animation: 'timing',
config: {
duration: 250,
// See https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/animation/AccelerateDecelerateInterpolator.java
easing: t => Math.cos((t + 1) * Math.PI) / 2.0 + 0.5
}
};
/**
* Configuration for bottom sheet slide out animation from Material Design.
* See https://github.com/material-components/material-components-android/blob/fd3639092e1ffef9dc11bcedf79f32801d85e898/lib/java/com/google/android/material/bottomsheet/res/anim/mtrl_bottom_sheet_slide_in.xml
*/
export const BottomSheetSlideOutSpec = {
animation: 'timing',
config: {
duration: 200,
// See https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/animation/AccelerateInterpolator.java
easing: t => t === 1.0 ? 1 : Math.pow(t, 2)
}
};
//# sourceMappingURL=TransitionSpecs.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["Easing","TransitionIOSSpec","animation","config","stiffness","damping","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold","FadeInFromBottomAndroidSpec","duration","easing","out","poly","FadeOutToBottomAndroidSpec","in","linear","RevealFromBottomAndroidSpec","bezier","ScaleFromCenterAndroidSpec","BottomSheetSlideInSpec","t","Math","cos","PI","BottomSheetSlideOutSpec","pow"],"sourceRoot":"../../../src","sources":["TransitionConfigs/TransitionSpecs.tsx"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AAIrC;AACA;AACA;AACA,OAAO,MAAMC,iBAAiC,GAAG;EAC/CC,SAAS,EAAE,QAAQ;EACnBC,MAAM,EAAE;IACNC,SAAS,EAAE,IAAI;IACfC,OAAO,EAAE,GAAG;IACZC,IAAI,EAAE,CAAC;IACPC,iBAAiB,EAAE,IAAI;IACvBC,yBAAyB,EAAE,EAAE;IAC7BC,kBAAkB,EAAE;EACtB;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMC,2BAA2C,GAAG;EACzDR,SAAS,EAAE,QAAQ;EACnBC,MAAM,EAAE;IACNQ,QAAQ,EAAE,GAAG;IACbC,MAAM,EAAEZ,MAAM,CAACa,GAAG,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CAACI,GAAG,CAACL,CAAC,EAAE,CAAC;EAC/C;AACF,CAAC"}

View File

@@ -0,0 +1,33 @@
import * as CardStyleInterpolators from './TransitionConfigs/CardStyleInterpolators';
import * as HeaderStyleInterpolators from './TransitionConfigs/HeaderStyleInterpolators';
import * as TransitionPresets from './TransitionConfigs/TransitionPresets';
import * as TransitionSpecs from './TransitionConfigs/TransitionSpecs';
/**
* Navigators
*/
export { default as createStackNavigator } from './navigators/createStackNavigator';
/**
* Views
*/
export { default as Header } from './views/Header/Header';
export { default as StackView } from './views/Stack/StackView';
/**
* Transition presets
*/
export { CardStyleInterpolators, HeaderStyleInterpolators, TransitionPresets, TransitionSpecs };
/**
* Utilities
*/
export { default as CardAnimationContext } from './utils/CardAnimationContext';
export { default as GestureHandlerRefContext } from './utils/GestureHandlerRefContext';
export { default as useCardAnimation } from './utils/useCardAnimation';
export { default as useGestureHandlerRef } from './utils/useGestureHandlerRef';
/**
* Types
*/
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["CardStyleInterpolators","HeaderStyleInterpolators","TransitionPresets","TransitionSpecs","default","createStackNavigator","Header","StackView","CardAnimationContext","GestureHandlerRefContext","useCardAnimation","useGestureHandlerRef"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,OAAO,KAAKA,sBAAsB,MAAM,4CAA4C;AACpF,OAAO,KAAKC,wBAAwB,MAAM,8CAA8C;AACxF,OAAO,KAAKC,iBAAiB,MAAM,uCAAuC;AAC1E,OAAO,KAAKC,eAAe,MAAM,qCAAqC;;AAEtE;AACA;AACA;AACA,SAASC,OAAO,IAAIC,oBAAoB,QAAQ,mCAAmC;;AAEnF;AACA;AACA;AACA,SAASD,OAAO,IAAIE,MAAM,QAAQ,uBAAuB;AACzD,SAASF,OAAO,IAAIG,SAAS,QAAQ,yBAAyB;;AAE9D;AACA;AACA;AACA,SACEP,sBAAsB,EACtBC,wBAAwB,EACxBC,iBAAiB,EACjBC,eAAe;;AAGjB;AACA;AACA;AACA,SAASC,OAAO,IAAII,oBAAoB,QAAQ,8BAA8B;AAC9E,SAASJ,OAAO,IAAIK,wBAAwB,QAAQ,kCAAkC;AACtF,SAASL,OAAO,IAAIM,gBAAgB,QAAQ,0BAA0B;AACtE,SAASN,OAAO,IAAIO,oBAAoB,QAAQ,8BAA8B;;AAE9E;AACA;AACA"}

View File

@@ -0,0 +1,74 @@
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import { createNavigatorFactory, StackActions, StackRouter, useNavigationBuilder } from '@react-navigation/native';
import * as React from 'react';
import warnOnce from 'warn-once';
import StackView from '../views/Stack/StackView';
function StackNavigator(_ref) {
let {
id,
initialRouteName,
children,
screenListeners,
screenOptions,
...rest
} = _ref;
// @ts-expect-error: mode is deprecated
const mode = rest.mode;
warnOnce(mode != null, `Stack Navigator: 'mode="${mode}"' is deprecated. Use 'presentation: "${mode}"' in 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/stack-navigator#presentation for more details.`);
// @ts-expect-error: headerMode='none' is deprecated
const headerMode = rest.headerMode;
warnOnce(headerMode === 'none', `Stack Navigator: 'headerMode="none"' is deprecated. Use 'headerShown: false' in 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/stack-navigator/#headershown for more details.`);
warnOnce(headerMode != null && headerMode !== 'none', `Stack Navigator: 'headerMode' is moved to 'options'. Moved it to 'screenOptions' to keep current behavior.\n\nSee https://reactnavigation.org/docs/stack-navigator/#headermode for more details.`);
// @ts-expect-error: headerMode='none' is deprecated
const keyboardHandlingEnabled = rest.keyboardHandlingEnabled;
warnOnce(keyboardHandlingEnabled !== undefined, `Stack Navigator: 'keyboardHandlingEnabled' is moved to 'options'. Moved it to 'screenOptions' to keep current behavior.\n\nSee https://reactnavigation.org/docs/stack-navigator/#keyboardhandlingenabled for more details.`);
const defaultScreenOptions = {
presentation: mode,
headerShown: headerMode ? headerMode !== 'none' : true,
headerMode: headerMode && headerMode !== 'none' ? headerMode : undefined,
keyboardHandlingEnabled
};
const {
state,
descriptors,
navigation,
NavigationContent
} = useNavigationBuilder(StackRouter, {
id,
initialRouteName,
children,
screenListeners,
screenOptions,
defaultScreenOptions
});
React.useEffect(() => {
var _navigation$addListen;
return (// @ts-expect-error: there may not be a tab navigator in parent
(_navigation$addListen = navigation.addListener) === null || _navigation$addListen === void 0 ? void 0 : _navigation$addListen.call(navigation, 'tabPress', e => {
const isFocused = navigation.isFocused();
// Run the operation in the next frame so we're sure all listeners have been run
// This is necessary to know if preventDefault() has been called
requestAnimationFrame(() => {
if (state.index > 0 && isFocused && !e.defaultPrevented) {
// When user taps on already focused tab and we're inside the tab,
// reset the stack to replicate native behaviour
navigation.dispatch({
...StackActions.popToTop(),
target: state.key
});
}
});
})
);
}, [navigation, state.index, state.key]);
return /*#__PURE__*/React.createElement(NavigationContent, null, /*#__PURE__*/React.createElement(StackView, _extends({}, rest, {
state: state,
descriptors: descriptors,
navigation: navigation
})));
}
export default createNavigatorFactory(StackNavigator);
//# sourceMappingURL=createStackNavigator.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["createNavigatorFactory","StackActions","StackRouter","useNavigationBuilder","React","warnOnce","StackView","StackNavigator","id","initialRouteName","children","screenListeners","screenOptions","rest","mode","headerMode","keyboardHandlingEnabled","undefined","defaultScreenOptions","presentation","headerShown","state","descriptors","navigation","NavigationContent","useEffect","addListener","e","isFocused","requestAnimationFrame","index","defaultPrevented","dispatch","popToTop","target","key"],"sourceRoot":"../../../src","sources":["navigators/createStackNavigator.tsx"],"mappings":";AAAA,SACEA,sBAAsB,EAKtBC,YAAY,EAEZC,WAAW,EAEXC,oBAAoB,QACf,0BAA0B;AACjC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,QAAQ,MAAM,WAAW;AAQhC,OAAOC,SAAS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1B,IACER,KAAK,CAACS,KAAK,GAAG,CAAC,IACfF,SAAS,IACT,CAAED,CAAC,CAA2CI,gBAAgB,EAC9D;YACA;YACA;YACAR,UAAU,CAACS,QAAQ,CAAC;cAClB,GAAG/B,YAAY,CAACgC,QAAQ,EAAE;cAC1BC,MAAM,EAAEb,KAAK,CAACc;YAChB,CAAC,CAAC;UACJ;QACF,CAAC,CAAC;MACJ,CAAC;IAAC;EAAA,GACJ,CAACZ,UAAU,EAAEF,KAAK,CAACS,KAAK,EAAET,KAAK,CAACc,GAAG,CAAC,CACrC;EAED,oBACE,oBAAC,iBAAiB,qBAChB,oBAAC,SAAS,eACJtB,IAAI;IACR,KAAK,EAAEQ,KAAM;IACb,WAAW,EAAEC,WAAY;IACzB,UAAU,EAAEC;EAAW,GACvB,CACgB;AAExB;AAEA,eAAevB,sBAAsB,CAKnCO,cAAc,CAAC"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.tsx"],"mappings":""}

View File

@@ -0,0 +1,3 @@
import * as React from 'react';
export default /*#__PURE__*/React.createContext(undefined);
//# sourceMappingURL=CardAnimationContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","createContext","undefined"],"sourceRoot":"../../../src","sources":["utils/CardAnimationContext.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAI9B,4BAAeA,KAAK,CAACC,aAAa,CAChCC,SAAS,CACV"}

View File

@@ -0,0 +1,3 @@
import * as React from 'react';
export default /*#__PURE__*/React.createContext(null);
//# sourceMappingURL=GestureHandlerRefContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","createContext"],"sourceRoot":"../../../src","sources":["utils/GestureHandlerRefContext.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,4BAAeA,KAAK,CAACC,aAAa,CAExB,IAAI,CAAC"}

View File

@@ -0,0 +1,4 @@
import * as React from 'react';
const ModalPresentationContext = /*#__PURE__*/React.createContext(false);
export default ModalPresentationContext;
//# sourceMappingURL=ModalPresentationContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["React","ModalPresentationContext","createContext"],"sourceRoot":"../../../src","sources":["utils/ModalPresentationContext.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,MAAMC,wBAAwB,gBAAGD,KAAK,CAACE,aAAa,CAAC,KAAK,CAAC;AAE3D,eAAeD,wBAAwB"}

View File

@@ -0,0 +1,26 @@
import { Animated } from 'react-native';
const {
add,
multiply
} = Animated;
/**
* Use an Animated Node based on a condition. Similar to Reanimated's `cond`.
*
* @param condition Animated Node representing the condition, must be 0 or 1, 1 means `true`, 0 means `false`
* @param main Animated Node to use if the condition is `true`
* @param fallback Animated Node to use if the condition is `false`
*/
export default function conditional(condition, main, fallback) {
// To implement this behavior, we multiply the main node with the condition.
// So if condition is 0, result will be 0, and if condition is 1, result will be main node.
// Then we multiple reverse of the condition (0 if condition is 1) with the fallback.
// So if condition is 0, result will be fallback node, and if condition is 1, result will be 0,
// This way, one of them will always be 0, and other one will be the value we need.
// In the end we add them both together, 0 + value we need = value we need
return add(multiply(condition, main), multiply(condition.interpolate({
inputRange: [0, 1],
outputRange: [1, 0]
}), fallback));
}
//# sourceMappingURL=conditional.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["Animated","add","multiply","conditional","condition","main","fallback","interpolate","inputRange","outputRange"],"sourceRoot":"../../../src","sources":["utils/conditional.tsx"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,MAAM;EAAEC,GAAG;EAAEC;AAAS,CAAC,GAAGF,QAAQ;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASG,WAAW,CACjCC,SAAgD,EAChDC,IAA4C,EAC5CC,QAAgD,EAChD;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAOL,GAAG,CACRC,QAAQ,CAACE,SAAS,EAAEC,IAAI,CAAC,EACzBH,QAAQ,CACNE,SAAS,CAACG,WAAW,CAAC;IACpBC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClBC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC;EACpB,CAAC,CAAC,EACFH,QAAQ,CACT,CACF;AACH"}

View File

@@ -0,0 +1,16 @@
export default function debounce(func, duration) {
let timeout;
return function () {
if (!timeout) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
// eslint-disable-next-line babel/no-invalid-this
func.apply(this, args);
timeout = setTimeout(() => {
timeout = undefined;
}, duration);
}
};
}
//# sourceMappingURL=debounce.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["debounce","func","duration","timeout","args","apply","setTimeout","undefined"],"sourceRoot":"../../../src","sources":["utils/debounce.tsx"],"mappings":"AAAA,eAAe,SAASA,QAAQ,CAC9BC,IAAO,EACPC,QAAgB,EACb;EACH,IAAIC,OAA4C;EAEhD,OAAO,YAA8B;IACnC,IAAI,CAACA,OAAO,EAAE;MAAA,kCADeC,IAAI;QAAJA,IAAI;MAAA;MAE/B;MACAH,IAAI,CAACI,KAAK,CAAC,IAAI,EAAED,IAAI,CAAC;MAEtBD,OAAO,GAAGG,UAAU,CAAC,MAAM;QACzBH,OAAO,GAAGI,SAAS;MACrB,CAAC,EAAEL,QAAQ,CAAC;IACd;EACF,CAAC;AACH"}

View File

@@ -0,0 +1,9 @@
export default function findLastIndex(array, callback) {
for (var i = array.length - 1; i >= 0; i--) {
if (callback(array[i])) {
return i;
}
}
return -1;
}
//# sourceMappingURL=findLastIndex.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["findLastIndex","array","callback","i","length"],"sourceRoot":"../../../src","sources":["utils/findLastIndex.tsx"],"mappings":"AAAA,eAAe,SAASA,aAAa,CACnCC,KAAU,EACVC,QAA+B,EAC/B;EACA,KAAK,IAAIC,CAAC,GAAGF,KAAK,CAACG,MAAM,GAAG,CAAC,EAAED,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC1C,IAAID,QAAQ,CAACD,KAAK,CAACE,CAAC,CAAC,CAAC,EAAE;MACtB,OAAOA,CAAC;IACV;EACF;EAEA,OAAO,CAAC,CAAC;AACX"}

View File

@@ -0,0 +1,13 @@
import getInvertedMultiplier from './getInvertedMultiplier';
export default function getDistanceForDirection(layout, gestureDirection) {
const multiplier = getInvertedMultiplier(gestureDirection);
switch (gestureDirection) {
case 'vertical':
case 'vertical-inverted':
return layout.height * multiplier;
case 'horizontal':
case 'horizontal-inverted':
return layout.width * multiplier;
}
}
//# sourceMappingURL=getDistanceForDirection.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["getInvertedMultiplier","getDistanceForDirection","layout","gestureDirection","multiplier","height","width"],"sourceRoot":"../../../src","sources":["utils/getDistanceForDirection.tsx"],"mappings":"AACA,OAAOA,qBAAqB,MAAM,yBAAyB;AAE3D,eAAe,SAASC,uBAAuB,CAC7CC,MAAc,EACdC,gBAAkC,EAC1B;EACR,MAAMC,UAAU,GAAGJ,qBAAqB,CAACG,gBAAgB,CAAC;EAE1D,QAAQA,gBAAgB;IACtB,KAAK,UAAU;IACf,KAAK,mBAAmB;MACtB,OAAOD,MAAM,CAACG,MAAM,GAAGD,UAAU;IACnC,KAAK,YAAY;IACjB,KAAK,qBAAqB;MACxB,OAAOF,MAAM,CAACI,KAAK,GAAGF,UAAU;EAAC;AAEvC"}

View File

@@ -0,0 +1,14 @@
import { I18nManager } from 'react-native';
export default function getInvertedMultiplier(gestureDirection) {
switch (gestureDirection) {
case 'vertical':
return 1;
case 'vertical-inverted':
return -1;
case 'horizontal':
return I18nManager.getConstants().isRTL ? -1 : 1;
case 'horizontal-inverted':
return I18nManager.getConstants().isRTL ? 1 : -1;
}
}
//# sourceMappingURL=getInvertedMultiplier.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["I18nManager","getInvertedMultiplier","gestureDirection","getConstants","isRTL"],"sourceRoot":"../../../src","sources":["utils/getInvertedMultiplier.tsx"],"mappings":"AAAA,SAASA,WAAW,QAAQ,cAAc;AAI1C,eAAe,SAASC,qBAAqB,CAC3CC,gBAAkC,EAC1B;EACR,QAAQA,gBAAgB;IACtB,KAAK,UAAU;MACb,OAAO,CAAC;IACV,KAAK,mBAAmB;MACtB,OAAO,CAAC,CAAC;IACX,KAAK,YAAY;MACf,OAAOF,WAAW,CAACG,YAAY,EAAE,CAACC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC;IAClD,KAAK,qBAAqB;MACxB,OAAOJ,WAAW,CAACG,YAAY,EAAE,CAACC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;EAAC;AAEvD"}

View File

@@ -0,0 +1,30 @@
export default function memoize(callback) {
let previous;
let result;
return function () {
let hasChanged = false;
for (var _len = arguments.length, dependencies = new Array(_len), _key = 0; _key < _len; _key++) {
dependencies[_key] = arguments[_key];
}
if (previous) {
if (previous.length !== dependencies.length) {
hasChanged = true;
} else {
for (let i = 0; i < previous.length; i++) {
if (previous[i] !== dependencies[i]) {
hasChanged = true;
break;
}
}
}
} else {
hasChanged = true;
}
previous = dependencies;
if (hasChanged || result === undefined) {
result = callback(...dependencies);
}
return result;
};
}
//# sourceMappingURL=memoize.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["memoize","callback","previous","result","hasChanged","dependencies","length","i","undefined"],"sourceRoot":"../../../src","sources":["utils/memoize.tsx"],"mappings":"AAAA,eAAe,SAASA,OAAO,CAC7BC,QAAmC,EACnC;EACA,IAAIC,QAA0B;EAC9B,IAAIC,MAA0B;EAE9B,OAAO,YAAmC;IACxC,IAAIC,UAAU,GAAG,KAAK;IAAC,kCADdC,YAAY;MAAZA,YAAY;IAAA;IAGrB,IAAIH,QAAQ,EAAE;MACZ,IAAIA,QAAQ,CAACI,MAAM,KAAKD,YAAY,CAACC,MAAM,EAAE;QAC3CF,UAAU,GAAG,IAAI;MACnB,CAAC,MAAM;QACL,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,QAAQ,CAACI,MAAM,EAAEC,CAAC,EAAE,EAAE;UACxC,IAAIL,QAAQ,CAACK,CAAC,CAAC,KAAKF,YAAY,CAACE,CAAC,CAAC,EAAE;YACnCH,UAAU,GAAG,IAAI;YACjB;UACF;QACF;MACF;IACF,CAAC,MAAM;MACLA,UAAU,GAAG,IAAI;IACnB;IAEAF,QAAQ,GAAGG,YAAY;IAEvB,IAAID,UAAU,IAAID,MAAM,KAAKK,SAAS,EAAE;MACtCL,MAAM,GAAGF,QAAQ,CAAC,GAAGI,YAAY,CAAC;IACpC;IAEA,OAAOF,MAAM;EACf,CAAC;AACH"}

Some files were not shown because too many files have changed in this diff Show More