Files
discord-decomp/sources/by-id/module-01841-useExtraContentPadding.js
T
2026-07-28 01:06:53 +03:00

166 lines
11 KiB
JavaScript

/* Metro module 1841; source: unknown; dependencies: [31, 27, 1842, 1610, 1840] */
import * as ReactNativeModule from './module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from './module-00031-React.js'; /* Metro dependency 31 */
import * as IS_FABRICModule from './module-01842-IS_FABRIC.js'; /* Metro dependency 1842 */
function _fun19969(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#19969, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1968:6, offset: 0x00ebb1ae, size: 156 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
object = {code: 'function pnpm_indexTs1(target){const{contentOffsetY,IS_FABRIC,Platform,scrollTo,scrollViewRef}=this.__closure;if(contentOffsetY&&IS_FABRIC){contentOffsetY.value=target;}else if(Platform.OS==="android"){requestAnimationFrame(function(){scrollTo(scrollViewRef,0,target,false);});}else{scrollTo(scrollViewRef,0,target,false);}}'};
object = {code: 'function pnpm_indexTs2(){const{extraContentPadding}=this.__closure;return extraContentPadding.value;}'};
object = {code: 'function pnpm_indexTs3(current,previous){const{freeze,blankSpace,keyboardPadding,isScrollAtEnd,scroll,layout,size,inverted,keyboardLiftBehavior,shouldShiftContent,scrollToTarget}=this.__closure;if(freeze.value||previous===null){return;}const rawDelta=current-previous;if(rawDelta===0){return;}const previousTotal=Math.max(blankSpace.value,keyboardPadding.value+previous);const currentTotal=Math.max(blankSpace.value,keyboardPadding.value+current);const effectiveDelta=currentTotal-previousTotal;if(effectiveDelta===0){return;}const atEnd=isScrollAtEnd(scroll.value,layout.value.height,size.value.height,inverted);if(keyboardLiftBehavior==="persistent"&&effectiveDelta<0&&!atEnd){return;}if(!shouldShiftContent(keyboardLiftBehavior,atEnd)){return;}if(inverted){const target=Math.max(scroll.value-effectiveDelta,-currentTotal);scrollToTarget(target);}else{const maxScroll=Math.max(size.value.height-layout.value.height+currentTotal,0);const target=Math.min(scroll.value+effectiveDelta,maxScroll);scrollToTarget(target);}}'};
exports.useExtraContentPadding = useExtraContentPadding;
function useExtraContentPadding({scrollViewRef, extraContentPadding, keyboardPadding, blankSpace, scroll, layout, size, contentOffsetY, inverted, keyboardLiftBehavior, freeze}) { // fn#19970, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1968:1642, offset: 0x00ebb24a, size: 465 bytes, params: 2, frame: 31
const scroll2 = scroll;
const layout2 = layout;
const size2 = size;
let closure = useExtraContentPaddingPnpm_indexTs1;
let object = {contentOffsetY: contentOffsetY};
const IS_FABRIC = (IS_FABRICModule).IS_FABRIC;
object.IS_FABRIC = IS_FABRIC;
object.Platform = Platform;
object.scrollTo = (require(1610) /* metro dependency 1610 */).scrollTo;
object.scrollViewRef = scrollViewRef;
closure.__closure = object;
closure.__workletHash = 2925167321956;
closure.__initData = scroll2;
const value2 = useCallback(closure, [scrollViewRef, contentOffsetY]);
const moduleValue = require(1610) /* metro dependency 1610 */;
const useAnimatedReaction = moduleValue.useAnimatedReaction;
closure = function() {
return extraContentPadding.value;
};
closure.__closure = {extraContentPadding: extraContentPadding};
closure.__workletHash = 6627638143453;
closure.__initData = layout2;
const pnpm_indexTs32 = pnpm_indexTs3;
object = {freeze: freeze, blankSpace: blankSpace, keyboardPadding: keyboardPadding};
object.isScrollAtEnd = (require(1840) /* metro dependency 1840 */).isScrollAtEnd;
object.scroll = scroll;
object.layout = layout;
object.size = size;
object.inverted = inverted;
object.keyboardLiftBehavior = keyboardLiftBehavior;
object.shouldShiftContent = (require(1840) /* metro dependency 1840 */).shouldShiftContent;
object.scrollToTarget = value2;
pnpm_indexTs32.__closure = object;
pnpm_indexTs32.__workletHash = 14660760767987;
pnpm_indexTs32.__initData = size2;
Reflect.apply(useAnimatedReaction, moduleValue, [closure, pnpm_indexTs32, [inverted, keyboardLiftBehavior]]);
function useExtraContentPaddingPnpm_indexTs1(a0) { // fn#19971, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1968:1871, owner: useExtraContentPadding.pnpm_indexTs1, offset: 0x00ebb41b, size: 89 bytes, params: 2, frame: 14
var environment;
var value2;
const env0_0 = a0;
if (contentOffsetY) {
value2 = environment.__proto__;
if ((require(1842) /* metro dependency 1842 */).IS_FABRIC) {
contentOffsetY.value = a0;
} else {
global.requestAnimationFrame(_fun19972);
}
} else {
global.requestAnimationFrame(_fun19972);
}
function _fun19972() { // fn#19972, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1968:1951, offset: 0x00ebb474, size: 58 bytes, params: 1, frame: 18
let value = environment.__proto__.__proto__;
value = require(1610) /* metro dependency 1610 */;
value.scrollTo(scrollViewRef, 0, env0_0, false);
}
}
function pnpm_indexTs3(a0, a1) { // fn#19974, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1968:2319, owner: useExtraContentPadding.pnpm_indexTs3, offset: 0x00ebb4bc, size: 407 bytes, params: 3, frame: 25
var Math;
var max;
var blankSpaceBinding;
var value3;
var keyboardPaddingBinding;
var value5;
var value8;
var value9;
var value10;
var moduleValue;
var invertedBinding;
var isScrollAtEnd2;
var moduleValue2;
var value16;
if (!freeze.value) {
if (a1 !== null) {
if (a0 - a1 != 0) {
Math = global.Math;
max = Math.max;
blankSpaceBinding = blankSpace;
value3 = blankSpaceBinding.value;
keyboardPaddingBinding = keyboardPadding;
value5 = Reflect.apply(max, Math, [value3, keyboardPaddingBinding.value + a1]);
Math = global.Math;
value8 = Math.max(blankSpaceBinding.value, keyboardPaddingBinding.value + a0);
value9 = value8 - value5;
if (value9 !== 0) {
value10 = environment.__proto__;
moduleValue = require(1840) /* metro dependency 1840 */;
isScrollAtEnd2 = moduleValue.isScrollAtEnd(scroll.value, layout.value.height, size.value.height,
inverted);
if (keyboardLiftBehavior !== 'persistent') {
moduleValue2 = require(1840) /* metro dependency 1840 */;
if (moduleValue2.shouldShiftContent(keyboardLiftBehavior, isScrollAtEnd2)) {
invertedBinding = inverted;
Math = global.Math;
max = Math.max;
if (invertedBinding) {
env0_11(Reflect.apply(max, Math, [scroll.value - value9, -value8]));
} else {
value16 = Reflect.apply(max, Math, [size.value.height - layout.value.height + value8,
0]);
Math = global.Math;
env0_11(Math.min(scroll.value + value9, value16));
}
}
} else if (value9 < 0) {
if (isScrollAtEnd2) {
moduleValue2 = require(1840) /* metro dependency 1840 */;
if (moduleValue2.shouldShiftContent(keyboardLiftBehavior, isScrollAtEnd2)) {
invertedBinding = inverted;
Math = global.Math;
max = Math.max;
if (invertedBinding) {
env0_11(Reflect.apply(max, Math, [scroll.value - value9, -value8]));
} else {
value16 = Reflect.apply(max, Math,
[size.value.height - layout.value.height + value8,
0]);
Math = global.Math;
env0_11(Math.min(scroll.value + value9, value16));
}
}
}
} else {
moduleValue2 = require(1840) /* metro dependency 1840 */;
if (moduleValue2.shouldShiftContent(keyboardLiftBehavior, isScrollAtEnd2)) {
invertedBinding = inverted;
Math = global.Math;
max = Math.max;
if (invertedBinding) {
env0_11(Reflect.apply(max, Math, [scroll.value - value9, -value8]));
} else {
value16 = Reflect.apply(max, Math, [size.value.height - layout.value.height + value8,
0]);
Math = global.Math;
env0_11(Math.min(scroll.value + value9, value16));
}
}
}
}
}
}
}
}
}
}
global.__d(_fun19969, 1841, [31, 27, 1842, 1610,
1840]) /* metro module 1841, dependencies: [31, 27, 1842, 1610, 1840] */;