Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ if (__DEV__) {
}
export default ScrollViewContext;

// $FlowFixMe[incompatible-type] frozen objects are readonly
export const HORIZONTAL: Value = Object.freeze({horizontal: true});
// $FlowFixMe[incompatible-type] frozen objects are readonly
export const VERTICAL: Value = Object.freeze({horizontal: false});
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const PERMISSIONS = Object.freeze({
*/

class PermissionsAndroid {
PERMISSIONS: {|
PERMISSIONS: $ReadOnly<{|
ACCEPT_HANDOVER: string,
ACCESS_BACKGROUND_LOCATION: string,
ACCESS_COARSE_LOCATION: string,
Expand Down Expand Up @@ -132,12 +132,12 @@ class PermissionsAndroid {
WRITE_CALL_LOG: string,
WRITE_CONTACTS: string,
WRITE_EXTERNAL_STORAGE: string,
|} = PERMISSIONS;
RESULTS: {|
|}> = PERMISSIONS;
RESULTS: $ReadOnly<{|
DENIED: 'denied',
GRANTED: 'granted',
NEVER_ASK_AGAIN: 'never_ask_again',
|} = PERMISSION_REQUEST_RESULT;
|}> = PERMISSION_REQUEST_RESULT;

/**
* DEPRECATED - use check
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/Libraries/ReactNative/DisplayMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export opaque type DisplayModeType = number;

/** DisplayMode should be in sync with the method displayModeToInt from
* react/renderer/uimanager/primitives.h. */
const DisplayMode: {[string]: DisplayModeType} = Object.freeze({
const DisplayMode: {+[string]: DisplayModeType} = Object.freeze({
VISIBLE: 1,
SUSPENDED: 2,
HIDDEN: 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6976,7 +6976,7 @@ exports[`public API should not change unintentionally Libraries/PermissionsAndro
...
};
declare class PermissionsAndroid {
PERMISSIONS: {|
PERMISSIONS: $ReadOnly<{|
ACCEPT_HANDOVER: string,
ACCESS_BACKGROUND_LOCATION: string,
ACCESS_COARSE_LOCATION: string,
Expand Down Expand Up @@ -7020,12 +7020,12 @@ declare class PermissionsAndroid {
WRITE_CALL_LOG: string,
WRITE_CONTACTS: string,
WRITE_EXTERNAL_STORAGE: string,
|};
RESULTS: {|
|}>;
RESULTS: $ReadOnly<{|
DENIED: \\"denied\\",
GRANTED: \\"granted\\",
NEVER_ASK_AGAIN: \\"never_ask_again\\",
|};
|}>;
checkPermission(permission: PermissionType): Promise<boolean>;
check(permission: PermissionType): Promise<boolean>;
requestPermission(
Expand Down Expand Up @@ -7418,7 +7418,7 @@ declare module.exports: UIManagerJS;

exports[`public API should not change unintentionally Libraries/ReactNative/DisplayMode.js 1`] = `
"declare export opaque type DisplayModeType;
declare const DisplayMode: { [string]: DisplayModeType };
declare const DisplayMode: { +[string]: DisplayModeType };
declare export function coerceDisplayMode(value: ?number): DisplayModeType;
declare export default typeof DisplayMode;
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import * as React from 'react';
import {PermissionsAndroid, StyleSheet, View} from 'react-native';

function PermissionsExample() {
const [permission, setPermission] = React.useState(
const [permission, setPermission] = React.useState<string>(
PermissionsAndroid.PERMISSIONS.CAMERA,
);
const [hasPermission, setHasPermission] = React.useState('Not Checked');
Expand Down