From f9db0e9d01cf1ccf7e33bd0fbed973b3f815cc26 Mon Sep 17 00:00:00 2001 From: WX <42308734@qq.com> Date: Mon, 13 Feb 2023 11:04:52 +0800 Subject: [PATCH 01/10] =?UTF-8?q?doc:SwipeAction=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/SwipeAction/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/core/src/SwipeAction/README.md b/packages/core/src/SwipeAction/README.md index ec61d6756..74799abe6 100644 --- a/packages/core/src/SwipeAction/README.md +++ b/packages/core/src/SwipeAction/README.md @@ -2,8 +2,6 @@ SwipeAction 滑动操作组件。 --- 结合手势操作,从屏幕一侧唤出操作。 -![](https://user-images.githubusercontent.com/57083007/146733663-6c83fca4-72df-424d-8364-47533f57ece6.gif) - ### 基础示例 ```jsx From c55cb300c1dddc3c2a7ad9f721087503facf4846 Mon Sep 17 00:00:00 2001 From: WX <42308734@qq.com> Date: Mon, 13 Feb 2023 11:08:10 +0800 Subject: [PATCH 02/10] =?UTF-8?q?doc:SwipeAction=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/SwipeAction/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/SwipeAction/README.md b/packages/core/src/SwipeAction/README.md index 74799abe6..d59dcaa2b 100644 --- a/packages/core/src/SwipeAction/README.md +++ b/packages/core/src/SwipeAction/README.md @@ -5,11 +5,12 @@ SwipeAction 滑动操作组件。 ### 基础示例 ```jsx -import React from 'react'; +import React,{ useRef } from 'react'; import {SwipeAction} from '@uiw/react-native'; import { View,Text } from 'react-native' function Demo() { + const ref = useRef() const right = [ { text: '查看', From 48b2c952fb8de929baa78b81da82941e76a7b3c4 Mon Sep 17 00:00:00 2001 From: WX <42308734@qq.com> Date: Mon, 13 Feb 2023 13:17:46 +0800 Subject: [PATCH 03/10] =?UTF-8?q?doc:SwipeAction=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/SwipeAction/README.md | 33 ++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/packages/core/src/SwipeAction/README.md b/packages/core/src/SwipeAction/README.md index d59dcaa2b..1180f76b4 100644 --- a/packages/core/src/SwipeAction/README.md +++ b/packages/core/src/SwipeAction/README.md @@ -2,8 +2,40 @@ SwipeAction 滑动操作组件。 --- 结合手势操作,从屏幕一侧唤出操作。 +![](https://user-images.githubusercontent.com/57083007/146733663-6c83fca4-72df-424d-8364-47533f57ece6.gif) + ### 基础示例 +```jsx +import React from 'react'; +import {SwipeAction} from '@uiw/react-native'; +import { View,Text } from 'react-native' + +function Demo() { + const right = [ + { + text: '查看', + color: 'orange', + x: 250, + onPress: () => ref?.current?.swipeable.close() + }, + { + text: '删除', + color: 'red', + x: 250, + }, + ]; + return ( + + 滑动 + + ); +} +export default Demo; +``` + +### 禁用 + ```jsx import React,{ useRef } from 'react'; import {SwipeAction} from '@uiw/react-native'; @@ -16,7 +48,6 @@ function Demo() { text: '查看', color: 'orange', x: 250, - onPress: () => ref?.current?.swipeable.close() }, { text: '删除', From 2d79cb5edea3b867ca2ffb796e72d57f2260edb8 Mon Sep 17 00:00:00 2001 From: zhouzheng Date: Tue, 10 Jan 2023 16:07:02 +0800 Subject: [PATCH 04/10] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E5=9B=BE=E7=89=87=E5=8A=A0=E8=BD=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website/src/component/Preview/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/website/src/component/Preview/index.js b/website/src/component/Preview/index.js index 7b8181038..4ff362d16 100644 --- a/website/src/component/Preview/index.js +++ b/website/src/component/Preview/index.js @@ -40,6 +40,16 @@ const getBooleanValue = (param, field, defaultValue) => { const Preview = ({ path, ...mdData }) => { const $dom = useRef(null); + + const transformImageUri = (url) => { + const callback = (path) => { + const reqImage = require.context(path, true, /\.(png|gif|jpg|svg)$/); + const urlImage = reqImage(url); + return urlImage; + }; + return mdData.transformImageUriPath(callback); + }; + return ( Date: Tue, 10 Jan 2023 16:55:52 +0800 Subject: [PATCH 05/10] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E5=9B=BE=E7=89=87=E5=8A=A0=E8=BD=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website/src/component/Preview/index.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/website/src/component/Preview/index.js b/website/src/component/Preview/index.js index 4ff362d16..e8beb75dc 100644 --- a/website/src/component/Preview/index.js +++ b/website/src/component/Preview/index.js @@ -41,15 +41,6 @@ const getBooleanValue = (param, field, defaultValue) => { const Preview = ({ path, ...mdData }) => { const $dom = useRef(null); - const transformImageUri = (url) => { - const callback = (path) => { - const reqImage = require.context(path, true, /\.(png|gif|jpg|svg)$/); - const urlImage = reqImage(url); - return urlImage; - }; - return mdData.transformImageUriPath(callback); - }; - return ( Date: Thu, 12 Jan 2023 10:08:46 +0800 Subject: [PATCH 06/10] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=85=B3?= =?UTF-8?q?=E4=BA=8Euiw=E5=BA=95=E9=83=A8foote=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website/src/component/Preview/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/website/src/component/Preview/index.js b/website/src/component/Preview/index.js index e8beb75dc..7b8181038 100644 --- a/website/src/component/Preview/index.js +++ b/website/src/component/Preview/index.js @@ -40,7 +40,6 @@ const getBooleanValue = (param, field, defaultValue) => { const Preview = ({ path, ...mdData }) => { const $dom = useRef(null); - return ( Date: Tue, 14 Feb 2023 16:12:57 +0800 Subject: [PATCH 07/10] =?UTF-8?q?fix(doc):=20=E6=96=87=E6=A1=A3=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E8=89=B2=20BUG=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website/src/component/Preview/index.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/website/src/component/Preview/index.js b/website/src/component/Preview/index.js index 7b8181038..99ceb0268 100644 --- a/website/src/component/Preview/index.js +++ b/website/src/component/Preview/index.js @@ -28,12 +28,7 @@ const Markdown = styled(MarkdownPreview)` const getBooleanValue = (param, field, defaultValue) => { if (Reflect.has(param, field)) { const newValue = Reflect.get(param, field); - if (newValue === 'true') { - return true; - } - if (newValue === 'false') { - return false; - } + return newValue === 'true'; } return defaultValue; }; From f9f3696861ee0b55e07363635d5658d4b2a95eb5 Mon Sep 17 00:00:00 2001 From: hy Date: Wed, 15 Feb 2023 17:50:24 +0800 Subject: [PATCH 08/10] =?UTF-8?q?fix=EF=BC=9A=E6=B7=BB=E5=8A=A0NoticeBar?= =?UTF-8?q?=20=E9=80=9A=E5=91=8A=E6=A0=8F=E7=BB=84=E4=BB=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/NoticeBar/index.tsx | 4 +-- test-ci/src/__tests__/noticeBar.tsx | 46 +++++++++++++-------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/packages/core/src/NoticeBar/index.tsx b/packages/core/src/NoticeBar/index.tsx index f4c646b8b..ab9441fab 100644 --- a/packages/core/src/NoticeBar/index.tsx +++ b/packages/core/src/NoticeBar/index.tsx @@ -40,7 +40,7 @@ const NoticeBar = (props: NoticeBarProps) => { operationDom = {action ? action : }; } const main = ( - + {icon && {icon}} @@ -54,7 +54,7 @@ const NoticeBar = (props: NoticeBarProps) => { mode === 'closable' ? ( main ) : ( - {main} + {main} ) ) : null} diff --git a/test-ci/src/__tests__/noticeBar.tsx b/test-ci/src/__tests__/noticeBar.tsx index c654036cf..2a0c30610 100644 --- a/test-ci/src/__tests__/noticeBar.tsx +++ b/test-ci/src/__tests__/noticeBar.tsx @@ -44,30 +44,30 @@ describe('NoticeBar', () => { expect(component.props.style).toMatchObject({ fontSize: 12 }); }); - // it('onPress', () => { - // const fn = jest.fn(); - // const { getByTestId } = render(onPress); - // const component = getByTestId('RNE__NoticeBar__wrap'); - // fireEvent(component, 'press'); - // expect(fn).toHaveBeenCalled(); - // }); + it('textStyle', () => { + const { UNSAFE_getByType } = render(); + const component = UNSAFE_getByType(Marquee); + expect(component.props.style[1].fontSize).toBe(20); + }); + + it('onPress events', () => { + const fn = jest.fn(); + const { getByTestId } = render(onPress); + const component = getByTestId('RNE__NoticeBar__link'); + fireEvent(component, 'press'); + expect(fn).toHaveBeenCalled(); + }); - // it('action', () => { - // const { getByText } = render(去看看} />); - // expect(getByText('去看看')).toBeTruthy(); - // }); + it('action', () => { + const { getByText } = render(去看看} />); + expect(getByText('去看看')).toBeTruthy(); + }); - // it('style', () => { - // const { getByTestId } = render(); - // const component = getByTestId('RNE__NoticeBar__wrap'); - // const styles = toObject(component.props.style); - // expect(styles.height).toBe(50); - // }); + it('style', () => { + const { getByTestId } = render(); + const component = getByTestId('RNE__NoticeBar__style'); + const styles = toObject(component.props.style); + expect(styles.height).toBe(50); + }); - // it('textStyle', () => { - // const { getByTestId } = render(); - // const component = getByTestId('RNE__NoticeBar__div'); - // const styles = toObject(component.props.style); - // expect(styles.fontSize).toBe(20); - // }); }); From 17dbf8f16578956d121abc684a2f6cb4fe108213 Mon Sep 17 00:00:00 2001 From: hy Date: Wed, 15 Feb 2023 17:51:40 +0800 Subject: [PATCH 09/10] =?UTF-8?q?fix=EF=BC=9A=E4=BC=98=E5=8C=96=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E7=BB=84=E4=BB=B6=E5=9C=A8=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/Calendar/index.tsx | 30 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/core/src/Calendar/index.tsx b/packages/core/src/Calendar/index.tsx index e1a58bb73..96326533f 100644 --- a/packages/core/src/Calendar/index.tsx +++ b/packages/core/src/Calendar/index.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { View, Text, ViewProps, StyleSheet, TouchableOpacity, Dimensions, Platform } from 'react-native'; +import { View, Text, ViewProps, TextProps, StyleSheet, TouchableOpacity, Dimensions, Platform } from 'react-native'; import Icon from '../Icon'; import Ellipsis from '../Ellipsis'; import { getMonths, getWeeksArray, daysArrProps, getType, getNameLen } from './utils'; @@ -112,7 +112,7 @@ const Calendar = (props: CalendarProps) => { let nameLen = getNameLen(day.lunarHolidays); let lineHeight = - lunarHoliday === true && Platform.OS === 'ios' ? 0 : lunarHoliday === true ? MainWidth < 1000 ? 18 : 55 : MainWidth < 1000 ? MainWidth / 7 - 4.5 : MainWidth / 14.5; + lunarHoliday === true && Platform.OS === 'ios' ? 0 : lunarHoliday === true ? 18 : MainWidth / 7 - 4.5; let paddingTop = lunarHoliday === true ? 4 : 0; let colorType = ''; if (day.colorType === '') { @@ -211,9 +211,9 @@ const Calendar = (props: CalendarProps) => { setCurrentMonth(toMonth); setCurrentDays(toDays); }; - // const goCurrentDay = (day: number) => { - // setCurrentDays(day); - // }; + const goCurrentDay = (day: number) => { + setCurrentDays(day); + }; return ( @@ -298,10 +298,10 @@ const styles = StyleSheet.create({ }, calendarWeekdays: { flexDirection: 'row', - justifyContent: 'space-around', + justifyContent: 'space-between', alignItems: 'center', - paddingHorizontal: MainWidth < 1000 ? MainWidth / 7 - 33 : MainWidth / 30, - paddingTop: 12, + paddingHorizontal: MainWidth / 7 - 33, + paddingTop: 10, }, calendarWedText: { color: '#616161', @@ -312,12 +312,12 @@ const styles = StyleSheet.create({ }, weekDay: { flexDirection: 'row', - paddingHorizontal: 22, + paddingHorizontal: 2, }, dateBase: { - marginHorizontal: 8, - width: MainWidth < 1000 ? MainWidth / 7 - 4.5 : MainWidth / 14, - height: MainHeight < 300 ? MainWidth / 7 - 4.5 : MainWidth / 14, + marginHorizontal: 2, + width: MainWidth / 7 - 4.5, + height: MainWidth / 7 - 4.5, ...Platform.select({ ios: {}, android: { @@ -327,15 +327,15 @@ const styles = StyleSheet.create({ }, currentMonth: { backgroundColor: '#329BCB', - borderRadius: 60, + borderRadius: 50, }, selectMonth: { borderWidth: 1, borderColor: '#329BCB', - borderRadius: 60, + borderRadius: 50, }, otherMonth: { - borderRadius: 60, + borderRadius: 50, }, dayText: { textAlign: 'center', From 939cee3eb0b25a345defb6798a58abbb5de48dd8 Mon Sep 17 00:00:00 2001 From: hy Date: Wed, 15 Feb 2023 17:52:07 +0800 Subject: [PATCH 10/10] =?UTF-8?q?fix=EF=BC=9A=E4=BC=98=E5=8C=96Picker=20?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=99=A8=E7=BB=84=E4=BB=B6=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/Picker/README.md | 49 ++++++------------------------ 1 file changed, 10 insertions(+), 39 deletions(-) diff --git a/packages/core/src/Picker/README.md b/packages/core/src/Picker/README.md index ca5b931d9..8a0e90adc 100644 --- a/packages/core/src/Picker/README.md +++ b/packages/core/src/Picker/README.md @@ -61,45 +61,16 @@ function Demo() { export default Demo ``` - - ### Props -```ts -import { StyleProp, TextStyle, ViewStyle } from 'react-native'; - -export interface PickerData { - label?: string, - render?: (key: string, record: PickerData, index: number)=>React.ReactNode, - [key: string]: any -} +属性 | 说明 | 类型 | 默认值 +----|-----|------|------ +| lines | 显示行数 | number | 3 | +| rowKey | 在开始位置设置图标 | string | - | +| data | 需要渲染的数据 | Array | - | +| containerStyle | item 容器样式 | obj | - | +| textStyle | 容器的文本样式 | TextStyle | - | +| value | 选中当前项的下标 | number | - | +| onChange | value 改变时触发 | fn | - | +| readonly | 是否只读 | fn | - | -export interface PickerProps { - /** 显示几行, 默认 3 */ - lines?: number, - /** 指定需要显示的 key, 默认使用 data 的 label 属性 */ - rowKey?: string, - /** 需要渲染的数据 */ - data?: Array, - /** item 容器样式 */ - containerStyle?: { - /** 激活的容器样式 */ - actived?: StyleProp, - /** 未激活的容器样式 */ - unactived?: StyleProp, - }, - /** 容器的文本样式 */ - textStyle?: { - /** 激活的文本样式 */ - actived?: StyleProp, - /** 未激活的文本样式 */ - unactived?: StyleProp, - }, - /** 选中当前项的下标 */ - value?: number, - /** value 改变时触发 */ - onChange?: (value: number)=>unknown, - /** 是否只读 不能点击不能滑动但可以通过value控制 */ - readonly?: boolean -} -```