192 lines
8.6 KiB
React
192 lines
8.6 KiB
React
/* Metro module 6421; source: unknown; dependencies: [6386, 6365, 31, 33, 6418, 6422] */
|
|
function _fun50356(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#50356, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6599:6, offset: 0x012173ba, size: 197 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(6386) /* metro dependency 6386 */;
|
|
const env0_3 = importDefault(6365) /* metro dependency 6365 */;
|
|
const value = require(31) /* metro dependency 31 */;
|
|
const env0_4 = value.useRef;
|
|
const env0_5 = value.useState;
|
|
const env0_6 = value.useMemo;
|
|
const env0_7 = value.useImperativeHandle;
|
|
const env0_8 = value.useCallback;
|
|
const env0_9 = value.useEffect;
|
|
importDefault(31) /* metro dependency 31 */;
|
|
const env0_10 = (require(33) /* metro dependency 33 */).jsx;
|
|
exports.StickyHeaders = StickyHeaders;
|
|
}
|
|
|
|
function StickyHeaders({stickyHeaderIndices, stickyHeaderOffset, renderItem, stickyHeaderRef, recyclerViewManager, scrollY, data, extraData, onChangeStickyIndex}) { // fn#50357, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6599:256, offset: 0x0121747f, size: 505 bytes, params: 2, frame: 29
|
|
const env0_3 = recyclerViewManager;
|
|
const Number = global.Number;
|
|
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
|
const [property, env0_8] = env0_3(useState({currentStickyIndex: -1, pushStartsAt: MAX_SAFE_INTEGER}), 2);
|
|
const currentStickyIndex = property.currentStickyIndex;
|
|
const pushStartsAt = property.pushStartsAt;
|
|
const value4 = useMemo(_fun50358, [stickyHeaderIndices]);
|
|
const value8 = useCallback(_fun50360,
|
|
[value4.length === 0 || recyclerViewManager.getDataLength() <= value4[value4.length - 1], recyclerViewManager,
|
|
value4, currentStickyIndex, pushStartsAt, onChangeStickyIndex, stickyHeaderOffset]);
|
|
useEffect(_fun50361, [value8]);
|
|
useImperativeHandle(stickyHeaderRef, function() {
|
|
return {reportScrollEvent: _fun50363};
|
|
}, [value8]);
|
|
const Map = global.Map;
|
|
const value9 = Object.create(Map.prototype, {constructor: {value: Map}});
|
|
const map = new Map();
|
|
const current = useRef(map instanceof Object ? map : value9).current;
|
|
const value = useMemo(_fun50364, [recyclerViewManager, currentStickyIndex, scrollY, pushStartsAt,
|
|
stickyHeaderOffset]);
|
|
return useMemo(_fun50365, [value.translateY, value.opacity, currentStickyIndex, data, renderItem, current,
|
|
extraData, stickyHeaderOffset]);
|
|
}
|
|
|
|
function _fun50358() { // fn#50358, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6599:585, offset: 0x01217678, size: 41 bytes, params: 1, frame: 11
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
return env1_2(stickyHeaderIndices).sort(function(a0, a1) {
|
|
return a0 - a1;
|
|
});
|
|
}
|
|
|
|
function _fun50360() { // fn#50360, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6599:703, offset: 0x012176a1, size: 428 bytes, params: 1, frame: 24
|
|
var r4;
|
|
var r7;
|
|
var r10;
|
|
var r12;
|
|
var r6;
|
|
var r2;
|
|
var y;
|
|
var r3;
|
|
var recyclerViewManagerBinding;
|
|
var lastScrollOffset;
|
|
var binding;
|
|
var value3;
|
|
var value4;
|
|
var value5;
|
|
var value6;
|
|
var Math;
|
|
var value7;
|
|
var property;
|
|
var getLayout;
|
|
var value8;
|
|
var value9;
|
|
var value15;
|
|
if (!env0_12) {
|
|
lastScrollOffset = recyclerViewManager.getLastScrollOffset();
|
|
binding = env0_11;
|
|
value3 = lastScrollOffset + stickyHeaderOffset;
|
|
value4 = binding.length - 1;
|
|
value5 = -1;
|
|
value6 = 0;
|
|
if (value6 <= value4) {
|
|
r4 = value5;
|
|
r7 = value6;
|
|
r10 = value4;
|
|
while (true) {
|
|
Math = global.Math;
|
|
value7 = Math.floor((r7 + r10) / 2);
|
|
property = binding[value7];
|
|
recyclerViewManagerBinding = recyclerViewManager;
|
|
getLayout = recyclerViewManagerBinding.getLayout;
|
|
y = Reflect.apply(getLayout, recyclerViewManagerBinding, [property]).y;
|
|
if (y <= value3) {
|
|
value9 = value7 + 1;
|
|
r4 = value7;
|
|
r7 = value9;
|
|
r12 = r10;
|
|
} else {
|
|
value8 = value7 - 1;
|
|
r12 = value8;
|
|
}
|
|
if (r7 <= r12) {
|
|
r10 = r12;
|
|
continue;
|
|
}
|
|
r6 = r4;
|
|
break;
|
|
}
|
|
} else {
|
|
r6 = value5;
|
|
}
|
|
property = binding[r6];
|
|
r2 = property ?? value5;
|
|
binding = env0_11;
|
|
property = binding[r6 + 1];
|
|
r7 = property ?? value5;
|
|
recyclerViewManagerBinding = recyclerViewManager;
|
|
r7 = r7 > recyclerViewManagerBinding.getEngagedIndices().endIndex ? value5 : r7;
|
|
r3 = value5 === r7 ? global.Number.MAX_SAFE_INTEGER : (recyclerViewManager.tryGetLayout(r7)?.y ?? value6) + recyclerViewManager.firstItemOffset;
|
|
value15 = r3 - (recyclerViewManager.tryGetLayout(r2)?.height ?? value6);
|
|
r3 = r2 === currentStickyIndex && value15 === pushStartsAt;
|
|
if (!r3) {
|
|
env0_8({currentStickyIndex: r2, pushStartsAt: value15 - stickyHeaderOffset});
|
|
}
|
|
if (r2 !== currentStickyIndex) {
|
|
if (onChangeStickyIndex != null) {
|
|
onChangeStickyIndex(r2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun50362() { // fn#50362, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6599:1346, offset: 0x0121785c, size: 16 bytes, params: 1, frame: 2
|
|
return {reportScrollEvent: reportScrollEvent};
|
|
}
|
|
|
|
function _fun50364() { // fn#50364, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6599:1454, offset: 0x0121787b, size: 213 bytes, params: 1, frame: 19
|
|
const recyclerViewManagerBinding = recyclerViewManager;
|
|
const value2 = recyclerViewManagerBinding.tryGetLayout(currentStickyIndex);
|
|
const value3 = undefined;
|
|
const height = value2 == null ? value3 : value2.height;
|
|
const value4 = 0;
|
|
const r8 = height ?? value4;
|
|
const scrollYBinding = scrollY;
|
|
const interpolate = scrollYBinding.interpolate;
|
|
const pushStartsAtBinding = pushStartsAt;
|
|
return {translateY: Reflect.apply(interpolate, scrollYBinding, [{inputRange: [pushStartsAtBinding,
|
|
pushStartsAtBinding + r8], outputRange: [0, -r8], extrapolate: 'clamp'}]),
|
|
opacity: stickyHeaderOffset > value4 ? scrollY.interpolate({inputRange: [pushStartsAt, pushStartsAt + r8],
|
|
outputRange: [1, 0], extrapolate: 'clamp'}) : value3};
|
|
}
|
|
|
|
function _fun50365() { // fn#50365, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6599:1772, offset: 0x01217950, size: 275 bytes, params: 1, frame: 21
|
|
var r4;
|
|
var ViewHolder;
|
|
const value = environment.__proto__;
|
|
const CompatAnimatedView = (require(6418) /* metro dependency 6418 */).CompatAnimatedView;
|
|
const object = {'position': 'absolute', 'top': null, 'left': 0, 'right': 0, 'zIndex': 2};
|
|
object.top = stickyHeaderOffset;
|
|
object.transform = [{translateY: translateY}];
|
|
object.opacity = opacity;
|
|
let currentStickyIndexBinding = currentStickyIndex;
|
|
const value3 = null;
|
|
if (currentStickyIndexBinding === -1) {
|
|
r4 = value3;
|
|
} else {
|
|
currentStickyIndexBinding = currentStickyIndex;
|
|
if (currentStickyIndexBinding < data.length) {
|
|
ViewHolder = (require(6422) /* metro dependency 6422 */).ViewHolder;
|
|
currentStickyIndexBinding = currentStickyIndex;
|
|
r4 = <ViewHolder index={currentStickyIndexBinding} item={data[currentStickyIndexBinding]} renderItem={renderItem} layout={{'x': 0,
|
|
|
|
|
|
'y': 0, 'width': 0,
|
|
'height': 0}} refHolder={current} extraData={extraData} trailingItem={value3} target="StickyHeader" hidden={false} />;
|
|
} else {
|
|
r4 = value3;
|
|
}
|
|
}
|
|
return (
|
|
<CompatAnimatedView style={object}>
|
|
{r4}
|
|
</CompatAnimatedView>
|
|
);
|
|
}
|
|
|
|
function reportScrollEvent() { // fn#50363, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6599:1382, offset: 0x0121786c, size: 15 bytes, params: 1, frame: 9
|
|
env1_13();
|
|
}
|
|
|