Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/packages/loading/demos/taro/demo1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Demo1 = () => {
type="lottie"
jsonData={data}
lottieProps={{
autoplay: false,
autoPlay: false,
loop: false,
style: { width: 56, height: 56 },
}}
Expand Down
25 changes: 23 additions & 2 deletions src/packages/lottie/mp.taro.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useImperativeHandle, useRef } from 'react'
import {
createSelectorQuery,
getEnv,
getSystemInfoSync,
useReady,
useUnload,
} from '@tarojs/taro'
import { Canvas } from '@tarojs/components'
import lottie from 'lottie-miniprogram'
import useUuid from '@/utils/use-uuid'
import { LottieProps } from './types'
Expand Down Expand Up @@ -82,7 +82,28 @@ export const Lottie = React.forwardRef((props: LottieProps, ref: any) => {
animation.current.removeEventListener('complete', onComplete)
animation.current && animation.current.destroy()
})
return <Canvas id={id} canvas-id={id} type="2d" style={style} />

return getEnv() === 'WEAPP' || getEnv() === 'JD' ? (
<canvas
id={id}
// @ts-ignore
// eslint-disable-next-line react/no-unknown-property
canvasId={id}
// eslint-disable-next-line react/no-unknown-property
disalbeScroll
type="2d"
style={style}
/>
) : (
<canvas
id={id}
// eslint-disable-next-line react/no-unknown-property
canvas-id={id}
// eslint-disable-next-line react/no-unknown-property
disalbe-scroll
style={style}
/>
)
})

Lottie.displayName = 'NutLottie'
1 change: 1 addition & 0 deletions src/packages/pulltorefresh/pulltorefresh.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export const PullToRefresh: FunctionComponent<Partial<PullToRefreshProps>> = (
<View
className={classes}
style={props.style}
catchMove
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
onTouchEnd={handleTouchEnd}
Expand Down
Loading