216 lines
8.6 KiB
TypeScript
216 lines
8.6 KiB
TypeScript
/* Metro module 10302; source: modules/safe_area/useSafeAreaAvoidingInputs.native.tsx; dependencies: [5, 31, 1478, 697, 10303, 5464, 2] */
|
|
function _fun79952(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#79952, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10488:6, offset: 0x01e67cf5, size: 148 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(5) /* metro dependency 5 */;
|
|
const env0_4 = importAll(31) /* metro dependency 31 */;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/safe_area/useSafeAreaAvoidingInputs.native.tsx');
|
|
exports.default = useSafeAreaAvoidingInputs;
|
|
}
|
|
|
|
function _calculateScrollOffset() { // fn#79953, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10488:116, offset: 0x01e67d89, size: 50 bytes, params: 1, frame: 14
|
|
return env0_3(_fun79955).apply(this, arguments);
|
|
}
|
|
|
|
function useSafeAreaAvoidingInputs({insets, inputs, scrollViewRef}) { // fn#79956, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10488:616, offset: 0x01e67ede, size: 162 bytes, params: 2, frame: 17
|
|
const binding = env0_4;
|
|
const env0_3 = binding.useRef(inputs);
|
|
binding.useEffect(_fun79957, [inputs]);
|
|
const useCallback = binding.useCallback;
|
|
let value = env0_3(_fun79959);
|
|
value = Reflect.apply(useCallback, binding, [value, [insets, scrollViewRef]]);
|
|
binding.useEffect(_fun79962, [value]);
|
|
return {onFocus: value};
|
|
}
|
|
|
|
function* _fun79955(a0, a1) { // fn#79955, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10488:183, offset: 0x01e67dc6, size: 280 bytes, params: 3, frame: 17
|
|
var r4;
|
|
var r2;
|
|
var value3;
|
|
var value4;
|
|
var y;
|
|
var y2;
|
|
var height;
|
|
let value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
if (a0 == null) {
|
|
value = environment.__proto__.__proto__;
|
|
return env2_1(env2_2[3]).space.PX_16;
|
|
}
|
|
const type = a0.type;
|
|
if (type === 'toRef') {
|
|
value = environment.__proto__.__proto__;
|
|
value3 = env2_0(env2_2[4]);
|
|
yield value3.measureViewRefInWindow(a0.ref);
|
|
value4 = undefined;
|
|
if (false) {
|
|
return value4;
|
|
}
|
|
r4 = a0.extraOffset ?? 0;
|
|
if (value4 == null) {
|
|
r2 = env2_1(env2_2[3]).space.PX_16 + r4;
|
|
} else {
|
|
y = value4.y;
|
|
y2 = a1.y;
|
|
height = a1.height;
|
|
value = y - (y2 + height);
|
|
height = value4.height;
|
|
value = value + height + r4;
|
|
r2 = value;
|
|
}
|
|
return r2;
|
|
}
|
|
if (type === 'toValue') {
|
|
return a0.value;
|
|
}
|
|
if (type === 'toBottom') {
|
|
return global.Number.MAX_SAFE_INTEGER;
|
|
}
|
|
}
|
|
|
|
function* _fun79959() { // fn#79959, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10488:766, offset: 0x01e67f8b, size: 701 bytes, params: 1, frame: 25
|
|
var environment;
|
|
var r9;
|
|
var r5;
|
|
var r7;
|
|
var object2;
|
|
var scrollView;
|
|
var y;
|
|
var height;
|
|
var value17;
|
|
var value18;
|
|
var value19;
|
|
var inputInWindow;
|
|
var value21;
|
|
var value22;
|
|
var inputInScrollView;
|
|
var value24;
|
|
if (true) {
|
|
value = environment.__proto__;
|
|
var current = dependencyMap.current;
|
|
var value3 = env1_3.current.find(function(a0) {
|
|
return a0.ref.current?.isFocused();
|
|
});
|
|
if (value3 != null) {
|
|
if (current == null) {
|
|
return undefined;
|
|
}
|
|
var binding = env2_0;
|
|
var value5 = undefined;
|
|
var value6 = binding(env2_2[4]);
|
|
var measureViewRefInWindow = value6.measureViewRefInWindow;
|
|
var ref = value3.ref;
|
|
yield Reflect.apply(measureViewRefInWindow, value6, [ref]);
|
|
var value7 = undefined;
|
|
if (false) {
|
|
return value7;
|
|
}
|
|
binding = env2_0;
|
|
var value9 = binding(env2_2[4]);
|
|
var measureViewRefInView = value9.measureViewRefInView;
|
|
ref = value3.ref;
|
|
yield Reflect.apply(measureViewRefInView, value9, [ref, current]);
|
|
var value10 = undefined;
|
|
if (false) {
|
|
return value10;
|
|
}
|
|
if (value7 == null) {
|
|
return undefined;
|
|
}
|
|
if (value10 == null) {
|
|
return undefined;
|
|
}
|
|
binding = env2_0;
|
|
var value12 = binding(env2_2[4]);
|
|
yield value12.measureViewInWindow(current);
|
|
var value13 = undefined;
|
|
if (false) {
|
|
return value13;
|
|
}
|
|
yield calculateScrollOffset(value3.offset, value7);
|
|
var value15 = undefined;
|
|
if (false) {
|
|
return value15;
|
|
}
|
|
var Number = global.Number;
|
|
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
|
if (value15 !== MAX_SAFE_INTEGER) {
|
|
object2 = {};
|
|
object2.insets = require;
|
|
object2.inputInScrollView = value10;
|
|
object2.inputInWindow = value7;
|
|
object2.scrollOffset = value15;
|
|
object2.scrollView = value13;
|
|
scrollView = object2.scrollView;
|
|
y = scrollView.y;
|
|
scrollView = object2.scrollView;
|
|
height = scrollView.height;
|
|
value17 = y + height;
|
|
value18 = env2_0(env2_2[2]);
|
|
height = value18.getWindowDimensions({ignoreKeyboard: true}).height;
|
|
value19 = height - object2.insets.bottom;
|
|
inputInWindow = object2.inputInWindow;
|
|
y = inputInWindow.y;
|
|
inputInWindow = object2.inputInWindow;
|
|
height = inputInWindow.height;
|
|
if (y + height + object2.scrollOffset <= value19) {
|
|
r9 = value5;
|
|
} else {
|
|
value21 = global.Math.max(0, value17 - value19);
|
|
height = object2.scrollView.height;
|
|
value22 = height - value21;
|
|
inputInScrollView = object2.inputInScrollView;
|
|
y = inputInScrollView.y;
|
|
inputInScrollView = object2.inputInScrollView;
|
|
height = inputInScrollView.height;
|
|
value24 = y + height + object2.scrollOffset;
|
|
r9 = value24 <= value22 ? value5 : value24 - value22;
|
|
}
|
|
if (r9 != null) {
|
|
current = dependencyMap.current;
|
|
r5 = current == null || current.scrollTo == null ? value5 : current.scrollTo({'x': 0, 'y': null,
|
|
'animated': true,
|
|
y: r9});
|
|
value = r5 != null;
|
|
if (value) {
|
|
r5 = value;
|
|
r7 = value5;
|
|
} else {
|
|
current = dependencyMap.current;
|
|
r5 = current == null;
|
|
r7 = current;
|
|
}
|
|
r5 = !r5 ? r7.scrollToOffset == null : r5;
|
|
if (!r5) {
|
|
r7.scrollToOffset({offset: r9, animated: true});
|
|
}
|
|
}
|
|
} else {
|
|
current = dependencyMap.current;
|
|
if (current != null) {
|
|
current.scrollToEnd({animated: true});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun79962() { // fn#79962, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10488:1951, offset: 0x01e6826c, size: 71 bytes, params: 1, frame: 15
|
|
var environment;
|
|
const setTimeout = global.setTimeout;
|
|
const binding = env0_4;
|
|
let value = environment.__proto__;
|
|
value = require(5464) /* metro dependency 5464: useKeyboardDuration */;
|
|
const getKeyboardDuration = value.getKeyboardDuration;
|
|
const env0_0 = setTimeout(binding, Reflect.apply(getKeyboardDuration, value, []));
|
|
return _fun79963;
|
|
}
|
|
|
|
function calculateScrollOffset() { // fn#79961, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10488:1066, offset: 0x01b646ea, size: 30 bytes, params: 1, frame: 13
|
|
return env3_5.apply(this, arguments);
|
|
}
|
|
|