decord/source/design/components/Button/native/ButtonShine.native.tsx

95 lines
4.5 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 4825
// Function ID: 4826
2026-07-20 16:05:17 +00:00
// Name: useShineEffectStyles
2026-08-25 06:04:03 +00:00
// Dependencies: [32, 19, 21, 4820, 689, 1363, 4120, 4381, 4380, 2]
2026-07-20 16:05:17 +00:00
// Exports: ButtonShine
2026-08-25 06:04:03 +00:00
// Module 4825 (useShineEffectStyles)
import _modDef4120 from "module_4120" /* 4120 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "noop" /* 19 */;
import { jsx } from "jsxProd" /* 21 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function useShineEffectStyles(width, variant) {
2026-07-23 10:11:24 +00:00
const _require = width;
2026-08-25 06:04:03 +00:00
let obj = _require(4820);
2026-07-20 16:05:17 +00:00
const buttonTextColorStyles = obj.useButtonTextColorStyles(variant);
2026-07-29 08:29:29 +00:00
const obj2 = enabled(689)(buttonTextColorStyles.color);
const hexResult = enabled(689)(buttonTextColorStyles.color).alpha(0.1).hex();
2026-08-11 06:20:06 +00:00
enabled = React.useContext(_require(1363).AccessibilityPreferencesContext).reducedMotion.enabled;
2026-07-29 08:29:29 +00:00
const alphaResult = enabled(689)(buttonTextColorStyles.color).alpha(0.1);
2026-07-20 16:05:17 +00:00
const fn = function o() {
2026-07-23 10:11:24 +00:00
if (null == width) {
2026-07-29 08:29:29 +00:00
let obj = { transform: null };
const items = [{ translateX: -120 }];
obj[0] = items;
2026-07-20 16:05:17 +00:00
let tmp5 = obj;
} else {
2026-07-29 08:29:29 +00:00
obj = { transform: null };
2026-08-24 06:08:38 +00:00
obj1 = { translateX: null };
2026-07-20 16:05:17 +00:00
if (enabled) {
2026-07-29 08:29:29 +00:00
obj1[0] = (tmp - 56) / 2;
const items1 = [obj1];
obj[0] = items1;
tmp5 = obj;
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
obj = width(closure_1_2[6]);
obj1 = width(closure_1_2[6]);
const obj3 = width(closure_1_2[7]);
const withTimingResult = width(closure_1_2[7]).withTiming(-120, { duration: 0 }, "animate-always");
const obj4 = width(closure_1_2[6]);
obj1[0] = obj.withRepeat(obj1.withSequence(withTimingResult, obj4.withDelay(750, width(closure_1_2[7]).withTiming(tmp + 120, { duration: 2000 }, "animate-always"))), -1);
2026-07-29 08:29:29 +00:00
const items2 = [obj1];
obj[0] = items2;
tmp5 = obj;
2026-08-24 06:08:38 +00:00
const obj5 = width(closure_1_2[7]);
2026-07-20 16:05:17 +00:00
}
}
return tmp5;
};
2026-08-25 06:04:03 +00:00
obj = { width, SHINE_OFFSCREEN_OFFSET: 120, useReducedMotion: enabled, SHINE_WIDTH: 56, withRepeat: _require(4120).withRepeat, withSequence: _require(4120).withSequence, withTiming: _require(4381).withTiming, withDelay: _require(4120).withDelay, SHINE_INITIAL_ANIMATION_DELAY: 750, SHINE_ANIMATION_DURATION: 2000 };
2026-07-20 16:05:17 +00:00
fn.__closure = obj;
fn.__workletHash = 15814138938406;
fn.__initData = closure_6;
2026-07-29 08:29:29 +00:00
obj = { shineStyles: null, shineAnimatedStyle: null };
2026-08-25 06:04:03 +00:00
const animatedStyle = _require(4120).useAnimatedStyle(fn);
let obj4 = _require(4120);
2026-07-23 10:11:24 +00:00
let items = [{ rotate: "30deg" }];
2026-08-25 06:04:03 +00:00
obj[0] = _require(4380).createStyles({ shineContainer: { width: "100%", height: "200%", position: "absolute", overflow: "hidden" }, shine: { width: 56, height: "500%", transform: items, backgroundColor: hexResult, top: "-100%", alignItems: "center" }, shineInner: { width: 16, height: "100%", backgroundColor: hexResult } })();
2026-07-29 08:29:29 +00:00
obj[1] = animatedStyle;
2026-07-20 16:05:17 +00:00
return obj;
}
let closure_6 = { code: "function ButtonShineNativeTsx1(){const{width,SHINE_OFFSCREEN_OFFSET,useReducedMotion,SHINE_WIDTH,withRepeat,withSequence,withTiming,withDelay,SHINE_INITIAL_ANIMATION_DELAY,SHINE_ANIMATION_DURATION}=this.__closure;if(width==null){return{transform:[{translateX:-SHINE_OFFSCREEN_OFFSET}]};}if(useReducedMotion){const centerOffset=(width-SHINE_WIDTH)/2;return{transform:[{translateX:centerOffset}]};}return{transform:[{translateX:withRepeat(withSequence(withTiming(-SHINE_OFFSCREEN_OFFSET,{duration:0},'animate-always'),withDelay(SHINE_INITIAL_ANIMATION_DELAY,withTiming(width+SHINE_OFFSCREEN_OFFSET,{duration:SHINE_ANIMATION_DURATION},'animate-always'))),-1)}]};}" };
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("design/components/Button/native/ButtonShine.native.tsx");
2026-07-20 16:05:17 +00:00
export { useShineEffectStyles };
export const ButtonShine = function ButtonShine(variant) {
2026-08-24 06:08:38 +00:00
closure_0 = undefined;
2026-07-20 16:05:17 +00:00
const tmp = callback(React.useState(null), 2);
2026-07-29 08:29:29 +00:00
closure_0 = tmp[1];
2026-07-20 16:05:17 +00:00
const tmp2 = useShineEffectStyles(tmp[0], variant.variant);
const shineStyles = tmp2.shineStyles;
let obj = {
onLayout(nativeEvent) {
return callback(nativeEvent.nativeEvent.layout.width);
},
2026-07-29 08:29:29 +00:00
style: items,
children: null
2026-07-20 16:05:17 +00:00
};
2026-07-23 10:11:24 +00:00
items = [shineStyles.shineContainer, tmp2.shineAnimatedStyle];
2026-08-24 06:08:38 +00:00
obj = {
style: shineStyles.shine,
2026-08-25 06:04:03 +00:00
children: jsx(_modDef4120.View, {
2026-08-24 06:08:38 +00:00
onLayout(nativeEvent) {
return callback(nativeEvent.nativeEvent.layout.width);
},
style: items,
children: null
})
};
2026-07-20 16:05:17 +00:00
obj = { style: shineStyles.shineInner };
2026-08-25 06:04:03 +00:00
obj[2] = jsx(_modDef4120.View, { style: shineStyles.shineInner });
return jsx(_modDef4120.View, { style: shineStyles.shineInner });
2026-07-20 16:05:17 +00:00
};