1 | /**
|
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
|
3 | *
|
4 | * This source code is licensed under the MIT license found in the
|
5 | * LICENSE file in the root directory of this source tree.
|
6 | *
|
7 | * @format
|
8 | */
|
9 |
|
10 | import type * as React from 'react';
|
11 | import {ColorValue} from '../../StyleSheet/StyleSheet';
|
12 |
|
13 | export type StatusBarStyle = 'default' | 'light-content' | 'dark-content';
|
14 |
|
15 | export type StatusBarAnimation = 'none' | 'fade' | 'slide';
|
16 |
|
17 | export interface StatusBarPropsIOS {
|
18 | /**
|
19 | * If the network activity indicator should be visible.
|
20 | *
|
21 | * @platform ios
|
22 | */
|
23 | networkActivityIndicatorVisible?: boolean | undefined;
|
24 |
|
25 | /**
|
26 | * The transition effect when showing and hiding the status bar using
|
27 | * the hidden prop. Defaults to 'fade'.
|
28 | *
|
29 | * @platform ios
|
30 | */
|
31 | showHideTransition?: null | 'fade' | 'slide' | 'none' | undefined;
|
32 | }
|
33 |
|
34 | export interface StatusBarPropsAndroid {
|
35 | /**
|
36 | * The background color of the status bar.
|
37 | *
|
38 | * @platform android
|
39 | */
|
40 | backgroundColor?: ColorValue | undefined;
|
41 |
|
42 | /**
|
43 | * If the status bar is translucent. When translucent is set to true,
|
44 | * the app will draw under the status bar. This is useful when using a
|
45 | * semi transparent status bar color.
|
46 | *
|
47 | * @platform android
|
48 | */
|
49 | translucent?: boolean | undefined;
|
50 | }
|
51 |
|
52 | export interface StatusBarProps
|
53 | extends StatusBarPropsIOS,
|
54 | StatusBarPropsAndroid {
|
55 | /**
|
56 | * If the transition between status bar property changes should be
|
57 | * animated. Supported for backgroundColor, barStyle and hidden.
|
58 | */
|
59 | animated?: boolean | undefined;
|
60 |
|
61 | /**
|
62 | * Sets the color of the status bar text.
|
63 | */
|
64 | barStyle?: null | StatusBarStyle | undefined;
|
65 |
|
66 | /**
|
67 | * If the status bar is hidden.
|
68 | */
|
69 | hidden?: boolean | undefined;
|
70 | }
|
71 |
|
72 | export class StatusBar extends React.Component<StatusBarProps> {
|
73 | /**
|
74 | * The current height of the status bar on the device.
|
75 | * @platform android
|
76 | */
|
77 | static currentHeight?: number | undefined;
|
78 |
|
79 | /**
|
80 | * Show or hide the status bar
|
81 | * @param hidden The dialog's title.
|
82 | * @param animation Optional animation when
|
83 | * changing the status bar hidden property.
|
84 | */
|
85 | static setHidden: (hidden: boolean, animation?: StatusBarAnimation) => void;
|
86 |
|
87 | /**
|
88 | * Set the status bar style
|
89 | * @param style Status bar style to set
|
90 | * @param animated Animate the style change.
|
91 | */
|
92 | static setBarStyle: (style: StatusBarStyle, animated?: boolean) => void;
|
93 |
|
94 | /**
|
95 | * Control the visibility of the network activity indicator
|
96 | * @param visible Show the indicator.
|
97 | */
|
98 | static setNetworkActivityIndicatorVisible: (visible: boolean) => void;
|
99 |
|
100 | /**
|
101 | * Set the background color for the status bar
|
102 | * @param color Background color.
|
103 | * @param animated Animate the style change.
|
104 | */
|
105 | static setBackgroundColor: (color: ColorValue, animated?: boolean) => void;
|
106 |
|
107 | /**
|
108 | * Control the translucency of the status bar
|
109 | * @param translucent Set as translucent.
|
110 | */
|
111 | static setTranslucent: (translucent: boolean) => void;
|
112 |
|
113 | /**
|
114 | * Push a StatusBar entry onto the stack.
|
115 | * The return value should be passed to `popStackEntry` when complete.
|
116 | *
|
117 | * @param props Object containing the StatusBar props to use in the stack entry.
|
118 | */
|
119 | static pushStackEntry: (props: StatusBarProps) => StatusBarProps;
|
120 |
|
121 | /**
|
122 | * Pop a StatusBar entry from the stack.
|
123 | *
|
124 | * @param entry Entry returned from `pushStackEntry`.
|
125 | */
|
126 | static popStackEntry: (entry: StatusBarProps) => void;
|
127 |
|
128 | /**
|
129 | * Replace an existing StatusBar stack entry with new props.
|
130 | *
|
131 | * @param entry Entry returned from `pushStackEntry` to replace.
|
132 | * @param props Object containing the StatusBar props to use in the replacement stack entry.
|
133 | */
|
134 | static replaceStackEntry: (
|
135 | entry: StatusBarProps,
|
136 | props: StatusBarProps,
|
137 | ) => StatusBarProps;
|
138 | }
|