Skip to content

Commit 1b79066

Browse files
authoredFeb 17, 2017
Merge pull request alibaba#2604 from cxfeng1/dev
+ [doc] Adding docs for 0.10.0 features.
2 parents dd44ab5 + 54489e4 commit 1b79066

File tree

3 files changed

+29
-22
lines changed

3 files changed

+29
-22
lines changed
 

‎doc/source/references/advanced/extend-to-ios.md

+19-17
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version: 2.1
66
---
77

88
# Extend to iOS
9-
9+
1010
### Module extend
1111

1212
Weex SDK provides only rendering capabilities, rather than have other capabilities, such as network, picture, and URL redirection. If you want these features, you need to implement it.
@@ -15,11 +15,11 @@ For example: If you want to implement an address jumping function, you can achie
1515

1616
#### Step to customize a module
1717

18-
1. Module
18+
1. Module
1919
customized must implement WXModuleProtocol
20-
2. A macro named `WX_EXPORT_METHOD` must be added, as it is the only way to be recognized by Weex. It takes arguments that specifies the method in module called by JavaScript code.
20+
2. A macro named `WX_EXPORT_METHOD` must be added, as it is the only way to export methods to JavaScript.
2121
3. The weexInstance should be synthesized. Each module object is bind to a specific instance.
22-
4. Module methods will be invoked in UI thread, so do not put time consuming operation there. If you want to execute the whole module methods in other thread, please implement the method `- (NSThread *)targetExecuteThread` in protocol. In the way, tasks distributed to this module will be executed in targetExecuteThread.
22+
4. Module methods will be invoked in UI thread, so do not put time consuming operation there. If you want to execute the whole module methods in other thread, please implement the method `- (NSThread *)targetExecuteThread` in protocol. In the way, tasks distributed to this module will be executed in targetExecuteThread.
2323
5. Weex params can be String or Map.
2424
6. Module supports to return results to Javascript in callback. This callback is type of `WXModuleCallback`, the params of which can be String or Map.
2525

@@ -46,7 +46,9 @@ For example: If you want to implement an address jumping function, you can achie
4646

4747
@end
4848
```
49-
49+
50+
In addition, `0.10.0` begins to support synchronous module API call, you can use macro `WX_EXPORT_METHOD_SYNC` to export module methods which could make JavaScript receive return values from native, it **can only be called on JS thread**.
51+
5052
#### Register the module
5153
5254
You can register the customized module by calling the method `registerModule:withClass` in WXSDKEngine.
@@ -62,7 +64,7 @@ WXSDKEngine.h
6264
6365
[WXSDKEngine registerModule:@"event" withClass:[WXEventModule class]];
6466
```
65-
67+
6668
### Handler extend
6769

6870
Weex SDK doesn't have capabilitis, such as image download 、navigator operation,please implement these protocols by yourself.
@@ -102,7 +104,7 @@ Implement above protocol as follows.
102104
if ([url hasPrefix:@"//"]) {
103105
url = [@"http:" stringByAppendingString:url];
104106
}
105-
return (id<WXImageOperationProtocol>)[[SDWebImageManager sharedManager] downloadImageWithURL:[NSURL URLWithString:url] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {
107+
return (id<WXImageOperationProtocol>)[[SDWebImageManager sharedManager] downloadImageWithURL:[NSURL URLWithString:url] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {
106108
} completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
107109
if (completedBlock) {
108110
completedBlock(image, error, finished);
@@ -111,7 +113,7 @@ Implement above protocol as follows.
111113
}
112114
@end
113115
```
114-
116+
115117
#### Register the handler
116118

117119
You can register the handler which implements the protocol by calling `registerHandler:withProtocol` in WXSDKEngine.
@@ -124,10 +126,10 @@ WXSDKEngine.h
124126
* @param protocol The protocol to confirm
125127
*/
126128
+ (void)registerHandler:(id)handler withProtocol:(Protocol *)protocol;
127-
129+
128130
[WXSDKEngine registerHandler:[WXImgLoaderDefaultImpl new] withProtocol:@protocol(WXImgLoaderProtocol)];
129131
```
130-
132+
131133
## Custom Native Components for iOS
132134
133135
### Component extend
@@ -176,7 +178,7 @@ All of the styles, attributes and events will be passed to the component's initi
176178
_imageSrc = [WXConvert NSString:attributes[@"src"]];
177179
_resizeMode = [WXConvert UIViewContentMode:attributes[@"resize"]];
178180
}
179-
181+
180182
return self;
181183
}
182184

@@ -192,12 +194,12 @@ A Native Component has a life cycle managed by Weex. Weex creates it, layout it,
192194
193195
Weex offers component life cycle hooks that give you visibility into these key moments and the ability to act when they occur.
194196
195-
method| description
197+
method| description
196198
:----:|------
197-
initWithRef:type:...| Initializes a new component using the specified properties.
199+
initWithRef:type:...| Initializes a new component using the specified properties.
198200
layoutDidFinish | Called when the component has just laid out.
199-
loadView | Creates the view that the component manages.
200-
viewWillLoad | Called before the load of component's view .
201+
loadView | Creates the view that the component manages.
202+
viewWillLoad | Called before the load of component's view .
201203
viewDidLoad | Called after the component's view is loaded and set.
202204
viewWillUnload | Called just before releasing the component's view.
203205
viewDidUnload | Called when the component's view is released.
@@ -230,7 +232,7 @@ As an image component, we will need to fetch the remote image and set it to the
230232
imageView.userInteractionEnabled = YES;
231233
imageView.clipsToBounds = YES;
232234
imageView.exclusiveTouch = YES;
233-
235+
234236
// Do your image fetching and updating logic
235237
}
236238
```
@@ -245,7 +247,7 @@ If image's remote source can be changed, you can also hook the `updateAttributes
245247
_imageSrc = [WXConvert NSString:attributes[@"src"]];
246248
// Do your image updating logic
247249
}
248-
250+
249251
if (attributes[@"resize"]) {
250252
_resizeMode = [WXConvert UIViewContentMode:attributes[@"resize"]];
251253
self.view.contentMode = _resizeMode;

‎doc/source/references/components/cell.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@ This type of component supports all kinds of weex component as its child compone
1717

1818
### Attributes
1919

20-
There is no specific attribute for this component other than the [common attributes](../common-attrs.html).
20+
**common attributes**: check out the [common attributes](../common-attrs.html).
2121

2222
**Notes:** you can't give `<cell>` a `flex` value. Width of `<cell>` is equal to the width of its parent component `<list>`, and you don't need to specify its height.
2323

2424
### Styles
2525

26-
**common styles**: check out the [common styles](../common-attrs.html)
26+
**common styles**: check out the [common styles](../common-style.html)
2727

2828
- support flexbox related styles
2929
- support box model related styles
3030
- support ``position`` related styles
3131
- support ``opacity``, ``background-color`` etc.
3232

33+
**Notes:** cell itself is a container, its layout info is managed by list, so specifying cell's margin info will not work.
34+
3335
### Events
3436

3537
**common events**: check out the [common events](../common-event.html)

‎doc/source/references/gesture.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ For now, there are four types of gestures:
2323
* `panstart`
2424
* `panmove`
2525
* `panend`
26+
* **Horizontal/Vertical Pan** <span class="api-version">v0.10+</span> . Mainly used for cell swipe gestures before conflict resolving system is completed. start/move/end state of the gesture will be passed by `state` property. **Note**: These gestures are in conflict with click event on Android currently.
27+
* `horizontalpan`
28+
* `verticalpan`
2629
* **Swipe**. Swipe is fired when user swipe a touch point on the screen. A serial of motion will only trigger one Swipe gesture.
2730
* **LongPress**. Swipe is fired when a touch point is held for 500 ms or more.
2831

@@ -37,17 +40,17 @@ Users may choose their gesture according to their situation.
3740
The following properties can be used in gesture callback:
3841

3942
* `direction`. Only exists for **Swipe** gesture. Indicate the direcion of the swipe, choose from `up`, `left`, `bottom`, `right`.
40-
* `changedTouches`. An array of motion for every touch pointer that has contribute to the current gesture.
43+
* `changedTouches`. An array of motion for every touch pointer that has contribute to the current gesture.
4144

4245
### changedTouches
4346

4447
`changedTouches` is an array, with the following properties in its children:
4548

4649
* `identifier`. A unique identifier for a touch pointer.
47-
* `pageX`. The X coordinate of the touch pointer relative to the left edge of the document.
50+
* `pageX`. The X coordinate of the touch pointer relative to the left edge of the document.
4851
* `pageY`. The Y coordinate of the touch pointer relative to the top of the document.
4952
* `screenX`. The X coordinate of the touch point relative to the left edge of the screen.
5053
* `screenY`. The Y coordinate of the touch point relative to the top edge of the screen.
5154

5255
## Constrain
53-
Currently, Weex Android do not support listening to gesture on `scroller`, `list` and `webview`, as it would lead a large amount of event conflicting.
56+
Currently, Weex Android do not support listening to gesture on `scroller`, `list` and `webview`, as it would lead a large amount of event conflicting.

0 commit comments

Comments
 (0)
Please sign in to comment.