Files
discord-decomp/sources/design/void/ShinyButton/native/ShinyButton.tsx
T
2026-07-28 01:06:53 +03:00

148 lines
9.6 KiB
TypeScript

/* Metro module 12716; source: design/void/ShinyButton/native/ShinyButton.tsx; dependencies: [57, 31, 27, 4502, 33, 4501, 566, 4017, 4504, 1308, 2] */
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
import Button from '../../Button/native/Button.tsx'; /* Metro dependency 1308 */
import AccessibilityStore from '../../../../modules/a11y/AccessibilityStore.tsx'; /* Metro dependency 4502 */
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as FluxModule from '../../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ReanimatedRexportModule from '../../../../modules/reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
import * as CreateStylesModule from '../../../components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
function _fun97382(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#97382, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12906:6, offset: 0x0217e576, size: 340 bytes, params: 8, frame: 21
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_8 = (CreateStylesModule).createStyles({shinyButton: {overflow: 'hidden'},
shineContainer: {'width': '100%', 'height': '100%', 'position': 'absolute', 'overflow': 'hidden'},
shine: {'width': 56, 'height': '500%', 'transform': null, 'backgroundColor': 'rgba(255,255,255,0.1)',
'top': '-100%', 'alignItems': 'center', transform: [{rotate: '30deg'}]}, shineInner: {'width': 16,
'height': '100%', 'backgroundColor': 'rgba(255,255,255,0.1)'}});
object = {code: "function ShinyButtonTsx1(){const{width,OFFSCREEN_OFFSET,withRepeat,withSequence,withTiming,withDelay,INITIAL_ANIMATION_DELAY,ANIMATION_DURATION}=this.__closure;if(width==null){return{transform:[{translateX:-OFFSCREEN_OFFSET}]};}return{transform:[{translateX:withRepeat(withSequence(withTiming(-OFFSCREEN_OFFSET,{duration:0},'animate-always'),withDelay(INITIAL_ANIMATION_DELAY,withTiming(width+OFFSCREEN_OFFSET,{duration:ANIMATION_DURATION},'animate-always'))),-1)}]};}"};
(FileImportTrackerModule).fileFinishedImporting('design/void/ShinyButton/native/ShinyButton.tsx');
exports.default = ShinyButton_97383;
function ShinyButton_97383(a0) { // fn#97383, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12906:995, offset: 0x0217e6ca, size: 618 bytes, params: 2, frame: 30
const style = a0.style;
const disabled = a0.disabled;
const env0_1 = a0.submitting;
if (a0.shineDisabled !== undefined) {
}
const shineStyle = a0.shineStyle;
const shineInnerStyle = a0.shineInnerStyle;
const object = {'style': 0, 'disabled': 0, 'submitting': 0, 'shineDisabled': 0, 'shineStyle': 0,
'shineInnerStyle': 0};
silentSetPrototypeOf(object, null, undefined);
const value = copyDataProperties({}, a0, object, undefined);
const styles = useStyles();
const binding = shineInnerStyle;
let useState = binding.useState;
const value3 = Reflect.apply(useState, binding, [null]);
const binding2 = shineStyle;
const value4 = binding2(value3, 2);
const property = value4[0];
const env0_7 = value4[1];
let closure = function() {
return AccessibilityStore.useReducedMotion;
};
const env0_8 = FluxModule.useStateFromStores([AccessibilityStore], closure, []);
useState = binding.useState;
const value5 = binding2(Reflect.apply(useState, binding, [AppState.currentState === 'active']), 2);
const env0_9 = value5[0];
const env0_10 = value5[1];
binding.useEffect(function() {
var env0_0 = AppState.addEventListener('change', _fun97387);
return _fun97388;
}, []);
const useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
closure = ShinyButton_97383P;
const object2 = {width: property, OFFSCREEN_OFFSET: 100};
object2.withRepeat = ReanimatedRexportModule.withRepeat;
object2.withSequence = ReanimatedRexportModule.withSequence;
object2.withTiming = (require(4504) /* metro dependency 4504: timing */).withTiming;
object2.withDelay = ReanimatedRexportModule.withDelay;
object2.INITIAL_ANIMATION_DELAY = 750;
object2.ANIMATION_DURATION = 2000;
closure.__closure = object2;
closure.__workletHash = 5550564727650;
closure.__initData = env0_9;
const env0_11 = Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [closure]);
return ((Component) => <Component {...value} {...{['style']: [style,
styles.shinyButton]}} {...{['disabled']: disabled}} {...{['renderShine']: renderShine}} />)(Button);
function ShinyButton_97383HandleLayout({nativeEvent}) { // fn#97384, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12906:1956, owner: ShinyButton_97383.handleLayout, offset: 0x0217e934, size: 36 bytes, params: 2, frame: 11
env0_7(nativeEvent.layout.width);
}
function _fun97386() { // fn#97386, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12906:1296, offset: 0x0217e958, size: 45 bytes, params: 1, frame: 14
const env0_0 = AppState.addEventListener('change', _fun97387);
return _fun97388;
function _fun97387(a0) { // fn#97387, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12906:1336, offset: 0x0217e985, size: 27 bytes, params: 2, frame: 12
env1_10(a0 === 'active');
}
function _fun97388() { // fn#97388, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12906:1365, offset: 0x00cd0cb3, size: 21 bytes, params: 1, frame: 9
env0_0.remove();
}
}
function ShinyButton_97383P() { // fn#97389, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12906:1425, owner: ShinyButton_97383.p, offset: 0x0217e9a0, size: 250 bytes, params: 1, frame: 27
var object2;
var value2;
var moduleValue;
var withRepeat;
var moduleValue2;
var withSequence;
var withTiming;
var value3;
var moduleValue4;
var withDelay;
var moduleValue5;
var value;
if (env0_6 == null) {
object2 = {transform: [{translateX: -100}]};
} else {
value2 = environment.__proto__;
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
withRepeat = moduleValue.withRepeat;
moduleValue2 = require(4017) /* metro dependency 4017: ReanimatedRexport */;
withSequence = moduleValue2.withSequence;
value3 = (require(4504) /* metro dependency 4504: timing */).withTiming(-100, {duration: 0}, 'animate-always');
moduleValue4 = require(4017) /* metro dependency 4017: ReanimatedRexport */;
withDelay = moduleValue4.withDelay;
moduleValue5 = require(4504) /* metro dependency 4504: timing */;
withTiming = moduleValue5.withTiming;
value = env0_6 + 100;
value = Reflect.apply(withTiming, moduleValue5, [value, {duration: 2000}, 'animate-always']);
value = Reflect.apply(withSequence, moduleValue2, [value3, Reflect.apply(withDelay, moduleValue4, [750,
value])]);
object2 = {transform: [{translateX: Reflect.apply(withRepeat, moduleValue, [value, -1])}]};
}
return object2;
}
function renderShine() { // fn#97390, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12906:2081, owner: ShinyButton_97383.renderShine, offset: 0x0217ea9a, size: 258 bytes, params: 1, frame: 22
const disabledBinding = disabled;
const value2 = null;
if (disabledBinding || submitting || (env0_8 || shineDisabled)) {
return value2;
} else if (env0_9) {
const View = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
return (
<View onLayout={ShinyButton_97383HandleLayout} style={[styles.shineContainer, env0_11]}>
{((View) => <View style={[styles.shine, shineStyle]}>{((View) => <View style={[styles.shineInner,
shineInnerStyle]} />)((importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View)}</View>)((importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View)}
</View>
);
} else {
return value2;
}
}
}
}
global.__d(_fun97382, 12716, [57, 31, 27, 4502, 33, 4501, 566, 4017, 4504, 1308,
2]) /* metro module 12716, dependencies: [57, 31, 27, 4502, 33, 4501, 566, 4017, 4504, 1308, 2] */;