Pārlūkot izejas kodu

fix: 联系人滚动

sheldon 1 mēnesi atpakaļ
vecāks
revīzija
6acc8a8cd6

+ 6 - 2
src/components/SliderAction/index.module.less

@@ -2,6 +2,8 @@
   position: relative;
   width: 100%;
   overflow: hidden;
+  // width: 375px;
+  // height: 80px;
 }
 
 .actions {
@@ -30,7 +32,9 @@
 .content {
   background: #fff;
   position: relative;
+  width: 100%;
+  height: 100%;
   z-index: 2;
-  will-change: transform;
-  transition: transform 0.2s;
+  // will-change: transform;
+  // transition: transform 0.2s;
 }

+ 16 - 17
src/components/SliderAction/index.tsx

@@ -92,21 +92,7 @@ const SliderDeleteAction: React.FC<SliderDeleteActionProps> = ({
 
   const renderActionBar = () => {
     if(!scrolling){
-      return <View
-      className={styles.actions}
-      style={{ width: `${totalActionWidth}px`, right: 0 }}
-    >
-      {actions.map((action, idx) => (
-        <View
-          key={idx}
-          className={styles.actionBtn}
-          style={{ background: action.color || "#ff4d4f" }}
-          onClick={()=> handleActionClick(action)}
-        >
-          {action.text}
-        </View>
-      ))}
-    </View>
+      
     }
 
     return <></>
@@ -116,7 +102,6 @@ const SliderDeleteAction: React.FC<SliderDeleteActionProps> = ({
   
   return (
     <View className={styles.sliderDeleteAction}>
-      
       <View
         className={classNames(styles.content, { [styles.open]: open })}
         style={{
@@ -130,7 +115,21 @@ const SliderDeleteAction: React.FC<SliderDeleteActionProps> = ({
       >
         {children}
       </View>
-      {renderActionBar()}
+      <View
+      className={styles.actions}
+      style={{ width: `${totalActionWidth}px`, right: 0 }}
+    >
+      {actions.map((action, idx) => (
+        <View
+          key={idx}
+          className={styles.actionBtn}
+          style={{ background: action.color || "#ff4d4f" }}
+          onClick={()=> handleActionClick(action)}
+        >
+          {action.text}
+        </View>
+      ))}
+    </View>
     </View>
   );
 };

+ 3 - 5
src/pages/contact/index.tsx

@@ -15,10 +15,9 @@ import CheckLoginPopup from "@/components/CheckLoginPopup";
 import BlurContainer from "@/components/BlurContainer";
 import SliderAction from "@/components/SliderAction";
 import PageTitle from '@/components/PageTitle'
-
 export default function Index() {
   const [searchValue, setSearchValue] = useState("");
-  const [scrollIng, setScrolling] = useState(false);
+  // const [scrollIng, setScrolling] = useState(false);
 
   const fetcher = async ([_url, params, keyword]) => {
     params = params || {};
@@ -139,7 +138,7 @@ export default function Index() {
     if (list?.length) {
       return list.map((item) => (
         <View className={`rounded-12 overflow-hidden truncate`}>
-          <SliderAction actions={createSliderButtons(item)}>
+          <SliderAction actions={createSliderButtons(item)} key={item.contactId}>
             <ContactCard
               refresh={mutate}
               deleteable={true}
@@ -178,12 +177,11 @@ export default function Index() {
         </View>
         <BlurContainer className="flex flex-col overflow-hidden">
           <View className="px-16 text-gray-45 text-12 leading-20 mb-20 pt-16">
-            共 {totalCount} 个联系人 {scrollIng ? 'true': 'false'}
+            共 {totalCount} 个联系人
           </View>
           <View className="flex-1 h-full overflow-hidden">
           <ScrollView
             scrollY
-            onScrollEnd={handleScrollEnd}
             onScrollToUpper={onScrollToUpper}
             style={{
               flex: 1,