非常教程

React native参考手册

Components: StatusBar

StatusBar

组件来控制应用程序状态栏。

与导航器一起使用

可以同时安装多个StatusBar组件。道具将按照StatusBar组件的安装顺序进行合并。一个用例是指定每个路由使用的状态栏样式Navigator

 <View>
   <StatusBar
     backgroundColor="blue"
     barStyle="light-content"
   />
   <Navigator
     initialRoute={{statusBarHidden: true}}
     renderScene={(route, navigator) =>
       <View>
         <StatusBar hidden={route.statusBarHidden} />
         ...
       </View>
     }
   />
 </View>

势在必行的API

对于使用组件的情况并不理想的情况,还有一个必要的API暴露为组件上的静态函数。但是,不建议为同一个道具使用静态API和组件,因为由静态API设置的任何值将被组件在下一个渲染中设置的值覆盖。

常量

currentHeight (仅限Android)状态栏的高度。

Props

animated?: bool

如果状态栏属性更改之间的转换应该是动画。支持backgroundColor,barStyle和隐藏。

barStyle?: enum('default', 'light-content', 'dark-content')

设置状态栏文本的颜色。

hidden?: bool

如果状态栏被隐藏。

androidbackgroundColor?: color

状态栏的背景颜色。

androidtranslucent?: bool

如果状态栏是半透明的。当半透明设置为true时,应用程序将在状态栏下绘制。这在使用半透明状态栏颜色时非常有用。

iosnetworkActivityIndicatorVisible?: bool

如果网络活动指示符应该可见。

iosshowHideTransition?: enum('fade', 'slide')

使用hidden道具显示和隐藏状态栏时的过渡效果。默认为“淡入淡出”。

方法

static setHidden(hidden: boolean, animation?: StatusBarAnimation)

显示或隐藏状态栏

参数:

名称和类型

描述

hiddenboolean

隐藏状态栏。

animationStatusBarAnimation

更改状态栏隐藏属性时的可选动画。

static setBarStyle(style: StatusBarStyle, animated?: boolean)

设置状态栏样式

参数:

名称和类型

描述

styleStatusBarStyle

要设置的状态栏样式

animatedboolean

动态改变样式。

static setNetworkActivityIndicatorVisible(visible: boolean)

控制网络活动指示器的可见性

参数:

名称和类型

描述

visibleboolean

显示指标。

static setBackgroundColor(color: string, animated?: boolean)

设置状态栏的背景颜色

参数:

名称和类型

描述

colorstring

背景颜色。

animatedboolean

动态改变样式。

static setTranslucent(translucent: boolean)

控制状态栏的半透明度

参数:

名称和类型

描述

translucentboolean

设置为半透明。

类型定义

StatusBarStyle

状态栏样式

类型:

$Enum

常量:

描述

default

默认状态栏样式(适用于iOS的黑暗,Android适用的光源)

light-content

黑暗的背景,白色文本和图标

dark-content

浅色背景,黑暗的文本和图标

StatusBarAnimation

状态栏动画

类型:

$Enum

常量:

描述

none

没有动画

fade

淡入淡出动画

slide

幻灯片动画

Components: StatusBar相关

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