Skip to content

Commit 3b2eff5

Browse files
Amber-Nan杨楠
andauthored
feat(Progress): 新增进度图标及文档网站 (#306)
* fix:发布 iOS 应用商店:一. 创建AppID * fix:发布 iOS 应用商店优化排版 * fix:ios应用商店文档更新及排版优化 * fix:修改环境安装文档语法错误及部分内容优化 * fix:更新ios应用发布流程 * fix:ios应用商店发布更新 * fix:更新ios及安卓应用商店发布 * fix:安卓上架更新 * fix:增加button自定义文本实例 * fix:增加checkBox复选框size调整及文档描述效果展示 * doc:更新文档导入图片 * doc(website): Update Readme.md * fix:修复SpeedDial Android 点击事件失效及拖拽失效问题 #286 * fix:解决SelectCascader 在安卓端不能选择问题 #289 * fix:修复Modal 弹出动画底层延迟收起问题 * feat:NoticeBar 通告栏增加文字样式修改及页面demo展示 * doc(website): Update NoticeBar Readme.md * fix:解决 MenuDropdown 安卓下拉菜单被遮挡问题 * feat:Progress 新增进度图标 * doc(website): Update Progress Readme.md Co-authored-by: 杨楠 <yangnan@nihaosi.com>
1 parent 8d6d6f6 commit 3b2eff5

File tree

6 files changed

+79
-16
lines changed

6 files changed

+79
-16
lines changed

example/examples/src/routes/Progress/index.tsx

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, {useState} from 'react';
22
import {View, Text} from 'react-native';
33
import {Progress, Button, Spacing} from '@uiw/react-native';
44
import Layout, {Container} from '../../Layout';
5+
import {motorcycle} from './svg';
56

67
const {Header, Body, Card} = Layout;
78

@@ -26,21 +27,38 @@ const ProgressDemo = (props: any) => {
2627
<Body>
2728
<Header description={'基本使用'} />
2829
<Progress progressColor="#5847FF" progress={40} />
30+
<Header description={'展示进度图标'} />
31+
<Progress progressColor="#5847FF" iconShow={true} progress={30} />
32+
<Header description={'改变进度图标'} />
33+
<Progress
34+
progressColor="#5847FF"
35+
iconShow={true}
36+
progress={60}
37+
xml={motorcycle}
38+
/>
2939
<Header description={'点击变化'} />
3040
<View
3141
style={{
32-
flexDirection: 'row',
33-
justifyContent: 'space-between',
34-
alignItems: 'center',
42+
flexDirection: 'column',
43+
marginHorizontal: 15,
3544
}}>
36-
<Progress progress={val} progressColor="#5847FF" />
37-
<Text style={{fontSize: 12, width: 40, textAlign: 'right'}}>
38-
{val}%
39-
</Text>
45+
<View
46+
style={{
47+
flexDirection: 'row',
48+
justifyContent: 'space-between',
49+
}}>
50+
<Progress
51+
progress={val}
52+
progressColor="#5847FF"
53+
iconShow={true}
54+
xml={motorcycle}
55+
/>
56+
<Text style={{fontSize: 12, marginHorizontal: 10}}>{val}%</Text>
57+
</View>
58+
<Button color={'#5847FF'} onPress={onPress}>
59+
(+-)10
60+
</Button>
4061
</View>
41-
<Button color={'#5847FF'} onPress={onPress}>
42-
(+-)10
43-
</Button>
4462
</Body>
4563
</Container>
4664
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const motorcycle = `
2+
<svg t="1635235253646" class="icon" viewBox="0 0 1822 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11488" width="200" height="200"><path d="M1496.345166 210.765346c-150.810367-157.679577-312.236785-193.066412-312.236785-193.066412-56.202621 14.258813-93.046562 87.218142-98.354588 104.807481l181.409573 53.39249c32.472626 18.109734 44.129466 106.993138 26.019732 139.465764s-87.322221 41.631571-129.578266 39.341835c0 0-253.015875 118.649978-482.71807 231.055221v276.745871s272.999029 78.787749 508.321486 0c0.624474-27.476837 0-88.154852 0-92.31801a307.553233 307.553233 0 0 1 307.136918-307.240996s147.58392-98.042351 0-252.183244z" fill="#5847FF" p-id="11489" data-spm-anchor-id="a313x.7781069.0.i37" class="selected"></path><path d="M1550.882524 320.880852c-7.80592-26.644206-143.837079-108.970638-167.150759-88.675247 0 0 23.105522 122.500899 55.682227 142.692211 45.378413 27.997232 96.793403-4.787631 111.468532-54.016964z" fill="#F3D24F" p-id="11490"></path><path d="M1571.69831 315.26059c-14.258813-35.282757-59.324989-58.908673-90.652747-76.289854-26.540127-14.675129-77.018407-45.170255-107.513533-24.978943a21.856575 21.856575 0 0 0-9.67934 23.834075c8.74263 45.794729 19.46276 103.558534 49.645649 140.506553 52.039464 64.424857 136.447475 9.471182 158.199971-52.039464 9.054867-25.707495-31.223679-36.739862-40.694861-11.240524-10.407893 28.621705-41.631571 61.614726-74.416434 44.233544-17.068944-8.950788-23.729996-31.223679-29.766573-48.500781a575.764632 575.764632 0 0 1-22.272891-84.408011l-9.783419 24.042233c12.801708-8.430393 60.678015 22.481049 71.294066 28.517626 16.132234 9.367104 57.34749 28.829863 64.945251 47.564071 9.471182 24.874864 51.102754 13.946576 40.694861-11.240525zM1500.82056 535.907919h-4.475394a237.716273 237.716273 0 1 0 4.475394 0zM319.73288 535.907919h-4.371315a237.820351 237.820351 0 1 0 4.371315 0z" fill="#49494A" p-id="11491"></path><path d="M1067.435902 318.1748A145.7105 145.7105 0 0 0 1001.762098 218.571266C956.175527 191.094429 895.185275 193.280086 895.185275 193.280086c-86.801826 0-157.055103 31.848152-157.26326 124.894714H599.705198l-197.749964-132.700633H111.88726L305.474067 385.097551l325.558888 141.131027 432.552027-208.157857z" fill="#5847FF" p-id="11492" data-spm-anchor-id="a313x.7781069.0.i38" class="selected"></path><path d="M1014.355648 272.692309L630.096245 457.952801 330.557089 327.95822 214.196847 207.538899v-22.376969h-102.309587L305.474067 385.097551l325.558888 141.131027 432.552027-208.157857h3.85092a208.157857 208.157857 0 0 0-14.883287-65.881961c-15.924076 8.846709-29.662495 16.132234-38.196967 20.503549z" fill="#2912FC" p-id="11493" data-spm-anchor-id="a313x.7781069.0.i33" class=""></path><path d="M962.836579 832.636944a1084.190197 1084.190197 0 0 1-228.973643-25.603417V612.926326c195.356149-95.336298 402.577295-193.066412 448.476103-214.610751h2.810131c36.323546 0 124.374319-6.036578 155.493919-61.822883 26.644206-47.668149 15.299602-166.526285-42.77644-198.478517l-4.267236-2.393815-134.365896-39.549993c6.452894-8.534472 31.223679-45.898807 52.039464-73.479723-11.344603-3.538684-17.797497-4.89171-17.797497-4.89171-56.098542 14.258813-93.046562 87.218142-98.250508 104.807481l181.929967 53.39249c32.472626 18.109734 44.129466 106.993138 26.019732 139.465764s-87.322221 41.631571-129.578266 39.341835c0 0-253.015875 118.649978-482.71807 231.055221v276.745871s272.999029 78.787749 508.321486 0v-62.447357C1172.139304 802.974449 962.836579 832.636944 962.836579 832.636944z" fill="#2912FC" p-id="11494" data-spm-anchor-id="a313x.7781069.0.i32" class=""></path><path d="M317.651302 647.792767h-2.289737a127.184451 127.184451 0 1 0 2.289737 0zM1498.84306 647.792767h-2.289736a127.184451 127.184451 0 1 0 2.289736 0z" fill="#F3D24F" p-id="11495"></path><path d="M1500.82056 514.883975c-234.697984-6.348815-347.623621 298.706525-170.377206 449.412813s454.824917-4.683552 417.876898-234.593905c-19.774996-123.437609-124.894714-208.990488-247.499692-214.818908-27.1646-1.353026-27.060521 40.903019 0 42.151966 113.862348 5.516183 209.510883 96.273009 208.78233 213.153645a213.153645 213.153645 0 1 1-208.78233-213.153645c27.1646 0.728552 27.1646-41.423414 0-42.151966zM199.521718 521.857263a274.664292 274.664292 0 0 1 120.731557-25.499337c27.1646 0.520395 27.1646-41.631571 0-42.256045a324.101783 324.101783 0 0 0-142.067737 31.223678c-24.666706 11.344603-3.226447 47.668149 21.33618 36.427625zM79.102398 614.799746c27.1646 0 27.1646-42.256045 0-42.256045s-27.1646 42.256045 0 42.256045zM42.466615 746.147354A278.619291 278.619291 0 0 1 66.404768 655.702765c11.136445-24.562627-25.187101-46.002886-36.427625-20.815785A341.691122 341.691122 0 0 0 0.106491 746.147354c-2.497894 27.060521 39.758151 26.852364 42.256045 0zM65.363979 882.178513a277.682581 277.682581 0 0 1-22.168812-79.932617c-3.226447-26.644206-45.482492-26.956442-42.256045 0a345.437963 345.437963 0 0 0 27.893153 101.268798c11.136445 24.770785 47.459991 3.330526 36.531704-20.815786zM72.961741 959.821394c27.1646 0 27.1646-42.256045 0-42.256045s-27.268679 42.256045 0 42.256045zM1743.324463 614.799746c27.1646 0 27.1646-42.256045 0-42.256045s-27.1646 42.256045 0 42.256045zM1822.216291 746.147354A344.084937 344.084937 0 0 0 1792.553796 634.88698c-11.240524-24.666706-47.668149-3.226447-36.531704 20.815785a281.013107 281.013107 0 0 1 23.834075 90.444589c2.393815 26.852364 44.64986 27.1646 41.631571 0z" fill="#49494A" p-id="11496"></path><path d="M1793.594586 903.514694a345.437963 345.437963 0 0 0 27.893152-101.268798c3.122368-26.956442-39.029598-26.748285-42.256045 0a277.682581 277.682581 0 0 1-22.168811 79.932617c-10.928287 24.666706 25.395259 46.106965 36.531704 20.815786zM319.836959 514.883975c-234.697984-6.348815-347.623621 298.706525-170.377206 449.412813s454.824917-4.683552 417.876898-234.593905C547.561654 606.265274 442.441937 520.400158 319.836959 514.883975c-27.1646-1.353026-27.1646 40.903019 0 42.151966 113.862348 5.516183 209.406804 96.273009 208.782331 213.153645A215.339303 215.339303 0 0 1 308.180119 983.135074a213.153645 213.153645 0 0 1 11.65684-426.099133c27.1646 0.728552 27.1646-41.423414 0-42.151966zM993.8521 370.318343l39.75815-19.046443c7.597762-3.642762 15.091445-7.80592 22.793286-11.032367 12.905787-5.412104-1.457105-1.040789 1.353026-1.040789a21.440259 21.440259 0 0 0 20.295391-26.956443c-13.113945-93.671036-101.685113-138.945369-188.382861-140.402474-96.377088-1.561184-178.183125 42.151966-182.450361 145.7105l20.815785-20.815786h-94.19143a238.132588 238.132588 0 0 1-41.631571 0c12.905787 2.497894 4.059078 1.353026-4.995789-6.036578a1338.663177 1338.663177 0 0 0-174.019968-116.5684c-35.803151-20.087233-85.344721-10.407893-125.623267-10.407892H102.20792a20.815786 20.815786 0 0 0-14.883287 36.011309l150.498131 156.118392c14.779208 15.299602 29.558416 35.90723 47.459991 47.876308s44.858018 19.358681 65.465646 28.309468l234.07351 101.268797c17.589339 7.701841 29.246179 15.403681 48.084465 10.407893 24.042232-5.932499 49.853807-24.042232 72.022618-34.658283l224.290091-107.617612c24.458548-11.760919 3.018289-48.188544-20.815786-36.427625L610.633485 508.014766h21.33618c-104.078928-45.274334-209.510883-89.507878-313.589811-135.302607-15.611839-6.973288-5.724341 0-18.942365-13.530261-22.481049-23.521838-45.274334-46.835518-67.859461-70.253277l-114.486821-118.337741-14.883287 35.699072h180.68102c31.223679 0 66.298277 4.059078 97.626034 0 12.905787-1.769342 10.928287 2.601973 2.601974-1.665263a294.022973 294.022973 0 0 1 24.458548 16.340392l93.671035 62.447357c23.417759 15.715918 48.188544 38.405125 73.89604 49.54157 42.568282 18.42197 106.784981 5.620262 152.996024 5.620262a21.544338 21.544338 0 0 0 20.815786-20.815785c6.348815-151.434841 268.835872-131.13945 287.986395 5.82842l20.815786-26.644206c-27.789074 0-60.782094 25.083022-85.136564 36.843941s-3.122368 48.188544 20.815786 36.427625z" fill="#49494A" p-id="11497"></path><path d="M1511.332532 195.777981c-83.263143-84.616169-184.323782-156.118393-298.290209-191.921544-69.108408-21.856575-126.559977 53.704727-147.271684 113.029716a21.440259 21.440259 0 0 0 14.779208 26.019732l156.118393 46.002886c35.594994 10.407893 42.672361 37.780651 43.817228 75.873539 2.289736 73.79196-65.361567 59.429068-116.880636 68.796172-49.021175 8.846709-101.685113 45.794729-145.7105 66.922751q-174.228126 82.638669-347.311384 167.04668a20.815786 20.815786 0 0 0-10.407893 18.213812v276.745871a21.440259 21.440259 0 0 0 15.403681 20.295391c165.589575 47.043676 355.429541 52.039464 519.562011 0a21.440259 21.440259 0 0 0 15.50776-20.295391c1.248947-87.218142-4.579473-168.816022 44.75394-246.250745a286.425211 286.425211 0 0 1 176.205625-124.894714c21.544338-4.995789 50.061965-0.728552 70.357356-8.118156 30.391047-11.136445 56.3067-51.206833 68.275777-78.891828 33.305257-77.434723-6.661051-151.018525-58.908673-208.157857-18.317891-20.087233-48.084465 9.783419-29.870653 29.870653 49.229333 54.329201 93.671036 152.371551 17.48526 208.157857-17.901576 13.113945-26.956442 8.534472-50.998675 12.073155a327.848625 327.848625 0 0 0-256.138243 202.0172c-27.997232 69.94104-22.37697 140.610632-23.31368 214.194435l15.403682-20.815786c-157.263261 49.957886-338.464675 45.066176-497.080962 0l15.50776 20.815786V585.761725l-10.407893 18.213813q196.605096-95.960772 394.563218-189.527729c26.331969-12.489471 57.659726-34.03381 86.281431-40.694861 12.073156-2.810131 40.590782 0.520395 57.971964-2.810131a142.484053 142.484053 0 0 0 62.447357-24.666706c51.51907-40.694861 37.988809-163.507997-21.856575-191.192991-54.745516-25.395259-121.772346-35.803151-179.74431-52.872096l14.779208 25.915653c9.263025-26.540127 43.504992-84.824327 72.85525-90.028273 12.281314-2.185657 35.699072 10.407893 46.939597 14.883287 97.313798 36.635783 182.866677 98.874982 255.305611 172.666942 19.046444 19.46276 48.60486-10.407893 29.870653-29.870652z" fill="#49494A" p-id="11498" data-spm-anchor-id="a313x.7781069.0.i36" class=""></path><path d="M748.017671 829.722734c27.1646 0 27.1646-41.631571 0-41.631572s-27.1646 41.631571 0 41.631572zM999.264204 849.081414c27.060521 0 27.1646-41.631571 0-41.631571s-27.268679 41.631571 0 41.631571zM941.812635 810.051816a1095.014406 1095.014406 0 0 1-123.958003-6.348815c-26.956442-3.122368-26.748285 39.133677 0 42.256045a1095.014406 1095.014406 0 0 0 123.958003 6.348815c27.1646 0 27.1646-41.631571 0-42.256045zM1113.751025 747.188143v60.157621l15.50776-20.815786A673.911062 673.911062 0 0 1 1061.711561 801.413265a20.815786 20.815786 0 0 0-14.779208 25.915653 21.544338 21.544338 0 0 0 25.915653 14.779208c22.793285-3.746841 45.274334-8.430393 67.443146-14.362892a21.648417 21.648417 0 0 0 15.50776-20.815786v-60.15762c0-27.1646-42.360124-27.268679-41.631571 0z" fill="#49494A" p-id="11499"></path><path d="M615.837432 617.922114c-164.548786 81.389722-300.475866 163.612075-300.475867 163.612076s201.913121 31.848152 300.475867 53.496569z" fill="#2912FC" p-id="11500" data-spm-anchor-id="a313x.7781069.0.i31" class=""></path><path d="M1511.332532 755.202221l-197.749964-234.281668c-17.589339-20.815786-47.355912 9.158946-29.870653 29.870652l198.270359 234.281668c17.589339 20.815786 47.251834-9.263025 29.870652-29.870652zM605.221381 599.708302c-101.99735 50.790517-202.849831 104.703402-300.475867 163.612075-14.154734 8.534472-13.842497 35.594994 4.995789 38.613283 100.436166 15.819997 201.08049 31.952231 300.475866 53.496569a21.440259 21.440259 0 0 0 26.748285-20.815786V716.172623c0-27.1646-41.631571-27.1646-41.631571 0v118.858136l26.644205-20.815786c-99.395377-21.544338-200.0397-37.676572-300.475866-53.496569l4.995789 38.509204C423.603651 740.839329 524.456132 686.926444 626.557561 636.135927c24.25039-12.073156 2.91421-48.500781-20.815786-36.427625zM111.88726 124.90023h48.188544c27.1646 0 27.268679-42.151966 0-42.151966h-48.188544c-27.1646 0-27.1646 42.151966 0 42.151966zM215.966189 124.90023c27.1646 0 27.1646-42.151966 0-42.151966s-27.1646 42.151966 0 42.151966zM1148.721545 451.29175c27.1646 0 27.268679-41.631571 0-41.631572s-27.1646 41.631571 0 41.631572zM758.633721 640.507242l330.346519-158.30405c24.562627-11.760919 3.122368-48.188544-20.815786-36.531704L737.40162 603.663301c-24.562627 11.65684-3.122368 48.084465 20.815786 36.427625z" fill="#49494A" p-id="11501"></path></svg>
3+
`;

packages/core/src/Progress/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ Progress 进度条
99
```jsx
1010
import { SafeAreaView } from 'react-native';
1111
import { Progress } from '@uiw/react-native';
12+
import { motorcycle } from './svg';
1213

1314
function Demo() {
1415
return (
1516
<SafeAreaView style={{ flex: 1 }}>
1617
<Progress progress={30} position="fixed"/>
18+
<Progress progressColor="#5847FF" iconShow={true} xml={motorcycle} />
1719
</SafeAreaView>
1820
)
1921
}
@@ -28,3 +30,6 @@ function Demo() {
2830
| `progress` | 进度百分比(可选) | Number | 0 |
2931
| `progressColor` | 颜色(可选) | String | none |
3032
| `position` | 位置,fixed 将浮出固定在最顶层(可选) | String | none |
33+
| `iconShow` | 是否展示图标 | boolean | false |
34+
| `xml` | 图标源 | String | 默认图标 |
35+
| `size` | 图标尺寸 | number| 25 |

packages/core/src/Progress/index.tsx

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import { has } from 'lodash';
12
import React, { useRef, useState, useEffect } from 'react';
2-
import { Animated, View, StyleSheet, ViewProps, LayoutChangeEvent } from 'react-native';
3+
import { Animated, View, StyleSheet, ViewProps, LayoutChangeEvent, Image } from 'react-native';
4+
import { Flex } from 'src';
5+
import { run } from './svg';
6+
import Icon from '../Icon';
37

48
type PositionType = 'fixed' | 'relative';
59

@@ -13,11 +17,25 @@ export interface ProgressProps extends ViewProps {
1317
position?: PositionType;
1418
/** 动画持续的时间 */
1519
animation?: { duration?: number } | boolean;
20+
/** 图标源 */
21+
xml?: string;
22+
/** 是否展示图标 */
23+
iconShow?: boolean | false;
24+
/** 图标尺寸 */
25+
size?: number;
1626
}
1727

1828
export default (props: ProgressProps) => {
19-
const { style, progress = 0, progressColor = '#108ee9', position, animation = { duration: 500 } } = props;
20-
29+
const {
30+
iconShow,
31+
size = 25,
32+
xml = run,
33+
style,
34+
progress = 0,
35+
progressColor = '#108ee9',
36+
position,
37+
animation = { duration: 500 },
38+
} = props;
2139
const progWidth = useRef<any>(new Animated.Value(0)).current;
2240
const [wrapWidth, setWrapWidth] = useState<number>(0);
2341

@@ -48,6 +66,7 @@ export default (props: ProgressProps) => {
4866
}
4967
return widthPercent;
5068
};
69+
console.log('wrapWidth', wrapWidth);
5170

5271
return (
5372
<View style={[styles.container, style]}>
@@ -69,6 +88,17 @@ export default (props: ProgressProps) => {
6988
]}
7089
></Animated.View>
7190
</View>
91+
{iconShow && iconShow === true && (
92+
<View onLayout={onLayout} style={[styles.preIcon, { height: size }]}>
93+
<Animated.View
94+
style={{
95+
marginLeft: progress === 0 ? -50 : -35,
96+
width: progWidth,
97+
}}
98+
></Animated.View>
99+
<Icon xml={xml} size={size} />
100+
</View>
101+
)}
72102
</View>
73103
);
74104
};
@@ -87,6 +117,12 @@ const styles = StyleSheet.create({
87117
marginTop: 0,
88118
overflow: 'hidden',
89119
},
120+
preIcon: {
121+
width: '100%',
122+
overflow: 'hidden',
123+
flexDirection: 'row',
124+
paddingHorizontal: 20,
125+
},
90126
preOisn: {
91127
position: 'absolute',
92128
height: 4,

0 commit comments

Comments
 (0)