188 lines
10 KiB
JavaScript
188 lines
10 KiB
JavaScript
/* Metro module 6416; source: unknown; dependencies: [31, 6413] */
|
|
import * as ReactModule from './module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as UseUnmountAwareModule from './module-06413-useUnmountAware.js'; /* Metro dependency 6413 */
|
|
|
|
function _fun50335(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#50335, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:6, offset: 0x0121694f, size: 113 bytes, params: 8, frame: 18
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
exports.useBoundDetection = useBoundDetection;
|
|
function useBoundDetection(a0, a1) { // fn#50336, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:179, offset: 0x012169c0, size: 408 bytes, params: 3, frame: 23
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const env0_2 = useRef(false);
|
|
const env0_3 = useRef(false);
|
|
const env0_4 = useRef(false);
|
|
const Date = global.Date;
|
|
const env0_5 = useRef(Date.now());
|
|
const data = a0.props.data;
|
|
const useUnmountAwareAnimationFrame = UseUnmountAwareModule.useUnmountAwareAnimationFrame;
|
|
const requestAnimationFrame = Reflect.apply(useUnmountAwareAnimationFrame, UseUnmountAwareModule, []).requestAnimationFrame;
|
|
const hasLayout2 = a0.hasLayout();
|
|
const value2 = 0;
|
|
const height = hasLayout2 ? a0.getWindowSize().height : value2;
|
|
const height2 = a0.hasLayout() ? a0.getChildContainerDimensions().height : value2;
|
|
const width = a0.hasLayout() ? a0.getWindowSize().width : value2;
|
|
const width2 = a0.hasLayout() ? a0.getChildContainerDimensions().width : value2;
|
|
const value3 = useCallback(_fun50337, [a0]);
|
|
const value4 = useCallback(_fun50338, [requestAnimationFrame, a1, a0]);
|
|
useMemo(_fun50340, [data]);
|
|
useEffect(_fun50341, [data, value4, height, width]);
|
|
useEffect(_fun50342, [height2, width2, a0.firstItemOffset, value4]);
|
|
return {checkBounds: value3};
|
|
function _fun50337() { // fn#50337, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:537, offset: 0x01216b58, size: 468 bytes, params: 1, frame: 25
|
|
var r3;
|
|
var absoluteLastScrollOffset;
|
|
var childContainerDimensions;
|
|
var windowSize;
|
|
var value7;
|
|
var value8;
|
|
var value12;
|
|
var value15;
|
|
let binding = env0_5;
|
|
const Date = global.Date;
|
|
binding.current = Date.now();
|
|
const {onEndReached, onStartReached, maintainVisibleContentPosition, horizontal, onEndReachedThreshold,
|
|
onStartReachedThreshold} = env0_0.props;
|
|
const value2 = undefined;
|
|
const r1 = (maintainVisibleContentPosition == null ? value2 : maintainVisibleContentPosition.autoscrollToBottomThreshold) ?? -1;
|
|
if (onEndReached) {
|
|
binding = env0_0;
|
|
if (binding.getIsFirstLayoutComplete()) {
|
|
binding = env0_0;
|
|
absoluteLastScrollOffset = binding.getAbsoluteLastScrollOffset();
|
|
childContainerDimensions = binding.getChildContainerDimensions();
|
|
windowSize = binding.getWindowSize();
|
|
value7 = horizontal === true;
|
|
r3 = value7 ? windowSize.width : windowSize.height;
|
|
value8 = (value7 ? childContainerDimensions.width : childContainerDimensions.height) + env0_0.firstItemOffset;
|
|
if (onEndReached) {
|
|
value12 = global.Math.ceil(absoluteLastScrollOffset + r3) >= value8 - (onEndReachedThreshold ?? 0.5) * r3;
|
|
if (value12 && !env0_2.current) {
|
|
env0_2.current = true;
|
|
onEndReached();
|
|
}
|
|
env0_2.current = value12;
|
|
}
|
|
if (onStartReached) {
|
|
value15 = absoluteLastScrollOffset <= (onStartReachedThreshold ?? 0.2) * r3;
|
|
if (value15 && !env0_3.current) {
|
|
env0_3.current = true;
|
|
onStartReached();
|
|
}
|
|
env0_3.current = value15;
|
|
}
|
|
if (!value7) {
|
|
if (r1 >= 0) {
|
|
env0_4.current = !!(global.Math.ceil(absoluteLastScrollOffset + r3) >= value8 - r1 * r3);
|
|
}
|
|
}
|
|
}
|
|
} else if (onStartReached) {
|
|
binding = env0_0;
|
|
if (binding.getIsFirstLayoutComplete()) {
|
|
binding = env0_0;
|
|
absoluteLastScrollOffset = binding.getAbsoluteLastScrollOffset();
|
|
childContainerDimensions = binding.getChildContainerDimensions();
|
|
windowSize = binding.getWindowSize();
|
|
value7 = horizontal === true;
|
|
r3 = value7 ? windowSize.width : windowSize.height;
|
|
value8 = (value7 ? childContainerDimensions.width : childContainerDimensions.height) + env0_0.firstItemOffset;
|
|
if (onEndReached) {
|
|
value12 = global.Math.ceil(absoluteLastScrollOffset + r3) >= value8 - (onEndReachedThreshold ?? 0.5) * r3;
|
|
if (value12 && !env0_2.current) {
|
|
env0_2.current = true;
|
|
onEndReached();
|
|
}
|
|
env0_2.current = value12;
|
|
}
|
|
if (onStartReached) {
|
|
value15 = absoluteLastScrollOffset <= (onStartReachedThreshold ?? 0.2) * r3;
|
|
if (value15 && !env0_3.current) {
|
|
env0_3.current = true;
|
|
onStartReached();
|
|
}
|
|
env0_3.current = value15;
|
|
}
|
|
if (!value7) {
|
|
if (r1 >= 0) {
|
|
env0_4.current = !!(global.Math.ceil(absoluteLastScrollOffset + r3) >= value8 - r1 * r3);
|
|
}
|
|
}
|
|
}
|
|
} else if (!(r1 < 0)) {
|
|
binding = env0_0;
|
|
if (binding.getIsFirstLayoutComplete()) {
|
|
binding = env0_0;
|
|
absoluteLastScrollOffset = binding.getAbsoluteLastScrollOffset();
|
|
childContainerDimensions = binding.getChildContainerDimensions();
|
|
windowSize = binding.getWindowSize();
|
|
value7 = horizontal === true;
|
|
r3 = value7 ? windowSize.width : windowSize.height;
|
|
value8 = (value7 ? childContainerDimensions.width : childContainerDimensions.height) + env0_0.firstItemOffset;
|
|
if (onEndReached) {
|
|
value12 = global.Math.ceil(absoluteLastScrollOffset + r3) >= value8 - (onEndReachedThreshold ?? 0.5) * r3;
|
|
if (value12 && !env0_2.current) {
|
|
env0_2.current = true;
|
|
onEndReached();
|
|
}
|
|
env0_2.current = value12;
|
|
}
|
|
if (onStartReached) {
|
|
value15 = absoluteLastScrollOffset <= (onStartReachedThreshold ?? 0.2) * r3;
|
|
if (value15 && !env0_3.current) {
|
|
env0_3.current = true;
|
|
onStartReached();
|
|
}
|
|
env0_3.current = value15;
|
|
}
|
|
if (!value7) {
|
|
if (r1 >= 0) {
|
|
env0_4.current = !!(global.Math.ceil(absoluteLastScrollOffset + r3) >= value8 - r1 * r3);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function _fun50338() { // fn#50338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:1251, offset: 0x01216d2c, size: 49 bytes, params: 1, frame: 11
|
|
if (env0_4.current) {
|
|
env0_4.current = false;
|
|
requestAnimationFrame(_fun50339);
|
|
}
|
|
function _fun50339() { // fn#50339, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:1290, offset: 0x01216d5d, size: 82 bytes, params: 1, frame: 14
|
|
const maintainVisibleContentPosition = env1_0.props.maintainVisibleContentPosition;
|
|
const value2 = undefined;
|
|
const animateAutoScrollToBottom = maintainVisibleContentPosition == null ? value2 : maintainVisibleContentPosition.animateAutoScrollToBottom;
|
|
const r4 = animateAutoScrollToBottom == null || animateAutoScrollToBottom;
|
|
const current = require.current;
|
|
if (current != null) {
|
|
current.scrollToEnd({animated: r4});
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
}
|
|
|
|
function _fun50340() { // fn#50340, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:1484, offset: 0x01216daf, size: 19 bytes, params: 1, frame: 2
|
|
env0_2.current = false;
|
|
}
|
|
|
|
function _fun50341() { // fn#50341, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:1518, offset: 0x01216dc2, size: 15 bytes, params: 1, frame: 9
|
|
env0_7();
|
|
}
|
|
|
|
function _fun50342() { // fn#50342, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6594:1549, offset: 0x01216dd1, size: 54 bytes, params: 1, frame: 10
|
|
const Date = global.Date;
|
|
if (Date.now() - env0_5.current >= 100) {
|
|
env0_7();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun50335, 6416, [31, 6413]) /* metro module 6416, dependencies: [31, 6413] */;
|