Skip to content

Commit e8e1f2b

Browse files
author
luyongfang
committed
feat: 修复lint
1 parent 9f54fa9 commit e8e1f2b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/webpack-plugin/lib/runtime/components/react/mpx-swiper.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
193193
const patchElmNumShared = useSharedValue(patchElmNum)
194194
const circularShared = useSharedValue(circular)
195195
// 支持swiper-item 同时存在<swiper-item wx:for/>和<swiper-item>并列的情况
196-
const children = (Array.isArray(props.children) ? props.children.filter(child => child) : (props.children ? [props.children] : [])).flat()
196+
const children = React.Children.toArray(props.children) as ReactElement[]
197197
// 对有变化的变量,在worklet中只能使用sharedValue变量,useRef不能更新
198198
const childrenLength = useSharedValue(children.length)
199199
const initWidth = typeof normalStyle?.width === 'number' ? normalStyle.width - preMargin - nextMargin : normalStyle.width
@@ -729,12 +729,12 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
729729
return finalOffset
730730
}
731731
// 设置手势移动的方向
732-
function setMoveDir(curAbsoPos: number) {
733-
'worklet'
734-
const distance = curAbsoPos - preAbsolutePos.value
735-
if (distance) {
736-
moveDir.value = curAbsoPos - preAbsolutePos.value
737-
}
732+
function setMoveDir (curAbsoPos: number) {
733+
'worklet'
734+
const distance = curAbsoPos - preAbsolutePos.value
735+
if (distance) {
736+
moveDir.value = curAbsoPos - preAbsolutePos.value
737+
}
738738
}
739739
const gesturePan = Gesture.Pan()
740740
.onBegin((e: GestureStateChangeEvent<PanGestureHandlerEventPayload>) => {

0 commit comments

Comments
 (0)