Skip to content

Commit 9025a9a

Browse files
Amber-Nan杨楠
andauthored
feat(DragDrawer):自定义抽屉样式 (#351)
* fix(Divider):优化 gutter属性不生效问题 * feat(Divider): 增加分割线标题的位置调整功能 & 更新文档 * feat(Rating):增加自定义每项的提示信息 & 更新文档 * feat(Rating):增加只读功能 & 文档更新 * feat(Timeline): 增加改变时间轴内容相对位置功能 & 文档更新 * style(Timeline):Update Readme.md img * feat(Timeline):增加自定义图标 & 文档更新 * feat(Timeline):优化自定义图标 & 文档更新 * feat:新增Calendar 日历组件 * doc(website): Update Calendar Readme.md * feat(Calendar):增加农历及假期展示 && 文档更新 * feat(Calendar):增加假日文字颜色 * feat(Calendar):左上角按钮增加自定义跳转功能&文档更新 * feat(Calendar):优化农历假日及文字排版 * feat(Calendar):处理文字长度 * fix(Calendar):优化安卓文字排版 * feat(Calendar):增加农历详情展示 & 文档更新 * feat(DragDrawer):新增DragDrawer 拖曳抽屉 & 文档更新 * doc(website): 增加DragDrawer目录 * feat(DragDrawer):增加自定义图标 & 文档更新 * feat(DragDrawer): 增加抽屉自定义样式 & 文档更新 * feat(DragDrawer): 增加抽屉自定义样式 & 文档更新 * feat(DragDrawer):自定义抽屉样式 Co-authored-by: 杨楠 <yangnan@nihaosi.com>
1 parent ba75110 commit 9025a9a

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

packages/core/src/DragDrawer/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,4 @@ export default function DragDrawerView({ route }: DragDrawerViewProps) {
5454
| `drawerHeight` | 抽屉高度 | Number | `300` |
5555
| `drawerBackgroundColor` | 指定抽屉背景色 | String | `#fff` |
5656
| `icon` | 自定义图标 | `IconsName | React.ReactElement | React.ReactNode` | |
57+
| `style` | 自定义抽屉样式 | `StyleProp<ViewStyle>` | |

packages/core/src/DragDrawer/index.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
UIManager, // 动画
1212
Animated, // 动画
1313
PanResponder, // 手指拖拽
14+
StyleProp,
1415
} from 'react-native';
1516
import Icon, { IconsName } from '../Icon';
1617

@@ -31,7 +32,7 @@ export interface DragDrawerProps extends ViewProps {
3132
}
3233

3334
function DragDrawer(props: DragDrawerProps) {
34-
const { drawerBackgroundColor = '#fff', drawerHeight = 300, children, icon } = props;
35+
const { drawerBackgroundColor = '#fff', drawerHeight = 300, children, icon, style } = props;
3536

3637
const [animatedViewHeight, setAnimatedViewHeight] = useState(new Animated.Value(drawerHeight));
3738
const [viewHeight, setViewHeight] = useState(drawerHeight);
@@ -73,7 +74,7 @@ function DragDrawer(props: DragDrawerProps) {
7374
//结束位置在折叠线一下 则关闭
7475
setViewHeight(30);
7576
Animated.timing(animatedViewHeight, {
76-
toValue: 30,
77+
toValue: 50,
7778
duration: 300,
7879
useNativeDriver: false,
7980
}).start();
@@ -116,13 +117,7 @@ function DragDrawer(props: DragDrawerProps) {
116117

117118
return (
118119
<Animated.View
119-
style={[
120-
styles.drawer,
121-
dynamicDrawerStyles,
122-
{
123-
height: animatedViewHeight,
124-
},
125-
]}
120+
style={StyleSheet.flatten([styles.drawer, dynamicDrawerStyles, style, { height: animatedViewHeight }])}
126121
{...panResponder.panHandlers}
127122
>
128123
<Animated.View style={[styles.viewPosition]}>

0 commit comments

Comments
 (0)