非常教程

React native参考手册

APIs

InteractionManager

InteractionManager允许在任何交互/动画完成后安排长时间运行的工作。特别是,这可以让JavaScript动画顺利运行。

应用程序可以安排任务在与以下内容交互之后运行:

InteractionManager.runAfterInteractions(() => {
  // ...long-running synchronous task...
});

将此与其他调度方案进行比较:

  • requestAnimationFrame():用于随时间变化动画视图的代码。
  • setImmediate / setTimeout():稍后运行代码,注意这可能会延迟动画。
  • runAfterInteractions():稍后运行代码,而不延迟活动动画。

触摸处理系统将一个或多个活动触摸视为“互动”,并会延迟runAfterInteractions()回调,直到所有触摸结束或取消。

InteractionManager还允许应用程序通过在动画开始时创建交互“句柄”来注册动画,并在完成时清除它:

var handle = InteractionManager.createInteractionHandle();
// run animation... (`runAfterInteractions` tasks are queued)
// later, on animation completion:
InteractionManager.clearInteractionHandle(handle);
// queued tasks run if all handles were cleared

runAfterInteractions可以使用普通的回调函数,也可以PromiseTask使用gen返回一个方法的对象Promise。如果PromiseTask提供了a ,那么runAfterInteractions在开始执行可能先前同步排队的下一个任务之前,会完全解决它(包括也安排更多任务的异步依赖项)。

默认情况下,排队任务在一个setImmediate批处理循环中一起执行。如果setDeadline使用正数来调用,那么只有在截止日期(以js事件循环运行时间方式)接近时才执行任务,此时执行将通过setTimeout产生,从而允许诸如触摸的事件开始交互并阻止排队的任务从执行,使应用程序更敏感。

方法

static runAfterInteractions(task)

安排一个函数在所有交互完成后运行。返回可以取消的“承诺”。

static createInteractionHandle()

通知管理员交互已经开始。

static clearInteractionHandle(handle)

通知管理员交互已完成。

static setDeadline(deadline)

一个正数将使用setTimeout在eventLoopRunningTime达到最终期限值后安排任何任务,否则所有任务将在一个setImmediate批处理(默认)中执行。

Properties

Events: CallExpression

addListener: CallExpression

React native

React Native 是一个 JavaScript 的框架,用来撰写实时的、可原生呈现 iOS 和 Android 的应用。

主页 https://facebook.github.io/react-native/
源码 https://github.com/facebook/react-native
发布版本 0.49

React native目录

1.开始 | Getting Started
2.指南 | Guides
3.APIs
4.组件:ActivityIndicator | Components: ActivityIndicator
5.组件:按钮 | Components: Button
6.组件:CheckBox | Components: CheckBox
7.组件:DatePickerIOS | Components: DatePickerIOS
8.组件:DrawerLayoutAndroid | Components: DrawerLayoutAndroid
9.组件:FlatList | Components: FlatList
10.组件:图像 | Components: Image
11.组件:KeyboardAvoidingView | Components: KeyboardAvoidingView
12.Components: ListView
13.Components: MaskedViewIOS
14.Components: Modal
15.Components: NavigatorIOS
16.Components: Picker
17.Components: PickerIOS
18.Components: ProgressBarAndroid
19.Components: ProgressViewIOS
20.Components: RefreshControl
21.Components: ScrollView
22.Components: SectionList
23.Components: SegmentedControlIOS
24.Components: Slider
25.Components: SnapshotViewIOS
26.Components: StatusBar
27.Components: Switch
28.Components: TabBarIOS
29.Components: TabBarIOS.Item
30.Components: Text
31.Components: TextInput
32.Components: ToolbarAndroid
33.Components: TouchableHighlight
34.Components: TouchableNativeFeedback
35.Components: TouchableOpacity
36.Components: TouchableWithoutFeedback
37.Components: View
38.Components: ViewPagerAndroid
39.Components: VirtualizedList
40.Components: WebView
41.创建 | Contributing
42.指南(Android) | Guides (Android)
43.指南(IOS) | Guides (iOS)
44.其他 | Miscellaneous