Skip to content

Commit 0af7bdc

Browse files
committed
Fix TypeScript error.
1 parent b88158c commit 0af7bdc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/Watermark.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface WatermarkProps {
1717
*/
1818
const Watermark: React.FC<WatermarkProps> = (props) => {
1919
// 从Redux状态中获取水印设置
20-
const { text, opacity, rotate, colors } = useSelector(state => state.WatermarkReducer);
20+
const { text, opacity, rotate, colors } = useSelector((state: { WatermarkReducer: WatermarkProps }) => state.WatermarkReducer);
2121
const { width, height } = Dimensions.get('window');
2222
const rows = Math.ceil(height / 100);
2323
const cols = Math.ceil(width / 200);
@@ -33,8 +33,9 @@ const Watermark: React.FC<WatermarkProps> = (props) => {
3333
{
3434
top: rowIndex * 100,
3535
left: colIndex * 200,
36-
opacity,
37-
transform: [{ rotate }],
36+
opacity: opacity,
37+
// 修复transform类型错误,确保rotate值为AnimatableStringValue类型
38+
transform: rotate ? [{ rotate: rotate as string }] : undefined,
3839
},
3940
]}>
4041
<Text>

0 commit comments

Comments
 (0)