Skip to content

Commit 2a5ddd7

Browse files
committed
提交源码
提交源码
1 parent ca1ffa3 commit 2a5ddd7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3030
-0
lines changed

.eslintrc.json

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"commonjs": true,
5+
"es6": true,
6+
"node": true
7+
},
8+
"extends": [
9+
"eslint:recommended",
10+
"plugin:react/recommended"
11+
],
12+
"parserOptions": {
13+
"ecmaFeatures": {
14+
"experimentalObjectRestSpread": true,
15+
"arrowFunctions": true,
16+
"classes": true,
17+
"modules": true,
18+
"jsx": true,
19+
"defaultParams": true
20+
},
21+
"sourceType": "module"
22+
},
23+
"parser": "babel-eslint",
24+
"plugins": [
25+
"react"
26+
],
27+
"rules": {
28+
"indent": [
29+
"error",
30+
4
31+
],
32+
"linebreak-style": [
33+
"error",
34+
"windows"
35+
],
36+
"quotes": [
37+
"error",
38+
"single"
39+
],
40+
"semi": [
41+
"error",
42+
"always"
43+
],
44+
"no-console": "off",
45+
"react/prop-types":"off",
46+
"max-len": [2, 120, 2, {"ignoreComments": true}],
47+
"react/display-name": "off"
48+
49+
}
50+
}

.gitignore

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
project.xcworkspace
24+
25+
# Android/IntelliJ
26+
#
27+
build/
28+
.idea
29+
.gradle
30+
local.properties
31+
*.iml
32+
33+
# node.js
34+
#
35+
node_modules/
36+
npm-debug.log
37+
yarn-error.log
38+
yarn.lock
39+
/dist
40+
lib
41+
42+
# BUCK
43+
buck-out/
44+
\.buckd/
45+
*.keystore
46+
47+
#vscode
48+
.vscode
49+
50+
# fastlane
51+
#
52+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
53+
# screenshots whenever they are needed.
54+
# For more information about the recommended setup visit:
55+
# https://docs.fastlane.tools/best-practices/source-control/
56+
57+
*/fastlane/report.xml
58+
*/fastlane/Preview.html
59+
*/fastlane/screenshots

LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 Wix.com
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

package.json

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"name": "r-design",
3+
"version": "1.0.0",
4+
"description": "基于 react native 和 Ant Design Mobile 的移动端UI组件设计库",
5+
"keywords": [
6+
"react-native",
7+
"react-component",
8+
"react-native-calendar",
9+
"react-native-picker",
10+
"react-native-navigation",
11+
"react-native-button",
12+
"react-native-switch",
13+
"react-native-flatlist",
14+
"react-native-tab",
15+
"react-native-checkbox",
16+
"react-native-textinput",
17+
"react-native-toast",
18+
"react-native-modal",
19+
"react-native-dialog",
20+
"react-native-menu",
21+
"react-native-progress",
22+
"react-native-datepicker",
23+
"antd-mobile",
24+
"react-native-ui-widget",
25+
"react-native-drawer-layout",
26+
"react-native-tab-bar"
27+
],
28+
"main": "src/index.js",
29+
"repository": {
30+
"type": "git",
31+
"url": "https://github.com/GankLun/R-Design.git"
32+
},
33+
"publishConfig": {
34+
"registry": "https://registry.npmjs.org/"
35+
},
36+
"bugs": {
37+
"url": "https://github.com/GankLun/R-Design/issues"
38+
},
39+
"author": "ganklun@163.com",
40+
"license": "MIT",
41+
"dependencies": {
42+
"antd-mobile": "^2.1.8",
43+
"prop-types": "^15.6.1",
44+
"rc-form": "^2.1.7",
45+
"react": "16.3.0-alpha.1",
46+
"react-native": "0.54.1",
47+
"react-native-calendars": "^1.17.6",
48+
"react-navigation": "^1.5.9"
49+
},
50+
"devDependencies": {
51+
"babel-eslint": "^8.0.2",
52+
"babel-jest": "22.4.1",
53+
"babel-plugin-import": "^1.6.7",
54+
"babel-preset-react-native": "4.0.0",
55+
"eslint": "^4.8.0",
56+
"eslint-config-react-native": "^2.0.0",
57+
"eslint-plugin-react": "^7.4.0",
58+
"jest": "22.4.2",
59+
"react-test-renderer": "16.3.0-alpha.1"
60+
},
61+
"jest": {
62+
"preset": "react-native"
63+
}
64+
}

src/index.d.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export {default as RBadge} from './widget/badge';
2+
export {default as RButton} from './widget/button';
3+
export {default as RCalendar} from './widget/calendar';
4+
export {default as RCheckBox} from './widget/checkbox';
5+
export {default as RDatePicker} from './widget/datePicker';
6+
export {default as RDateTimePicker} from './widget/dateTimePicker';
7+
export {default as RFlatList} from './widget/flatList';
8+
export {default as RModal} from './widget/modal';
9+
export {default as RPicker} from './widget/picker';
10+
export {default as RProgressDialog} from './widget/progressDialog';
11+
export {default as RSwitch} from './widget/switch';
12+
export {default as RTabBarItem} from './widget/tab';
13+
export {default as RTextAreaInput} from './widget/textAreaInput';
14+
export {default as RTextInput} from './widget/textInput';
15+
export {default as RToast} from './widget/toast';

src/index.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export {default as RBadge} from './widget/badge';
2+
export {default as RButton} from './widget/button';
3+
export {default as RCalendar} from './widget/calendar';
4+
export {default as RCheckBox} from './widget/checkbox';
5+
export {default as RDatePicker} from './widget/datePicker';
6+
export {default as RDateTimePicker} from './widget/dateTimePicker';
7+
export {default as RFlatList} from './widget/flatList';
8+
export {default as RModal} from './widget/modal';
9+
export {default as RPicker} from './widget/picker';
10+
export {default as RProgressDialog} from './widget/progressDialog';
11+
export {default as RSwitch} from './widget/switch';
12+
export {default as RTabBarItem} from './widget/tab';
13+
export {default as RTextAreaInput} from './widget/textAreaInput';
14+
export {default as RTextInput} from './widget/textInput';
15+
export {default as RToast} from './widget/toast';

src/widget/badge/index.d.ts

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/// <reference types="react" />
2+
import React from 'react';
3+
import { StyleProp, ViewStyle,TextStyle } from 'react-native';
4+
5+
export interface RBadgeProps{
6+
size?: number;
7+
text?: string|number;
8+
dot?: boolean;
9+
backgroundColor?:string;
10+
textColor?:string;
11+
textSize?:number;
12+
overflowCount?: number;
13+
textStyle?: StyleProp<TextStyle>;
14+
style?: StyleProp<ViewStyle>;
15+
}
16+
17+
declare class RBadge extends React.Component<RBadgeProps, any> {
18+
static defaultProps: {
19+
size: number;
20+
text: string|number;
21+
dot: boolean;
22+
backgroundColor:string;
23+
textColor:string;
24+
textSize:number;
25+
overflowCount: number;
26+
textStyle: StyleProp<TextStyle>;
27+
style: StyleProp<ViewStyle>;
28+
};
29+
30+
isInteger(params:object):boolean;
31+
32+
render(): JSX.Element;
33+
}
34+
35+
export default RBadge;

src/widget/badge/index.js

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import React, {Component} from 'react';
2+
import {View,Text} from 'react-native';
3+
import PropTypes from 'prop-types';
4+
5+
export default class RBadge extends Component {
6+
7+
constructor(props) {
8+
super(props);
9+
}
10+
11+
12+
static defaultProps = {
13+
size:10, //只当dot为true时生效
14+
text: '',
15+
dot:false,
16+
backgroundColor:'#ff0000',
17+
textColor:'#ffffff',
18+
textSize:12,
19+
overflowCount:99,
20+
textStyle:{},
21+
style:{},
22+
};
23+
24+
static propTypes = {
25+
size:PropTypes.number,
26+
text: PropTypes.oneOfType([PropTypes.string,PropTypes.number,]),
27+
dot:PropTypes.bool,
28+
backgroundColor:PropTypes.string,
29+
textColor:PropTypes.string,
30+
textSize:PropTypes.number,
31+
overflowCount:PropTypes.number,
32+
textStyle:Text.propTypes.style,
33+
style:View.propTypes.style
34+
};
35+
36+
isInteger=(obj)=> {
37+
return typeof obj === 'number' && obj%1 === 0;
38+
}
39+
40+
render() {
41+
const {size,text,dot,overflowCount,backgroundColor,textColor,textSize,textStyle,style}=this.props;
42+
43+
if(dot){
44+
return (
45+
<View style={[style,{width:size,height:size,backgroundColor:backgroundColor,
46+
borderRadius:50}]}>
47+
</View>
48+
);
49+
}else{
50+
if(this.isInteger(text)){
51+
if(text<=0){
52+
return;
53+
}else{
54+
return (<View style={[style,{backgroundColor:backgroundColor,
55+
borderRadius:text<10?50:10,alignItems:'center',justifyContent:'center',padding:2}]}>
56+
<Text style={[textStyle,{color:textColor,fontSize:textSize}]}>
57+
{text<=overflowCount?text:overflowCount+'+'}
58+
</Text>
59+
</View>);
60+
}
61+
}else{
62+
return (<View style={[style,{backgroundColor:backgroundColor,
63+
borderRadius:10,alignItems:'center',justifyContent:'center',padding:2},]}>
64+
<Text style={[textStyle,{color:textColor,fontSize:textSize}]}>
65+
{text<=overflowCount?text:overflowCount+'+'}
66+
</Text>
67+
</View>);
68+
}
69+
}
70+
}
71+
72+
}

src/widget/button/index.d.ts

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/// <reference types="react" />
2+
import React from 'react';
3+
import { StyleProp, ViewStyle,TextStyle } from 'react-native';
4+
5+
export interface RButtonProps{
6+
style?: StyleProp<ViewStyle>;
7+
textStyle?: StyleProp<TextStyle>;
8+
textValue?: string;
9+
activeOpacity?:number;
10+
underlayColor?:string;
11+
disabled?:boolean;
12+
onPress?: () => void;
13+
onLongPress?: () => void;
14+
}
15+
16+
declare class RButton extends React.Component<RButtonProps, any> {
17+
static defaultProps: {
18+
style: StyleProp<ViewStyle>;
19+
textStyle: StyleProp<TextStyle>;
20+
textValue: string;
21+
activeOpacity:number;
22+
underlayColor:string;
23+
disabled:boolean;
24+
onPress: () => void;
25+
onLongPress: () => void;
26+
};
27+
28+
render(): JSX.Element;
29+
}
30+
31+
export default RButton;

0 commit comments

Comments
 (0)