From d6b55fa8e9d9e10201fb400d2cfd038c736e303f Mon Sep 17 00:00:00 2001 From: hss <2274246770@qq.com> Date: Tue, 28 Nov 2023 20:19:20 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat(custom):=20noticebar=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E6=9C=AC=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/strong-fans-teach.md | 5 +++++ .../react-native/src/notice-bar/AnimatedNotice.tsx | 10 ++++++++-- packages/react-native/src/notice-bar/index.md | 1 + packages/react-native/src/notice-bar/index.tsx | 3 ++- packages/react-native/src/notice-bar/type.ts | 4 ++++ 5 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 .changeset/strong-fans-teach.md diff --git a/.changeset/strong-fans-teach.md b/.changeset/strong-fans-teach.md new file mode 100644 index 0000000000..10898e06ef --- /dev/null +++ b/.changeset/strong-fans-teach.md @@ -0,0 +1,5 @@ +--- +'@td-design/react-native': patch +--- + +noticeBar支持修改文本颜色 diff --git a/packages/react-native/src/notice-bar/AnimatedNotice.tsx b/packages/react-native/src/notice-bar/AnimatedNotice.tsx index 5242bd8687..59d6df1632 100644 --- a/packages/react-native/src/notice-bar/AnimatedNotice.tsx +++ b/packages/react-native/src/notice-bar/AnimatedNotice.tsx @@ -22,6 +22,7 @@ const { deviceWidth } = helpers; const AnimatedNotice: FC void }> = ({ icon, text, + textColor, animated, height, onContentLayout, @@ -79,13 +80,18 @@ const AnimatedNotice: FC - setTextWidth(e.nativeEvent.layout.width)}> + setTextWidth(e.nativeEvent.layout.width)} + > {textWithTail} {animated && ( - + {textWithTail} diff --git a/packages/react-native/src/notice-bar/index.md b/packages/react-native/src/notice-bar/index.md index a778effaad..dc66e5cf3e 100644 --- a/packages/react-native/src/notice-bar/index.md +++ b/packages/react-native/src/notice-bar/index.md @@ -140,6 +140,7 @@ group: | 属性 | 必填 | 说明 | 类型 | 默认值 | | ------------- | ------- | ---------------- | ------------------------- | ------- | | text | `true` | 通告栏文本 | `string` | | +| textColor | `false` | 通告栏文本颜色 | `string` | | | icon | `false` | 左侧图标 | `ReactNode` | | | mode | `false` | 通告栏类型 | `close` \| `link` \| `''` | `''` | | onPress | `false` | 通告栏点击事件 | `() => void` | | diff --git a/packages/react-native/src/notice-bar/index.tsx b/packages/react-native/src/notice-bar/index.tsx index 3bc1c4a819..a6d49885e2 100644 --- a/packages/react-native/src/notice-bar/index.tsx +++ b/packages/react-native/src/notice-bar/index.tsx @@ -21,6 +21,7 @@ const NoticeBar: FC = props => { icon = , mode = '', text = '', + textColor = 'text', onPress, duration = DEFAULT_DURATION, animated = false, @@ -38,7 +39,7 @@ const NoticeBar: FC = props => { if (!visible) return null; const BaseContent = ( - + ); switch (mode) { diff --git a/packages/react-native/src/notice-bar/type.ts b/packages/react-native/src/notice-bar/type.ts index b51750b119..8b09086342 100644 --- a/packages/react-native/src/notice-bar/type.ts +++ b/packages/react-native/src/notice-bar/type.ts @@ -1,11 +1,15 @@ import { ReactNode } from 'react'; import { StyleProp, ViewStyle } from 'react-native'; +import { Theme } from 'src/theme'; + export interface NoticeBarProps { /** 左侧自定义图标 */ icon?: ReactNode; /** 通知栏内容 */ text: string; + /** 文字颜色 */ + textColor?: keyof Theme['colors']; /** 通知栏模式。close表示可关闭;link表示可点击;默认为空 */ mode?: 'close' | 'link' | ''; /** 点击事件 */ From 6178786192ad95a952d5179fba23dfcb38565e75 Mon Sep 17 00:00:00 2001 From: hss <2274246770@qq.com> Date: Wed, 29 Nov 2023 09:20:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/good-students-act.md | 5 +++++ packages/react-native/src/notice-bar/index.md | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/good-students-act.md diff --git a/.changeset/good-students-act.md b/.changeset/good-students-act.md new file mode 100644 index 0000000000..701eac6f2b --- /dev/null +++ b/.changeset/good-students-act.md @@ -0,0 +1,5 @@ +--- +'@td-design/react-native': patch +--- + +修改md diff --git a/packages/react-native/src/notice-bar/index.md b/packages/react-native/src/notice-bar/index.md index dc66e5cf3e..41c9eb6c1b 100644 --- a/packages/react-native/src/notice-bar/index.md +++ b/packages/react-native/src/notice-bar/index.md @@ -140,7 +140,7 @@ group: | 属性 | 必填 | 说明 | 类型 | 默认值 | | ------------- | ------- | ---------------- | ------------------------- | ------- | | text | `true` | 通告栏文本 | `string` | | -| textColor | `false` | 通告栏文本颜色 | `string` | | +| textColor | `false` | 通告栏文本颜色 | `keyof Theme['colors']` | | | icon | `false` | 左侧图标 | `ReactNode` | | | mode | `false` | 通告栏类型 | `close` \| `link` \| `''` | `''` | | onPress | `false` | 通告栏点击事件 | `() => void` | | From cc5dadb7456409abbc6839673e459f24614fd3dc Mon Sep 17 00:00:00 2001 From: "damon.chen" Date: Wed, 29 Nov 2023 09:38:32 +0800 Subject: [PATCH 3/3] Delete .changeset/good-students-act.md --- .changeset/good-students-act.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .changeset/good-students-act.md diff --git a/.changeset/good-students-act.md b/.changeset/good-students-act.md deleted file mode 100644 index 701eac6f2b..0000000000 --- a/.changeset/good-students-act.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@td-design/react-native': patch ---- - -修改md