MCPcopy
hub / github.com/MinJieLiu/react-photo-view / PhotoSlider

Function PhotoSlider

packages/react-photo-view/src/PhotoSlider.tsx:79–437  ·  view source on GitHub ↗
(props: IPhotoSliderProps)

Source from the content-addressed store, hash-verified

77};
78
79export default function PhotoSlider(props: IPhotoSliderProps) {
80 const {
81 loop = 3,
82 speed: speedFn,
83 easing: easingFn,
84 photoClosable,
85 maskClosable = true,
86 maskOpacity = defaultOpacity,
87 pullClosable = true,
88 bannerVisible = true,
89 overlayRender,
90 toolbarRender,
91 className,
92 maskClassName,
93 photoClassName,
94 photoWrapClassName,
95 loadingElement,
96 brokenElement,
97 images,
98 index: controlledIndex = 0,
99 onIndexChange: controlledIndexChange,
100 visible,
101 onClose,
102 afterClose,
103 portalContainer,
104 } = props;
105
106 const [state, updateState] = useSetState(initialState);
107 const [innerIndex, updateInnerIndex] = useState(0);
108
109 const {
110 x,
111 touched,
112 pause,
113
114 lastCX,
115 lastCY,
116
117 bg = maskOpacity,
118 lastBg,
119 overlay,
120 minimal,
121
122 scale,
123 rotate,
124 onScale,
125 onRotate,
126 } = state;
127
128 // 受控 index
129 const isControlled = props.hasOwnProperty('index');
130 const index = isControlled ? controlledIndex : innerIndex;
131 const onIndexChange = isControlled ? controlledIndexChange : updateInnerIndex;
132 // 内部虚拟 index
133 const virtualIndexRef = useRef(index);
134
135 // 当前图片
136 const imageLength = images.length;

Callers

nothing calls this directly

Calls 8

useSetStateFunction · 0.85
useAnimationVisibleFunction · 0.85
useMethodsFunction · 0.85
useEventListenerFunction · 0.85
useAdjacentImagesFunction · 0.85
handlePhotoTapFunction · 0.85
changeIndexFunction · 0.70
closeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…