Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using PhotoView to pass props render will cause photoClosable in PhotoProvider to fail #202

Open
YuFy1314 opened this issue Dec 13, 2024 · 1 comment

Comments

@YuFy1314
Copy link

<PhotoProvider maskClassName={styles.mask} // visible={visible} // bannerVisible={!isInAppRes} // index={currentIndex} loop={false} // photoClosable={false} // maskClosable // onClose={handleClose} // onIndexChange={handleIndexChange} // overlayRender={overlayRender} > {imagesList.length > 0 && imagesList.map((image, index) => { return ( <PhotoView key={image.key} // src={image.url} width={image.width} height={image.height} render={() => { return ( <div className={styles.photoViewWrapper} onTouchStart={() => { debugger; }}> <img src={image.url} /> {/* // 仅对支持自动播放视频的App开放Live图片的显示, 否则展示静态图片 */} {(index === 0 && isSupportAutoPlay) ? ( <video src={videoSource} ref={videoRef} // src={image?.lpVideoUrl} controls={false} autoPlay={currentIndex === index} className={styles.liveImage} > <track kind="captions" /> </video> ) : ( <img src={image.url} /> )} </div> ); }} > <img className={styles.photoViewImg} src={image.url} /> </PhotoView> ); })} </PhotoProvider>

The default value of photoClosable in PhotoProvider is false, but passing render in PhotoView will cause the value of photoClosable to always be true. In other words, the function of photoClosable will fail, and clicking on the image or the mask will trigger the image to close.

@YuFy1314
Copy link
Author

In the demo above, if src is passed to PhotoView instead of render, everything will work fine. So this props render will cause a bug in the program and needs to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant