mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Moved some NativeModule JS specs to OSS
Summary: For some reason the specs were internal, but the native impl is still in github. So let's move these to github for consistency. Changelog: [Internal] Reviewed By: hramos Differential Revision: D21419934 fbshipit-source-id: f2c4486edca43c4348f3a3c6ce98f76a322bab0b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
41f0d9ba8f
commit
de667fffa4
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* (c) Facebook, Inc. and its affiliates. Confidential and proprietary.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {TurboModule} from '../TurboModule/RCTExport';
|
||||
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
|
||||
|
||||
export type PhotoIdentifier = {|
|
||||
node: {|
|
||||
image: PhotoIdentifierImage,
|
||||
type: string,
|
||||
group_name: string,
|
||||
timestamp: number,
|
||||
location: {|
|
||||
longitude: number,
|
||||
latitude: number,
|
||||
|
||||
// iOS Only
|
||||
altitude: ?number,
|
||||
heading: ?number,
|
||||
speed: ?number,
|
||||
|},
|
||||
|},
|
||||
|};
|
||||
|
||||
export type PhotoIdentifierImage = {|
|
||||
uri: string,
|
||||
playableDuration: number,
|
||||
width: number,
|
||||
height: number,
|
||||
isStored: ?boolean,
|
||||
filename: ?string,
|
||||
|};
|
||||
|
||||
export type PhotoIdentifiersPage = {|
|
||||
edges: Array<PhotoIdentifier>,
|
||||
page_info: {|
|
||||
has_next_page: boolean,
|
||||
start_cursor?: ?string,
|
||||
end_cursor?: ?string,
|
||||
|},
|
||||
|};
|
||||
|
||||
export type GetPhotosParams = {|
|
||||
first: number,
|
||||
after?: ?string,
|
||||
groupName?: ?string,
|
||||
groupTypes?: ?string,
|
||||
assetType?: ?string,
|
||||
maxSize?: ?number,
|
||||
mimeTypes?: ?Array<string>,
|
||||
|};
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+getConstants: () => {||};
|
||||
// eslint-disable-next-line lint/react-native-modules
|
||||
+getPhotos: (params: GetPhotosParams) => Promise<PhotoIdentifiersPage>;
|
||||
+saveToCameraRoll: (uri: string, type: string) => Promise<string>;
|
||||
|
||||
// iOS Only
|
||||
+deletePhotos: (assets: Array<string>) => Promise<boolean>;
|
||||
}
|
||||
|
||||
export default (TurboModuleRegistry.getEnforcing<Spec>(
|
||||
'CameraRollManager',
|
||||
): Spec);
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* (c) Facebook, Inc. and its affiliates. Confidential and proprietary.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {TurboModule} from '../TurboModule/RCTExport';
|
||||
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
|
||||
|
||||
type Options = {|
|
||||
+offset: {|
|
||||
+x: number,
|
||||
+y: number,
|
||||
|},
|
||||
+size: {|
|
||||
+width: number,
|
||||
+height: number,
|
||||
|},
|
||||
+displaySize?: ?{|
|
||||
+width: number,
|
||||
+height: number,
|
||||
|},
|
||||
/**
|
||||
* Enum with potential values:
|
||||
* - cover
|
||||
* - contain
|
||||
* - stretch
|
||||
* - center
|
||||
* - repeat
|
||||
*/
|
||||
+resizeMode?: ?string,
|
||||
+allowExternalStorage?: boolean,
|
||||
|};
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+getConstants: () => {||};
|
||||
+cropImage: (
|
||||
uri: string,
|
||||
// eslint-disable-next-line lint/react-native-modules
|
||||
cropData: Options,
|
||||
successCallback: (uri: string) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
) => void;
|
||||
}
|
||||
|
||||
export default (TurboModuleRegistry.getEnforcing<Spec>(
|
||||
'ImageEditingManager',
|
||||
): Spec);
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* (c) Facebook, Inc. and its affiliates. Confidential and proprietary.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {TurboModule} from '../TurboModule/RCTExport';
|
||||
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+getConstants: () => {||};
|
||||
// Common
|
||||
+getBase64ForTag: (
|
||||
uri: string,
|
||||
successCallback: (base64ImageData: string) => void,
|
||||
|
||||
/**
|
||||
* On Android, the failure callback is called with a string.
|
||||
* On iOS, the failure callback is called with an error object.
|
||||
*
|
||||
* TODO(T47527939) Unify this inconsistency
|
||||
*/
|
||||
errorCallback: (error: {|message: string|} | string) => void,
|
||||
) => void;
|
||||
|
||||
// iOS-only
|
||||
+hasImageForTag: (uri: string, callback: (hasImage: boolean) => void) => void;
|
||||
+removeImageForTag: (uri: string) => void;
|
||||
+addImageFromBase64: (
|
||||
base64ImageData: string,
|
||||
successCallback: (uri: string) => void,
|
||||
errorCallback: (error: {|message: string|}) => void,
|
||||
) => void;
|
||||
}
|
||||
|
||||
export default (TurboModuleRegistry.getEnforcing<Spec>(
|
||||
'ImageStoreManager',
|
||||
): Spec);
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* (c) Facebook, Inc. and its affiliates. Confidential and proprietary.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {TurboModule} from '../TurboModule/RCTExport';
|
||||
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
|
||||
|
||||
export type TimePickerOptions = {|
|
||||
hour?: number,
|
||||
minute?: number,
|
||||
is24Hour?: boolean,
|
||||
mode?: string,
|
||||
|};
|
||||
|
||||
export type TimePickerResult = {|
|
||||
action: string,
|
||||
hour: number,
|
||||
minute: number,
|
||||
|};
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
// eslint-disable-next-line lint/react-native-modules
|
||||
+open: (options: TimePickerOptions) => Promise<TimePickerResult>;
|
||||
}
|
||||
|
||||
export default (TurboModuleRegistry.get<Spec>('TimePickerAndroid'): ?Spec);
|
||||
Reference in New Issue
Block a user