108 lines
3.7 KiB
React
108 lines
3.7 KiB
React
// Metro module 16045 (f16046).
|
|
import { memo, useState } from "react";
|
|
import { View, StyleSheet } from "react-native";
|
|
import * as _Module1606 from "./Module1606";
|
|
import Module1606, { useAnimatedStyle, useSharedValue, useFrameCallback, useAnimatedReaction } from "./Module1606";
|
|
let __initData2, __initData3, __initData4, styles;
|
|
const __initData = {
|
|
code: "function pnpm_indexTsx1(){const{index,textWidth,spacing,anim}=this.__closure;return{position:'absolute',left:index*(textWidth.value+spacing),transform:[{translateX:-(anim.value%(textWidth.value+spacing))}]};}"
|
|
};
|
|
const AnimatedChild = (props) => {
|
|
const { index, children: children2, anim, textWidth, spacing } = props;
|
|
const c = function c() {
|
|
return {
|
|
position: "absolute",
|
|
left: index * (textWidth.value + spacing),
|
|
transform: [{
|
|
translateX: -anim.value % (textWidth.value + spacing)
|
|
}]
|
|
};
|
|
};
|
|
c.__closure = {
|
|
index,
|
|
textWidth,
|
|
spacing,
|
|
anim
|
|
};
|
|
c.__workletHash = 9107973864402;
|
|
c.__initData = __initData;
|
|
return <Module1606.View style={useAnimatedStyle(c, [index, spacing, textWidth])}>{children2}</Module1606.View>;
|
|
};
|
|
__initData2 = {
|
|
code: "function pnpm_indexTsx2(){const{anim,speed}=this.__closure;anim.value+=speed;}"
|
|
};
|
|
__initData3 = {
|
|
code: "function pnpm_indexTsx3(){const{textWidth,parentWidth}=this.__closure;if(textWidth.value===0||parentWidth.value===0){return 0;}return Math.round(parentWidth.value/textWidth.value)+1;}"
|
|
};
|
|
__initData4 = {
|
|
code: "function pnpm_indexTsx4(v){const{runOnJS,setCloneTimes}=this.__closure;if(v===0){return;}runOnJS(setCloneTimes)(v*2);}"
|
|
};
|
|
const r34 = memo((a0) => {
|
|
let speed = a0.speed;
|
|
if (speed === void 0) {
|
|
speed = 1;
|
|
}
|
|
let c22759_0 = speed;
|
|
const { children, spacing: spacing3 = 0 } = a0;
|
|
const spacing2 = spacing3;
|
|
const style = a0.style;
|
|
const sharedValue = useSharedValue(0);
|
|
const sharedValue2 = useSharedValue(0);
|
|
const [state, setState] = useState(0);
|
|
const sharedValue3 = useSharedValue(0);
|
|
const w = function w() {
|
|
sharedValue3.value = sharedValue3.value + c22759_0;
|
|
};
|
|
w.__closure = {
|
|
anim: sharedValue3,
|
|
speed
|
|
};
|
|
w.__workletHash = 5612715942613;
|
|
w.__initData = __initData2;
|
|
useFrameCallback(w, true);
|
|
const W = function W() {
|
|
return sharedValue2.value !== 0 ? sharedValue.value !== 0 ? Math.round(sharedValue.value / sharedValue2.value) + 1 : 0 : 0;
|
|
};
|
|
W.__closure = {
|
|
textWidth: sharedValue2,
|
|
parentWidth: sharedValue
|
|
};
|
|
W.__workletHash = 4132969599661;
|
|
W.__initData = __initData3;
|
|
const y = function y(a0) {
|
|
if (a0 !== 0) {
|
|
_Module1606.runOnJS(setState)(2 * a0);
|
|
}
|
|
};
|
|
y.__closure = {
|
|
runOnJS: _Module1606.runOnJS,
|
|
setCloneTimes: setState
|
|
};
|
|
y.__workletHash = 8842395428122;
|
|
y.__initData = __initData4;
|
|
useAnimatedReaction(W, y, []);
|
|
return <Module1606.View style={style} onLayout={(event) => {
|
|
sharedValue.value = event.nativeEvent.layout.width;
|
|
}} pointerEvents="box-none">
|
|
<Module1606.View style={styles.row} pointerEvents="box-none">
|
|
<Module1606.ScrollView horizontal style={styles.hidden} pointerEvents="box-none">
|
|
<View onLayout={(event) => {
|
|
sharedValue2.value = event.nativeEvent.layout.width;
|
|
}}>{children}</View>
|
|
</Module1606.ScrollView>
|
|
{state > 0 && [...Array(state).keys()].map((item) => <AnimatedChild key={`clone-${item}`} index={item} anim={sharedValue3} textWidth={sharedValue2} spacing={spacing2}>{children}</AnimatedChild>)}
|
|
</Module1606.View>
|
|
</Module1606.View>;
|
|
});
|
|
styles = StyleSheet.create({
|
|
hidden: {
|
|
opacity: 0,
|
|
zIndex: -9999
|
|
},
|
|
row: {
|
|
flexDirection: "row",
|
|
overflow: "hidden"
|
|
}
|
|
});
|
|
export { r34 as Marquee };
|