@unif/react-native-ui 0.2.2 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/action-sheet/style/index.js.map +1 -1
- package/lib/commonjs/avatar/index.js.map +1 -1
- package/lib/commonjs/chip/index.js +2 -7
- package/lib/commonjs/chip/index.js.map +1 -1
- package/lib/commonjs/chip/style/index.js +5 -0
- package/lib/commonjs/chip/style/index.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/input/index.js.map +1 -1
- package/lib/commonjs/list-item/index.js.map +1 -1
- package/lib/commonjs/popover/index.js.map +1 -1
- package/lib/commonjs/space/index.js.map +1 -1
- package/lib/commonjs/text/index.js.map +1 -1
- package/lib/commonjs/wave-animation/index.js.map +1 -1
- package/lib/module/action-sheet/style/index.js.map +1 -1
- package/lib/module/avatar/index.js.map +1 -1
- package/lib/module/chip/index.js +2 -7
- package/lib/module/chip/index.js.map +1 -1
- package/lib/module/chip/style/index.js +5 -0
- package/lib/module/chip/style/index.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/input/index.js.map +1 -1
- package/lib/module/list-item/index.js.map +1 -1
- package/lib/module/popover/index.js.map +1 -1
- package/lib/module/space/index.js.map +1 -1
- package/lib/module/text/index.js.map +1 -1
- package/lib/module/wave-animation/index.js.map +1 -1
- package/lib/typescript/commonjs/docs-src/components/ExpoSnack.d.ts +11 -0
- package/lib/typescript/commonjs/docs-src/components/ExpoSnack.d.ts.map +1 -0
- package/lib/typescript/commonjs/docusaurus.config.d.ts +4 -0
- package/lib/typescript/commonjs/docusaurus.config.d.ts.map +1 -0
- package/lib/typescript/commonjs/sidebars.d.ts +4 -0
- package/lib/typescript/commonjs/sidebars.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/action-sheet/style/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/avatar/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/chip/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/chip/style/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/chip/style/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/input/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/list-item/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/popover/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/space/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/text/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/wave-animation/index.d.ts.map +1 -1
- package/lib/typescript/module/docs-src/components/ExpoSnack.d.ts +11 -0
- package/lib/typescript/module/docs-src/components/ExpoSnack.d.ts.map +1 -0
- package/lib/typescript/module/docusaurus.config.d.ts +4 -0
- package/lib/typescript/module/docusaurus.config.d.ts.map +1 -0
- package/lib/typescript/module/sidebars.d.ts +4 -0
- package/lib/typescript/module/sidebars.d.ts.map +1 -0
- package/lib/typescript/module/src/action-sheet/style/index.d.ts.map +1 -1
- package/lib/typescript/module/src/avatar/index.d.ts.map +1 -1
- package/lib/typescript/module/src/chip/index.d.ts.map +1 -1
- package/lib/typescript/module/src/chip/style/index.d.ts +1 -0
- package/lib/typescript/module/src/chip/style/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +1 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/input/index.d.ts.map +1 -1
- package/lib/typescript/module/src/list-item/index.d.ts.map +1 -1
- package/lib/typescript/module/src/popover/index.d.ts.map +1 -1
- package/lib/typescript/module/src/space/index.d.ts.map +1 -1
- package/lib/typescript/module/src/text/index.d.ts.map +1 -1
- package/lib/typescript/module/src/wave-animation/index.d.ts.map +1 -1
- package/package.json +16 -2
- package/src/action-sheet/index.tsx +1 -1
- package/src/action-sheet/style/index.tsx +1 -3
- package/src/avatar/index.tsx +5 -2
- package/src/button/index.tsx +2 -2
- package/src/button/style/index.tsx +1 -1
- package/src/chip/index.tsx +12 -4
- package/src/chip/style/index.tsx +7 -1
- package/src/index.tsx +4 -1
- package/src/input/index.tsx +59 -54
- package/src/list-item/index.tsx +3 -4
- package/src/popover/index.tsx +6 -7
- package/src/space/index.tsx +1 -3
- package/src/text/index.tsx +6 -1
- package/src/wave-animation/index.tsx +7 -4
- package/lib/commonjs/action-sheet/index.md +0 -69
- package/lib/commonjs/avatar/index.md +0 -51
- package/lib/commonjs/button/index.md +0 -90
- package/lib/commonjs/center/index.md +0 -28
- package/lib/commonjs/chip/index.md +0 -60
- package/lib/commonjs/column/index.md +0 -34
- package/lib/commonjs/divider/index.md +0 -44
- package/lib/commonjs/hooks/index.md +0 -71
- package/lib/commonjs/input/index.md +0 -73
- package/lib/commonjs/list-item/index.md +0 -101
- package/lib/commonjs/popover/index.md +0 -57
- package/lib/commonjs/row/index.md +0 -46
- package/lib/commonjs/space/index.md +0 -31
- package/lib/commonjs/text/index.md +0 -63
- package/lib/commonjs/touchable/index.md +0 -42
- package/lib/commonjs/wave-animation/index.md +0 -50
- package/lib/module/action-sheet/index.md +0 -69
- package/lib/module/avatar/index.md +0 -51
- package/lib/module/button/index.md +0 -90
- package/lib/module/center/index.md +0 -28
- package/lib/module/chip/index.md +0 -60
- package/lib/module/column/index.md +0 -34
- package/lib/module/divider/index.md +0 -44
- package/lib/module/hooks/index.md +0 -71
- package/lib/module/input/index.md +0 -73
- package/lib/module/list-item/index.md +0 -101
- package/lib/module/popover/index.md +0 -57
- package/lib/module/row/index.md +0 -46
- package/lib/module/space/index.md +0 -31
- package/lib/module/text/index.md +0 -63
- package/lib/module/touchable/index.md +0 -42
- package/lib/module/wave-animation/index.md +0 -50
- package/src/action-sheet/index.md +0 -69
- package/src/avatar/index.md +0 -51
- package/src/button/index.md +0 -90
- package/src/center/index.md +0 -28
- package/src/chip/index.md +0 -60
- package/src/column/index.md +0 -34
- package/src/divider/index.md +0 -44
- package/src/hooks/index.md +0 -71
- package/src/input/index.md +0 -73
- package/src/list-item/index.md +0 -101
- package/src/popover/index.md +0 -57
- package/src/row/index.md +0 -46
- package/src/space/index.md +0 -31
- package/src/text/index.md +0 -63
- package/src/touchable/index.md +0 -42
- package/src/wave-animation/index.md +0 -50
package/src/column/index.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Column 垂直布局
|
|
2
|
-
|
|
3
|
-
垂直排列子元素。语义化替代裸 `<View>`,显式声明布局方向。
|
|
4
|
-
|
|
5
|
-
## 何时使用
|
|
6
|
-
|
|
7
|
-
- 需要显式声明垂直布局方向时
|
|
8
|
-
- 需要 `gap`、`align`、`justify` 等布局属性时
|
|
9
|
-
|
|
10
|
-
## 代码演示
|
|
11
|
-
|
|
12
|
-
```tsx
|
|
13
|
-
// 基础用法
|
|
14
|
-
<Column gap={8}>
|
|
15
|
-
<Text variant="heading">标题</Text>
|
|
16
|
-
<Text variant="caption" secondary>描述文字</Text>
|
|
17
|
-
</Column>
|
|
18
|
-
|
|
19
|
-
// 居中对齐
|
|
20
|
-
<Column align="center" justify="center" style={{flex: 1}}>
|
|
21
|
-
<Icon name="empty" />
|
|
22
|
-
<Text>暂无数据</Text>
|
|
23
|
-
</Column>
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## API
|
|
27
|
-
|
|
28
|
-
| 属性 | 说明 | 类型 | 默认值 |
|
|
29
|
-
|------|------|------|--------|
|
|
30
|
-
| align | alignItems | `ViewStyle['alignItems']` | - |
|
|
31
|
-
| justify | justifyContent | `ViewStyle['justifyContent']` | - |
|
|
32
|
-
| gap | 子元素间距 | `number` | - |
|
|
33
|
-
|
|
34
|
-
> 继承所有 RN `ViewProps`
|
package/src/divider/index.md
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# Divider 分割线
|
|
2
|
-
|
|
3
|
-
用于独立的视觉分隔元素。
|
|
4
|
-
|
|
5
|
-
## 何时使用
|
|
6
|
-
|
|
7
|
-
- 替代独立的 `<View style={{height: 1, backgroundColor: border}} />`
|
|
8
|
-
- 列表项之间的分隔线(如 `FlatList` 的 `ItemSeparatorComponent`)
|
|
9
|
-
|
|
10
|
-
## 何时不使用
|
|
11
|
-
|
|
12
|
-
- **不替换**容器自带的 `borderBottomWidth`(内嵌 border 保留原样)
|
|
13
|
-
- 容器 header / footer 的 `borderTopWidth` / `borderBottomWidth` 属于布局边界,改为独立 View 会影响 flex 布局
|
|
14
|
-
|
|
15
|
-
| 场景 | 处理 | 原因 |
|
|
16
|
-
|------|------|------|
|
|
17
|
-
| `<View style={styles.separator} />` | ✅ 用 `<Divider />` | 独立分割元素 |
|
|
18
|
-
| `styles.itemRow { borderBottomWidth }` | ❌ 保留原样 | 内嵌于容器 |
|
|
19
|
-
| `styles.header { borderBottomWidth }` | ❌ 保留原样 | 布局边界 |
|
|
20
|
-
|
|
21
|
-
## 代码演示
|
|
22
|
-
|
|
23
|
-
```tsx
|
|
24
|
-
// 默认 hairline
|
|
25
|
-
<Divider />
|
|
26
|
-
|
|
27
|
-
// 1px 带水平边距(列表分隔)
|
|
28
|
-
<Divider hairline={false} marginHorizontal={12} />
|
|
29
|
-
|
|
30
|
-
// 作为 FlatList 分隔
|
|
31
|
-
const Separator = () => <Divider hairline={false} marginHorizontal={12} />;
|
|
32
|
-
<FlatList ItemSeparatorComponent={Separator} ... />
|
|
33
|
-
|
|
34
|
-
// 自定义样式
|
|
35
|
-
<Divider style={{backgroundColor: 'red', marginVertical: 8}} />
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## API
|
|
39
|
-
|
|
40
|
-
| 属性 | 说明 | 类型 | 默认值 |
|
|
41
|
-
|------|------|------|--------|
|
|
42
|
-
| hairline | 使用 `StyleSheet.hairlineWidth` | `boolean` | `true` |
|
|
43
|
-
| marginHorizontal | 水平边距 | `number` | - |
|
|
44
|
-
| style | 自定义样式 | `ViewStyle` | - |
|
package/src/hooks/index.md
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# Hooks
|
|
2
|
-
|
|
3
|
-
基础组件库的工具 hooks。
|
|
4
|
-
|
|
5
|
-
## mergeStyles
|
|
6
|
-
|
|
7
|
-
按 slot 维度合并多来源样式的纯函数。借鉴 antd v6 `useMergeSemantic`(`components/_util/hooks/useMergeSemantic.ts:69-80`)。
|
|
8
|
-
|
|
9
|
-
### 何时使用
|
|
10
|
-
|
|
11
|
-
- 组件内部合并默认样式 + 变体样式 + 用户传入的 `styles` 语义插槽
|
|
12
|
-
- 构建支持 Semantic Styles 的自定义组件时
|
|
13
|
-
|
|
14
|
-
### 代码演示
|
|
15
|
-
|
|
16
|
-
```tsx
|
|
17
|
-
import {mergeStyles} from '../hooks';
|
|
18
|
-
|
|
19
|
-
type MySemanticStyles = {
|
|
20
|
-
root?: ViewStyle;
|
|
21
|
-
content?: TextStyle;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const DEFAULT: MySemanticStyles = {
|
|
25
|
-
root: {padding: 16},
|
|
26
|
-
content: {fontSize: 14, color: tokens.colorText},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const MyComponent = ({styles: userStyles}: {styles?: Partial<MySemanticStyles>}) => {
|
|
30
|
-
// ✅ 配合 useMemo,仅 userStyles 变化时重算
|
|
31
|
-
const s = useMemo(
|
|
32
|
-
() => mergeStyles(DEFAULT, userStyles),
|
|
33
|
-
[userStyles],
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<View style={s.root}>
|
|
38
|
-
<Text style={s.content}>...</Text>
|
|
39
|
-
</View>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### API
|
|
45
|
-
|
|
46
|
-
```ts
|
|
47
|
-
function mergeStyles<T extends Record<string, StyleValue | undefined>>(
|
|
48
|
-
...sources: (Partial<T> | undefined)[]
|
|
49
|
-
): T
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
| 参数 | 说明 | 类型 |
|
|
53
|
-
|------|------|------|
|
|
54
|
-
| sources | 多个样式源,按顺序合并 | `(Partial<T> \| undefined)[]` |
|
|
55
|
-
|
|
56
|
-
### 合并规则
|
|
57
|
-
|
|
58
|
-
- 按 slot key 维度合并(`root`、`content` 等分别合并)
|
|
59
|
-
- 同一 slot 内使用对象展开(`{...prev, ...next}`),后传入的覆盖先传入的
|
|
60
|
-
- `undefined` 源自动跳过
|
|
61
|
-
- 纯函数,不包含 `useMemo`,调用方自行控制缓存
|
|
62
|
-
|
|
63
|
-
### 与 antd v6 对比
|
|
64
|
-
|
|
65
|
-
| 特性 | antd v6 `mergeStyles` | RN 版 `mergeStyles` |
|
|
66
|
-
|------|----------------------|---------------------|
|
|
67
|
-
| classNames 合并 | ✅ | ❌(RN 无 CSS 类名) |
|
|
68
|
-
| schema 嵌套 | ✅ | ❌(当前不需要) |
|
|
69
|
-
| 函数形式 style | ✅ | ❌(不需要动态计算) |
|
|
70
|
-
| slot 展开合并 | ✅ | ✅(核心逻辑一致) |
|
|
71
|
-
| 纯函数 | ✅ | ✅ |
|
package/src/input/index.md
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Input
|
|
3
|
-
nav:
|
|
4
|
-
title: 组件
|
|
5
|
-
order: 1
|
|
6
|
-
group:
|
|
7
|
-
title: 基础
|
|
8
|
-
order: 2
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Input 输入框
|
|
12
|
-
|
|
13
|
-
TextInput 容器,支持多行输入、底部工具栏和自动聚焦。
|
|
14
|
-
|
|
15
|
-
## 何时使用
|
|
16
|
-
|
|
17
|
-
- 需要文本输入时
|
|
18
|
-
- 需要带工具栏的输入框时
|
|
19
|
-
- 聊天输入场景
|
|
20
|
-
|
|
21
|
-
## 代码演示
|
|
22
|
-
|
|
23
|
-
```tsx
|
|
24
|
-
import { Input, Icon } from '@unif/react-native-ui';
|
|
25
|
-
|
|
26
|
-
// 基本用法
|
|
27
|
-
<Input
|
|
28
|
-
value={text}
|
|
29
|
-
onChangeText={setText}
|
|
30
|
-
placeholder="请输入..."
|
|
31
|
-
/>
|
|
32
|
-
|
|
33
|
-
// 多行 + 工具栏
|
|
34
|
-
<Input
|
|
35
|
-
multiline
|
|
36
|
-
maxHeight={100}
|
|
37
|
-
autoFocus
|
|
38
|
-
toolbar={
|
|
39
|
-
<View style={{ flexDirection: 'row' }}>
|
|
40
|
-
<Icon name="mic-outline" size={24} />
|
|
41
|
-
</View>
|
|
42
|
-
}
|
|
43
|
-
/>
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## API
|
|
47
|
-
|
|
48
|
-
| 属性 | 说明 | 类型 | 默认值 |
|
|
49
|
-
| --------------- | ---------------- | ---------------------- | ------- |
|
|
50
|
-
| value | 输入值 | `string` | - |
|
|
51
|
-
| onChangeText | 文本变化回调 | `(text: string) => void` | - |
|
|
52
|
-
| placeholder | 占位文本 | `string` | - |
|
|
53
|
-
| multiline | 多行模式 | `boolean` | `false` |
|
|
54
|
-
| maxLength | 最大字符数 | `number` | - |
|
|
55
|
-
| maxHeight | 最大高度 | `number` | - |
|
|
56
|
-
| autoFocus | 自动聚焦 | `boolean` | - |
|
|
57
|
-
| returnKeyType | 回车键类型 | `ReturnKeyTypeOptions` | - |
|
|
58
|
-
| onSubmitEditing | 提交回调 | `() => void` | - |
|
|
59
|
-
| onBlur | 失焦回调 | `() => void` | - |
|
|
60
|
-
| onFocus | 聚焦回调 | `() => void` | - |
|
|
61
|
-
| disabled | 禁用状态 | `boolean` | - |
|
|
62
|
-
| toolbar | 底部工具栏 | `ReactNode` | - |
|
|
63
|
-
| style | 容器样式 | `ViewStyle` | - |
|
|
64
|
-
| styles | 语义样式 | `InputSemanticStyles` | - |
|
|
65
|
-
| testID | 测试标识 | `string` | - |
|
|
66
|
-
|
|
67
|
-
## Semantic Styles
|
|
68
|
-
|
|
69
|
-
| Slot | 说明 |
|
|
70
|
-
| ------- | -------------- |
|
|
71
|
-
| root | 外层容器 |
|
|
72
|
-
| input | TextInput 本身 |
|
|
73
|
-
| toolbar | 工具栏容器 |
|
package/src/list-item/index.md
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
# ListItem 列表行
|
|
2
|
-
|
|
3
|
-
4 个语义 slot(root / content / description / extra),支持 `styles` 精确覆盖。
|
|
4
|
-
|
|
5
|
-
## 何时使用
|
|
6
|
-
|
|
7
|
-
- 替代 `<TouchableOpacity>` + icon + text + arrow 的手写列表行
|
|
8
|
-
- 统一列表行样式:设置菜单、选择列表、会话列表等
|
|
9
|
-
|
|
10
|
-
## 代码演示
|
|
11
|
-
|
|
12
|
-
```tsx
|
|
13
|
-
// 基础 — 带箭头
|
|
14
|
-
<ListItem title="关于" arrow onPress={handleAbout} />
|
|
15
|
-
|
|
16
|
-
// 带右侧额外信息
|
|
17
|
-
<ListItem title="关于" extra="v1.0.0" onPress={handleAbout} />
|
|
18
|
-
|
|
19
|
-
// 带左侧图标
|
|
20
|
-
<ListItem
|
|
21
|
-
thumb={<Icon name="information-circle-outline" size={22} color={tokens.colorTextSecondary} />}
|
|
22
|
-
title="关于"
|
|
23
|
-
extra="v1.0.0"
|
|
24
|
-
onPress={handleAbout}
|
|
25
|
-
/>
|
|
26
|
-
|
|
27
|
-
// 带描述文字(双行)
|
|
28
|
-
<ListItem
|
|
29
|
-
thumb={<Icon name="chatbubble-outline" size={16} />}
|
|
30
|
-
title="今天的会话"
|
|
31
|
-
description="最后一条消息预览..."
|
|
32
|
-
onPress={handleSelect}
|
|
33
|
-
onLongPress={handleDelete}
|
|
34
|
-
/>
|
|
35
|
-
|
|
36
|
-
// 语义插槽覆盖 — 选中态
|
|
37
|
-
<ListItem
|
|
38
|
-
title={model.name}
|
|
39
|
-
description={model.desc}
|
|
40
|
-
extra={isSelected ? <Icon name="checkmark-circle" size={22} color={tokens.colorPrimary} /> : undefined}
|
|
41
|
-
onPress={() => handleSelect(model.id)}
|
|
42
|
-
styles={isSelected ? {
|
|
43
|
-
root: {backgroundColor: '#FFF7F0'},
|
|
44
|
-
content: {color: tokens.colorPrimary},
|
|
45
|
-
} : undefined}
|
|
46
|
-
/>
|
|
47
|
-
|
|
48
|
-
// 语义插槽覆盖 — 危险操作
|
|
49
|
-
<ListItem
|
|
50
|
-
thumb={<Icon name="log-out-outline" size={22} color={tokens.colorError} />}
|
|
51
|
-
title="退出登录"
|
|
52
|
-
onPress={handleLogout}
|
|
53
|
-
styles={{content: {color: tokens.colorError}}}
|
|
54
|
-
/>
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## API
|
|
58
|
-
|
|
59
|
-
| 属性 | 说明 | 类型 | 默认值 |
|
|
60
|
-
|------|------|------|--------|
|
|
61
|
-
| thumb | 左侧缩略(图标、头像等) | `ReactNode` | - |
|
|
62
|
-
| title | 主标题 | `string` \| `ReactNode` | **必填** |
|
|
63
|
-
| description | 描述文字(单行截断) | `string` | - |
|
|
64
|
-
| extra | 右侧额外内容 | `ReactNode` \| `string` | - |
|
|
65
|
-
| arrow | 显示右箭头 | `boolean` | `false` |
|
|
66
|
-
| onPress | 点击回调(有值时渲染为 Pressable) | `() => void` | - |
|
|
67
|
-
| onLongPress | 长按回调 | `() => void` | - |
|
|
68
|
-
| disabled | 禁用状态 | `boolean` | `false` |
|
|
69
|
-
| style | 外层容器样式 | `ViewStyle` | - |
|
|
70
|
-
| styles | 语义插槽样式 | `Partial<ListItemSemanticStyles>` | - |
|
|
71
|
-
| testID | 测试标识 | `string` | - |
|
|
72
|
-
|
|
73
|
-
## Semantic Styles
|
|
74
|
-
|
|
75
|
-
通过 `styles` prop 精确覆盖组件内部各 slot 的样式。
|
|
76
|
-
|
|
77
|
-
| 插槽 | 类型 | 说明 |
|
|
78
|
-
|------|------|------|
|
|
79
|
-
| root | `ViewStyle` | 整行容器(padding、背景等) |
|
|
80
|
-
| content | `TextStyle` | 主标题文字(字号、颜色、flex 等) |
|
|
81
|
-
| description | `TextStyle` | 描述文字(字号、颜色等) |
|
|
82
|
-
| extra | `ViewStyle & TextStyle` | 右侧额外内容区域 |
|
|
83
|
-
|
|
84
|
-
## 内部布局
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
┌─ root ──────────────────────────────────┐
|
|
88
|
-
│ [thumb] ┌─ line ─────────────────────┐ │
|
|
89
|
-
│ │ ┌─ contentWrap ──────────┐ │ │
|
|
90
|
-
│ │ │ [content] │ │ │
|
|
91
|
-
│ │ │ [description] │ │ │
|
|
92
|
-
│ │ └────────────────────────┘ │ │
|
|
93
|
-
│ │ [extra] [arrow] │ │
|
|
94
|
-
│ └────────────────────────────┘ │
|
|
95
|
-
└─────────────────────────────────────────┘
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## 交互行为
|
|
99
|
-
|
|
100
|
-
- 有 `onPress` 时自动包裹 `Pressable`,无 `onPress` 时渲染为纯 `View`
|
|
101
|
-
- `onLongPress` 仅在有 `onPress` 时生效
|
package/src/popover/index.md
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Popover
|
|
3
|
-
nav:
|
|
4
|
-
title: 组件
|
|
5
|
-
order: 1
|
|
6
|
-
group:
|
|
7
|
-
title: 基础
|
|
8
|
-
order: 2
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Popover 弹出定位容器
|
|
12
|
-
|
|
13
|
-
锚定在指定元素下方的弹出容器,用于下拉菜单等场景。
|
|
14
|
-
|
|
15
|
-
## 何时使用
|
|
16
|
-
|
|
17
|
-
- 下拉选择菜单
|
|
18
|
-
- 模型选择器
|
|
19
|
-
- 任何需要锚定定位的浮层
|
|
20
|
-
|
|
21
|
-
## 代码演示
|
|
22
|
-
|
|
23
|
-
```tsx
|
|
24
|
-
import { Popover } from '@unif/react-native-ui';
|
|
25
|
-
|
|
26
|
-
<Popover
|
|
27
|
-
visible={visible}
|
|
28
|
-
onClose={() => setVisible(false)}
|
|
29
|
-
anchorLayout={{ x: 100, y: 50, width: 120, height: 40 }}
|
|
30
|
-
width={180}
|
|
31
|
-
>
|
|
32
|
-
<View>
|
|
33
|
-
<Text>下拉内容</Text>
|
|
34
|
-
</View>
|
|
35
|
-
</Popover>
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## API
|
|
39
|
-
|
|
40
|
-
| 属性 | 说明 | 类型 | 默认值 |
|
|
41
|
-
| ------------ | -------------- | --------------------------------------------- | ---------- |
|
|
42
|
-
| visible | 是否可见 | `boolean` | - |
|
|
43
|
-
| onClose | 关闭回调 | `() => void` | - |
|
|
44
|
-
| anchorLayout | 锚点布局 | `{ x, y, width, height }` | - |
|
|
45
|
-
| width | 内容宽度 | `number` | `180` |
|
|
46
|
-
| placement | 弹出方向 | `'bottom'` \| `'top'` | `'bottom'` |
|
|
47
|
-
| children | 弹出内容 | `ReactNode` | - |
|
|
48
|
-
| style | 内容容器样式 | `ViewStyle` | - |
|
|
49
|
-
| styles | 语义样式 | `PopoverSemanticStyles` | - |
|
|
50
|
-
| testID | 测试标识 | `string` | - |
|
|
51
|
-
|
|
52
|
-
## Semantic Styles
|
|
53
|
-
|
|
54
|
-
| Slot | 说明 |
|
|
55
|
-
| ------- | ------------ |
|
|
56
|
-
| overlay | 遮罩层 |
|
|
57
|
-
| content | 内容容器 |
|
package/src/row/index.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Row 水平布局
|
|
2
|
-
|
|
3
|
-
水平排列子元素,默认垂直居中。替代 `flexDirection: 'row' + alignItems: 'center'` 的手写样式。
|
|
4
|
-
|
|
5
|
-
## 何时使用
|
|
6
|
-
|
|
7
|
-
- 需要水平排列元素时
|
|
8
|
-
- 替代 `<View style={{flexDirection: 'row', alignItems: 'center'}}>` 的场景
|
|
9
|
-
|
|
10
|
-
## 代码演示
|
|
11
|
-
|
|
12
|
-
```tsx
|
|
13
|
-
// 基础用法 — 默认 alignItems: 'center'
|
|
14
|
-
<Row>
|
|
15
|
-
<Icon name="star" />
|
|
16
|
-
<Text>标题</Text>
|
|
17
|
-
</Row>
|
|
18
|
-
|
|
19
|
-
// 两端对齐
|
|
20
|
-
<Row justify="space-between">
|
|
21
|
-
<Text>左侧</Text>
|
|
22
|
-
<Text>右侧</Text>
|
|
23
|
-
</Row>
|
|
24
|
-
|
|
25
|
-
// 间距
|
|
26
|
-
<Row gap={10}>
|
|
27
|
-
<Button block onPress={...}>修改</Button>
|
|
28
|
-
<Button block onPress={...}>确认</Button>
|
|
29
|
-
</Row>
|
|
30
|
-
|
|
31
|
-
// 换行
|
|
32
|
-
<Row wrap gap={8}>
|
|
33
|
-
{tags.map(tag => <Tag key={tag}>{tag}</Tag>)}
|
|
34
|
-
</Row>
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## API
|
|
38
|
-
|
|
39
|
-
| 属性 | 说明 | 类型 | 默认值 |
|
|
40
|
-
|------|------|------|--------|
|
|
41
|
-
| align | alignItems | `ViewStyle['alignItems']` | `'center'` |
|
|
42
|
-
| justify | justifyContent | `ViewStyle['justifyContent']` | - |
|
|
43
|
-
| gap | 子元素间距 | `number` | - |
|
|
44
|
-
| wrap | 是否换行 | `boolean` | `false` |
|
|
45
|
-
|
|
46
|
-
> 继承所有 RN `ViewProps`(`style`、`testID` 等)
|
package/src/space/index.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# Space 间距占位
|
|
2
|
-
|
|
3
|
-
在两个元素之间插入固定间距。替代 `<View style={{height: 12}} />` 或 `marginTop` 手写。
|
|
4
|
-
|
|
5
|
-
## 何时使用
|
|
6
|
-
|
|
7
|
-
- 两个块级元素之间需要固定间距
|
|
8
|
-
- 不想在元素上写 margin 时
|
|
9
|
-
|
|
10
|
-
## 代码演示
|
|
11
|
-
|
|
12
|
-
```tsx
|
|
13
|
-
// 垂直间距(默认)
|
|
14
|
-
<Text variant="title">标题</Text>
|
|
15
|
-
<Space size={16} />
|
|
16
|
-
<Text variant="body">正文内容</Text>
|
|
17
|
-
|
|
18
|
-
// 水平间距
|
|
19
|
-
<Row>
|
|
20
|
-
<Icon name="star" />
|
|
21
|
-
<Space size={8} direction="horizontal" />
|
|
22
|
-
<Text>收藏</Text>
|
|
23
|
-
</Row>
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## API
|
|
27
|
-
|
|
28
|
-
| 属性 | 说明 | 类型 | 默认值 |
|
|
29
|
-
|------|------|------|--------|
|
|
30
|
-
| size | 间距大小(px) | `number` | `12` |
|
|
31
|
-
| direction | 方向 | `'vertical'` \| `'horizontal'` | `'vertical'` |
|
package/src/text/index.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# Text 语义化文字
|
|
2
|
-
|
|
3
|
-
通过 `variant` 驱动排版样式。继承 RN `Text`,支持嵌套。
|
|
4
|
-
|
|
5
|
-
## 何时使用
|
|
6
|
-
|
|
7
|
-
- 替代直接写 `fontSize` + `fontWeight` + `color` 的 `<Text>` 组合
|
|
8
|
-
- 需要统一排版规范时
|
|
9
|
-
|
|
10
|
-
## 代码演示
|
|
11
|
-
|
|
12
|
-
```tsx
|
|
13
|
-
// 基础用法
|
|
14
|
-
<Text variant="title">标题文字</Text>
|
|
15
|
-
<Text variant="caption" secondary>辅助说明</Text>
|
|
16
|
-
|
|
17
|
-
// 颜色与字重
|
|
18
|
-
<Text variant="caption" primary weight="bold">¥88.00</Text>
|
|
19
|
-
|
|
20
|
-
// 嵌套 Text
|
|
21
|
-
<Text variant="body" numberOfLines={1}>
|
|
22
|
-
<Text primary weight="semibold">新 </Text>
|
|
23
|
-
{productName}
|
|
24
|
-
</Text>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## API
|
|
28
|
-
|
|
29
|
-
| 属性 | 说明 | 类型 | 默认值 |
|
|
30
|
-
|------|------|------|--------|
|
|
31
|
-
| variant | 排版变体 | `'title'` \| `'heading'` \| `'body'` \| `'caption'` \| `'micro'` | `'body'` |
|
|
32
|
-
| secondary | 次要色(colorTextSecondary) | `boolean` | `false` |
|
|
33
|
-
| primary | 主题色(colorPrimary) | `boolean` | `false` |
|
|
34
|
-
| color | 自定义颜色 | `string` | - |
|
|
35
|
-
| weight | 字重 | `'medium'` \| `'semibold'` \| `'bold'` | - |
|
|
36
|
-
|
|
37
|
-
> 继承所有 RN `TextProps`(`numberOfLines`、`ellipsizeMode`、`onPress`、`style` 等)
|
|
38
|
-
|
|
39
|
-
## Variant 规格
|
|
40
|
-
|
|
41
|
-
| variant | fontSize | lineHeight | fontWeight | 场景 |
|
|
42
|
-
|---------|----------|------------|------------|------|
|
|
43
|
-
| title | 20 | 26 | 600 | 页面标题、问候语 |
|
|
44
|
-
| heading | 16 | 22 | 600 | 弹窗标题、区块标题 |
|
|
45
|
-
| body | 15 | 22 | 正常 | 默认正文 |
|
|
46
|
-
| caption | 13 | 18 | 正常 | 信息行、标签 |
|
|
47
|
-
| micro | 12 | 18 | 正常 | 地址、规格、描述 |
|
|
48
|
-
|
|
49
|
-
## Weight 映射
|
|
50
|
-
|
|
51
|
-
| weight | fontWeight | 场景 |
|
|
52
|
-
|--------|----------|------|
|
|
53
|
-
| medium | 500 | 产品名、模型名 |
|
|
54
|
-
| semibold | 600 | 标题、按钮文字、客户名 |
|
|
55
|
-
| bold | 700 | 价格金额 |
|
|
56
|
-
|
|
57
|
-
## 样式优先级
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
VARIANT_MAP → secondary/primary → color → weight → style
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
后传入的属性覆盖先传入的,`style` prop 拥有最高优先级。
|
package/src/touchable/index.md
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# Touchable 统一触摸反馈
|
|
2
|
-
|
|
3
|
-
基于 `Pressable`,统一替代 `TouchableOpacity`。按下时降低透明度,支持自定义 `activeOpacity`。
|
|
4
|
-
|
|
5
|
-
## 何时使用
|
|
6
|
-
|
|
7
|
-
- 替代所有 `TouchableOpacity` 的场景
|
|
8
|
-
- 需要可点击区域(非按钮语义)时
|
|
9
|
-
|
|
10
|
-
## 代码演示
|
|
11
|
-
|
|
12
|
-
```tsx
|
|
13
|
-
// 基础用法
|
|
14
|
-
<Touchable onPress={handlePress}>
|
|
15
|
-
<Row gap={10}>
|
|
16
|
-
<Icon name="settings" />
|
|
17
|
-
<Text>设置</Text>
|
|
18
|
-
</Row>
|
|
19
|
-
</Touchable>
|
|
20
|
-
|
|
21
|
-
// 自定义按下透明度
|
|
22
|
-
<Touchable onPress={handlePress} activeOpacity={0.5}>
|
|
23
|
-
<Text>更明显的按下效果</Text>
|
|
24
|
-
</Touchable>
|
|
25
|
-
|
|
26
|
-
// 长按
|
|
27
|
-
<Touchable onPress={handlePress} onLongPress={handleLongPress}>
|
|
28
|
-
<Text>支持长按</Text>
|
|
29
|
-
</Touchable>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## API
|
|
33
|
-
|
|
34
|
-
| 属性 | 说明 | 类型 | 默认值 |
|
|
35
|
-
|------|------|------|--------|
|
|
36
|
-
| onPress | 点击回调 | `() => void` | - |
|
|
37
|
-
| onLongPress | 长按回调 | `() => void` | - |
|
|
38
|
-
| disabled | 禁用状态 | `boolean` | `false` |
|
|
39
|
-
| activeOpacity | 按下态透明度 | `number` | `0.7` |
|
|
40
|
-
| testID | 测试标识 | `string` | - |
|
|
41
|
-
|
|
42
|
-
> 继承所有 RN `ViewProps`
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: WaveAnimation
|
|
3
|
-
nav:
|
|
4
|
-
title: 组件
|
|
5
|
-
order: 1
|
|
6
|
-
group:
|
|
7
|
-
title: 原子
|
|
8
|
-
order: 1
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# WaveAnimation 声波动画
|
|
12
|
-
|
|
13
|
-
柱状声波动画,适用于语音录制等场景的视觉反馈。
|
|
14
|
-
|
|
15
|
-
## 何时使用
|
|
16
|
-
|
|
17
|
-
- 语音录制时展示声波效果
|
|
18
|
-
- 需要节奏性动画反馈时
|
|
19
|
-
|
|
20
|
-
## 代码演示
|
|
21
|
-
|
|
22
|
-
```tsx
|
|
23
|
-
import { WaveAnimation } from '@unif/react-native-ui';
|
|
24
|
-
|
|
25
|
-
// 基本用法
|
|
26
|
-
<WaveAnimation active={isRecording} />
|
|
27
|
-
|
|
28
|
-
// 自定义参数
|
|
29
|
-
<WaveAnimation
|
|
30
|
-
active={true}
|
|
31
|
-
color="#EB6E00"
|
|
32
|
-
barCount={5}
|
|
33
|
-
barWidth={4}
|
|
34
|
-
minHeight={4}
|
|
35
|
-
maxHeight={24}
|
|
36
|
-
/>
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## API
|
|
40
|
-
|
|
41
|
-
| 属性 | 说明 | 类型 | 默认值 |
|
|
42
|
-
| --------- | ------------ | ---------- | ----------- |
|
|
43
|
-
| active | 控制动画启停 | `boolean` | - |
|
|
44
|
-
| color | 柱体颜色 | `string` | `'#FFFFFF'` |
|
|
45
|
-
| barCount | 柱数 | `number` | `4` |
|
|
46
|
-
| barWidth | 柱宽 | `number` | `3` |
|
|
47
|
-
| minHeight | 最小高度 | `number` | `6` |
|
|
48
|
-
| maxHeight | 最大高度 | `number` | `20` |
|
|
49
|
-
| style | 容器样式 | `ViewStyle`| - |
|
|
50
|
-
| testID | 测试标识 | `string` | - |
|