Skip to content

Commit 7f08765

Browse files
author
zanjs
committed
F
0 parents  commit 7f08765

File tree

135 files changed

+7576
-0
lines changed

Some content is hidden

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

135 files changed

+7576
-0
lines changed

.gitignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
bower_components/
2+
config.js
3+
mx_modules/
4+
nohup.out
5+
*.iml
6+
*.cfg
7+
.idea/
8+
.ipr
9+
.iws
10+
*~
11+
~*
12+
*.diff
13+
*.log
14+
*.patch
15+
*.bak
16+
.DS_Store
17+
Thumbs.db
18+
.project
19+
.*proj
20+
.svn/
21+
*.swp
22+
out/
23+
node_modules/
24+
build/
25+
dist/

README.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# learning-react
2+
3+
materials about learning react
4+
5+
## Development
6+
7+
```
8+
npm install
9+
npm start
10+
```
11+
12+
## Example
13+
14+
http://localhost:9000/examples/
15+
16+
online example: http://yiminghe.github.io/learning-react/examples/
17+
18+
## Test Case
19+
20+
http://localhost:9000/tests/runner.html?coverage
21+
22+
```
23+
npm run browser-test
24+
npm run karma
25+
```
26+
27+
## Coverage
28+
29+
http://localhost:9000/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:9000/tests/runner.html?coverage
30+
31+
```
32+
npm run browser-test-cover
33+
```
34+
35+
## Tutorials
36+
37+
https://github.com/yiminghe/learning-react/blob/master/tutorial/en-us/index.md
38+
39+
### online
40+
41+
[react 入门](http://yiminghe.github.io/learning-react/tutorial/zh-cn/intro.html)
42+
43+
[react 进阶](http://yiminghe.github.io/learning-react/tutorial/zh-cn/advanced.html)
44+
45+
## Reference
46+
47+
https://github.com/yiminghe/learning-react/blob/master/reference.md
48+
49+
## Our components based on React
50+
51+
[https://github.com/react-component](https://github.com/react-component)
52+
53+
## License
54+
55+
Sample codes and articles are released under the MIT license.

assets/css-transition-group/index.css

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.example-enter {
2+
opacity: 0.01;
3+
transition: opacity 1s ease-in;
4+
}
5+
.example-enter.example-enter-active {
6+
opacity: 1;
7+
}
8+
.example-leave {
9+
opacity: 1;
10+
transition: opacity 1s ease-in;
11+
}
12+
.example-leave.example-leave-active {
13+
opacity: 0.01;
14+
}

assets/load-on-demand/async.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.my-content {
2+
color:red;
3+
}

assets/load-on-demand/index.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.my-button {
2+
color: gray;
3+
}

assets/react-router/index.css

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
body {
2+
font-family: "Helvetica Neue", Arial;
3+
font-weight: 200;
4+
}
5+
6+
a {
7+
color: hsl(200, 50%, 50%);
8+
}
9+
10+
a.active {
11+
color: hsl(20, 50%, 50%);
12+
}
13+
14+
#example {
15+
position: absolute;
16+
}
17+
18+
.App {
19+
width: 1000px;
20+
margin:0 auto;
21+
}
22+
23+
.Master {
24+
overflow: auto;
25+
padding: 10px 40px;
26+
border-right: 1px solid #ccc;
27+
text-align: center;
28+
}
29+
30+
.Detail {
31+
overflow: auto;
32+
padding: 40px;
33+
}

examples/ReactNativeART/.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"whitelist":["es6.constants"]
3+
}

examples/ReactNativeART/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## ReactNativeART test
2+
3+
web version: https://github.com/yiminghe/learning-react/tree/master/src/react-art
4+
5+
android not supported because of missing ReactNativeArt ...
6+
7+
### install
8+
9+
```
10+
npm install
11+
```
12+
13+
link ART in react-native/libraries/ART: http://facebook.github.io/react-native/docs/linking-libraries-ios.html#content
14+
15+
### run
16+
17+
open `ios/ReactNativeART.xcodeproj` in Xcode and run
18+
19+
20+
### demo
21+
22+
![img](http://gtms02.alicdn.com/tps/i2/TB1wsGUJFXXXXa8XFXXygnAGFXX-730-1015.png)
23+
24+

examples/ReactNativeART/Rectangle.js

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/**
2+
* Copyright 2013-2014 Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
9+
* @providesModule Rectangle.art
10+
* @typechecks
11+
*
12+
* Example usage:
13+
* <Rectangle
14+
* width={50}
15+
* height={50}
16+
* stroke="green"
17+
* fill="blue"
18+
* />
19+
*
20+
* Additional optional properties:
21+
* (Number) radius
22+
* (Number) radiusTopLeft
23+
* (Number) radiusTopRight
24+
* (Number) radiusBottomLeft
25+
* (Number) radiusBottomRight
26+
*
27+
*/
28+
29+
30+
31+
var React = require('react-native');
32+
var ReactART = require('ReactNativeART');
33+
34+
var Group = ReactART.Group;
35+
var Shape = ReactART.Shape;
36+
var Surface = ReactART.Surface;
37+
var Transform = ReactART.Transform;
38+
39+
var Props = React.PropTypes;
40+
var Shape = ReactART.Shape;
41+
var Path = ReactART.Path;
42+
43+
/**
44+
* Rectangle is a React component for drawing rectangles. Like other ReactART
45+
* components, it must be used in a <Surface>.
46+
*/
47+
var Rectangle = React.createClass({
48+
propTypes: {
49+
width: Props.number.isRequired,
50+
height: Props.number.isRequired,
51+
radius: Props.number,
52+
radiusTopLeft: Props.number,
53+
radiusTopRight: Props.number,
54+
radiusBottomRight: Props.number,
55+
radiusBottomLeft: Props.number
56+
},
57+
58+
render: function() {
59+
var width = this.props.width;
60+
var height = this.props.height;
61+
var radius = this.props.radius ? this.props.radius : 0;
62+
63+
// if unspecified, radius(Top|Bottom)(Left|Right) defaults to the radius
64+
// property
65+
var tl = this.props.radiusTopLeft ? this.props.radiusTopLeft : radius;
66+
var tr = this.props.radiusTopRight ? this.props.radiusTopRight : radius;
67+
var br = this.props.radiusBottomRight ?
68+
this.props.radiusBottomRight : radius;
69+
var bl = this.props.radiusBottomLeft ? this.props.radiusBottomLeft : radius;
70+
71+
var path = Path();
72+
73+
// for negative width/height, offset the rectangle in the negative x/y
74+
// direction. for negative radius, just default to 0.
75+
if (width < 0) {
76+
path.move(width, 0);
77+
width = -width;
78+
}
79+
if (height < 0) {
80+
path.move(0, height);
81+
height = -height;
82+
}
83+
if (tl < 0) { tl = 0; }
84+
if (tr < 0) { tr = 0; }
85+
if (br < 0) { br = 0; }
86+
if (bl < 0) { bl = 0; }
87+
88+
// disable border radius if it doesn't fit within the specified
89+
// width/height
90+
if (tl + tr > width) { tl = 0; tr = 0; }
91+
if (bl + br > width) { bl = 0; br = 0; }
92+
if (tl + bl > height) { tl = 0; bl = 0; }
93+
if (tr + br > height) { tr = 0; br = 0; }
94+
95+
path.move(0, tl);
96+
97+
if (tl > 0) { path.arc(tl, -tl); }
98+
path.line(width - (tr + tl), 0);
99+
100+
if (tr > 0) { path.arc(tr, tr); }
101+
path.line(0, height - (tr + br));
102+
103+
if (br > 0) { path.arc(-br, br); }
104+
path.line(- width + (br + bl), 0);
105+
106+
if (bl > 0) { path.arc(-bl, -bl); }
107+
path.line(0, - height + (bl + tl));
108+
109+
return <Shape {...this.props} d={path} />;
110+
}
111+
112+
});
113+
114+
module.exports = Rectangle;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#Tue Sep 22 20:18:49 CST 2015
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 23
5+
buildToolsVersion "23.0.1"
6+
7+
defaultConfig {
8+
applicationId "com.reactnativeart"
9+
minSdkVersion 16
10+
targetSdkVersion 22
11+
versionCode 1
12+
versionName "1.0"
13+
ndk {
14+
abiFilters "armeabi-v7a", "x86"
15+
}
16+
}
17+
buildTypes {
18+
release {
19+
minifyEnabled false
20+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21+
}
22+
}
23+
}
24+
25+
dependencies {
26+
compile fileTree(dir: 'libs', include: ['*.jar'])
27+
compile 'com.android.support:appcompat-v7:23.0.0'
28+
compile 'com.facebook.react:react-native:0.11.+'
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.reactnativeart">
3+
4+
<uses-permission android:name="android.permission.INTERNET" />
5+
6+
<application
7+
android:allowBackup="true"
8+
android:label="@string/app_name"
9+
android:icon="@mipmap/ic_launcher"
10+
android:theme="@style/AppTheme">
11+
<activity
12+
android:name=".MainActivity"
13+
android:label="@string/app_name">
14+
<intent-filter>
15+
<action android:name="android.intent.action.MAIN" />
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
20+
</application>
21+
22+
</manifest>

0 commit comments

Comments
 (0)