From b9b5b09d2eadab17769c4afb3e5cf674081141c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=9D=B0?= Date: Tue, 17 Oct 2023 10:39:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=87=A0=E4=B8=AA?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=87=8Cchildren=E7=9A=84=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/react-native/src/card/index.tsx | 52 +++++++++---------- packages/react-native/src/pressable/index.tsx | 6 +-- packages/react-native/src/swipe-row/index.tsx | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/react-native/src/card/index.tsx b/packages/react-native/src/card/index.tsx index 0994268168..a215fb976c 100644 --- a/packages/react-native/src/card/index.tsx +++ b/packages/react-native/src/card/index.tsx @@ -1,4 +1,4 @@ -import React, { FC, memo, PropsWithChildren, ReactNode } from 'react'; +import React, { FC, memo, ReactNode } from 'react'; import { StyleProp, StyleSheet, ViewStyle } from 'react-native'; import { useTheme } from '@shopify/restyle'; @@ -27,6 +27,8 @@ export interface CardProps { containerStyle?: StyleProp; /** 容器内content样式 */ contentStyle?: StyleProp; + /** 子组件 */ + children?: ReactNode; } /** @@ -34,7 +36,7 @@ export interface CardProps { * @param param0 * @returns */ -const Card: FC> = ({ +const Card: FC = ({ icon, title, extra, @@ -119,28 +121,26 @@ const Header = memo( } ); -const Body = memo( - ({ footer, contentStyle, children }: Pick, 'footer' | 'contentStyle' | 'children'>) => { - const theme = useTheme(); +const Body = memo(({ footer, contentStyle, children }: Pick) => { + const theme = useTheme(); - return ( - - {children} - - ); - } -); + return ( + + {children} + + ); +}); diff --git a/packages/react-native/src/pressable/index.tsx b/packages/react-native/src/pressable/index.tsx index e892899437..59d68ab845 100644 --- a/packages/react-native/src/pressable/index.tsx +++ b/packages/react-native/src/pressable/index.tsx @@ -29,7 +29,7 @@ * effect is the invocation of `onPress` and `onLongPress` that occur when a * responder is release while in the "press in" states. */ -import React, { memo, PropsWithChildren } from 'react'; +import React, { memo } from 'react'; import { Pressable as RNPressable, PressableProps as RNPressableProps, StyleProp, ViewStyle } from 'react-native'; import helpers from '../helpers'; @@ -44,7 +44,7 @@ type Rect = { export interface PressableProps extends Pick< RNPressableProps, - 'onPress' | 'onPressIn' | 'onPressOut' | 'onLongPress' | 'disabled' | 'delayLongPress' | 'onLayout' + 'onPress' | 'onPressIn' | 'onPressOut' | 'onLongPress' | 'disabled' | 'delayLongPress' | 'onLayout' | 'children' > { /** 点击时的不透明度 */ activeOpacity?: number; @@ -58,7 +58,7 @@ export interface PressableProps } const { px } = helpers; -function Pressable(props: PropsWithChildren) { +function Pressable(props: PressableProps) { const { children, activeOpacity = 0.6, diff --git a/packages/react-native/src/swipe-row/index.tsx b/packages/react-native/src/swipe-row/index.tsx index e9ea344513..9ba8ed0987 100644 --- a/packages/react-native/src/swipe-row/index.tsx +++ b/packages/react-native/src/swipe-row/index.tsx @@ -37,7 +37,7 @@ export type SwipeRowProps = PropsWithChildren<{ onRemove?: () => Promise; /** 是否覆盖默认操作项 */ overwriteDefaultActions?: boolean; - /** Swiperable自身的样式 */ + /** Swipeable自身的样式 */ containerStyle?: StyleProp; /** Swipeable的子组件样式 */ contentContainerStyle?: StyleProp; From 616feb43e40e3d1e527a66c7f0d51e4a5b602347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=9D=B0?= Date: Tue, 17 Oct 2023 10:41:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=87=A0=E4=B8=AA?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=87=8Cchildren=E7=9A=84=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/cuddly-dolls-begin.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/cuddly-dolls-begin.md diff --git a/.changeset/cuddly-dolls-begin.md b/.changeset/cuddly-dolls-begin.md new file mode 100644 index 0000000000..85ab32c204 --- /dev/null +++ b/.changeset/cuddly-dolls-begin.md @@ -0,0 +1,5 @@ +--- +'@td-design/react-native': patch +--- + +修改几个组件里children的类型定义方式