首页 > 解决方案 > 在 iphone 5,6 错误格式 css 中反应 facebook 评论

问题描述

我正在使用 facebook 评论,错误就像图片一样。

const FacebookComment: React.FC<Props> = ({ title }) => {
      const isMobile = ...
      const [loading, setLoading] = useState(true);
      const [dataHref, setDataHref] = useState('');
      const rootRef = useRef<HTMLDivElement>(null);
      const route = useRouter();
      useEffect(() => {...
      }, [route]);
    
      useEffect(() => {...
        };
        try {
          window.FB?.Event.subscribe('xfbml.render', handleRendered);
          return () => window.FB?.Event.unsubscribe('xfbml.render', handleRendered);
        } catch (e) {
          // Ignore error
        }
      }, []);
    
      useEffect(() => {
      }, [dataHref]);
    
      return (
        <div ref={rootRef} className={isMobile ? css.rootMobile : css.rootDesktop} >
          
          {dataHref && <div className="fb-comments" data-href={dataHref} data-width="100%" data-numposts="5" />}
        </div>
      );
    };
    
    export default FacebookComment;

苹果手机 5,6 在此处输入图像描述

iphone x

在此处输入图像描述

问题:我正在使用上面的代码,但在 iphone 6 和 iphone x 上显示不同。我想修复 iphone 6 上的错误。希望有人能帮助我!!!

标签: reactjs

解决方案


推荐阅读