Update Expo APIs for SDK 32

This commit is contained in:
Satyajit Sahoo
2019-02-05 10:54:19 +01:00
parent a20d5543e6
commit fa571007ef
6 changed files with 5003 additions and 49 deletions
+7 -9
View File
@@ -21,6 +21,9 @@ import {
Constants,
Contacts,
DocumentPicker,
EdgeInsets,
EdgePadding,
EventUserLocation,
Facebook,
FacebookAds,
FaceDetector,
@@ -30,29 +33,24 @@ import {
ImagePicker,
IntentLauncherAndroid,
KeepAwake,
KmlMapEvent,
LinearGradient,
Linking,
Location,
MailComposer,
MapEvent,
MapStyleElement,
MapView,
MediaLibrary,
Permissions,
PublisherBanner,
Region,
registerRootComponent,
ScreenOrientation,
SecureStore,
Svg,
Updates
} from 'expo';
import {
EdgeInsets,
EdgePadding,
EventUserLocation,
KmlMapEvent,
MapEvent,
MapStyleElement,
Region
} from 'react-native-maps';
const reverseGeocode: Promise<Location.GeocodeData[]> = Location.reverseGeocodeAsync({
latitude: 0,
+90 -40
View File
@@ -1,4 +1,4 @@
// Type definitions for expo 31.0
// Type definitions for expo 32.0
// Project: https://github.com/expo/expo-sdk
// Definitions by: Konstantin Kai <https://github.com/KonstantinKai>
// Martynas Kadiša <https://github.com/martynaskadisa>
@@ -19,6 +19,9 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
export * from 'react-native-maps';
export { default as MapView } from 'react-native-maps';
import { EventSubscription } from 'fbemitter';
import { Component, ComponentClass, Ref, ComponentType } from 'react';
import {
@@ -33,8 +36,6 @@ import {
StyleProp
} from 'react-native';
export { default as MapView } from 'react-native-maps';
export type Axis = number;
export type BarCodeScannedCallback = (result: { type: string; data: string; }) => void;
export type Md5 = string;
@@ -2161,7 +2162,7 @@ export const Linking: LinkingStatic;
*/
export namespace Location {
interface LocationOptions {
enableHighAccuracy?: boolean;
accuracy: number;
timeInterval?: number;
distanceInterval?: number;
timeout?: number;
@@ -2207,6 +2208,20 @@ export namespace Location {
name: string;
}
interface LocationTaskOptions {
accuracy?: number;
showsBackgroundLocationIndicator?: boolean;
}
interface Region {
identifier?: string;
latitude: number;
longitude: number;
radius: number;
notifyOnEnter?: boolean;
notifyOnExit?: boolean;
}
type LocationCallback = (data: LocationData) => void;
function getCurrentPositionAsync(options: LocationOptions): Promise<LocationData>;
@@ -2216,6 +2231,14 @@ export namespace Location {
function watchHeadingAsync(callback: (status: HeadingStatus) => void): EventSubscription;
function geocodeAsync(address: string): Promise<Coords>;
function reverseGeocodeAsync(location: LocationProps): Promise<GeocodeData[]>;
function requestPermissionsAsync(): Promise<void>;
function hasServicesEnabledAsync(): Promise<boolean>;
function startgeocodUpdatesAsync(taskName: string, options: LocationTaskOptions): Promise<void>;
function stopLocationUpdatesAsync(taskName: string): Promise<void>;
function hasStartedLocationUpdatesAsync(taskName: string): Promise<boolean>;
function startGeofencingAsync(taskName: string, regions: Region[]): Promise<void>;
function stopGeofencingAsync(taskName: string): Promise<void>;
function hasStartedGeofencingAsync(taskName: string): Promise<boolean>;
function setApiKey(key: string): void;
}
@@ -2253,46 +2276,72 @@ export namespace Notifications {
sound?: boolean
};
android?: {
sound?: boolean;
channelId?: string;
icon?: string;
color?: string;
priority?: 'min' | 'low' | 'high' | 'max';
sticky?: boolean;
vibrate?: boolean | number[];
link?: string;
};
}
interface SchedulingOptions {
time: Date | number;
repeat?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
intervalMs?: number;
}
interface ChannelAndroid {
name: string;
description?: string;
sound?: boolean;
priority?: 'min' | 'low' | 'default' | 'high' | 'max';
vibrate?: boolean | number[];
badge?: boolean;
}
type LocalNotificationId = string | number;
function addListener(listener: (notification: Notification) => any): EventSubscription;
interface Channel {
name: string;
description?: string;
priority?: string;
sound?: boolean;
vibrate?: boolean | number[];
badge?: boolean;
}
interface ActionType {
actionId: string;
buttonTitle: string;
isDestructive?: boolean;
isAuthenticationRequired?: boolean;
textInput?: {
submitButtonTitle: string;
placeholder: string;
};
}
function createCategoryAsync(categoryId: string, actions: ActionType[]): Promise<void>;
function deleteCategoryAsync(categoryId: string): Promise<void>;
function getExpoPushTokenAsync(): Promise<string>;
function presentLocalNotificationAsync(localNotification: LocalNotification): Promise<LocalNotificationId>;
function scheduleLocalNotificationAsync(
localNotification: LocalNotification,
schedulingOptions: { time: Date | number, repeat?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year' }
): Promise<LocalNotificationId>;
function dismissNotificationAsync(localNotificationId: LocalNotificationId): Promise<void>;
function dismissAllNotificationsAsync(): Promise<void>;
function cancelScheduledNotificationAsync(localNotificationId: LocalNotificationId): Promise<void>;
function cancelAllScheduledNotificationsAsync(): Promise<void>;
function createChannelAndroidAsync(id: string, channel: ChannelAndroid): Promise<void>;
function getDevicePushTokenAsync(config: {
gcmSenderId?: string;
}): Promise<{ type: string; data: string }>;
function createChannelAndroidAsync(id: string, channel: Channel): Promise<void>;
function deleteChannelAndroidAsync(id: string): Promise<void>;
/* Shows a notification instantly */
function presentLocalNotificationAsync(
notification: LocalNotification
): Promise<LocalNotificationId>;
/** Schedule a notification at a later date */
function scheduleLocalNotificationAsync(
notification: LocalNotification,
options?: {
time?: Date | number;
repeat?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
intervalMs?: number;
}
): Promise<LocalNotificationId>;
/** Dismiss currently shown notification with ID (Android only) */
function dismissNotificationAsync(notificationId: LocalNotificationId): Promise<void>;
/** Dismiss all currently shown notifications (Android only) */
function dismissAllNotificationsAsync(): Promise<void>;
/** Cancel scheduled notification notification with ID */
function cancelScheduledNotificationAsync(notificationId: LocalNotificationId): Promise<void>;
/** Cancel all scheduled notifications */
function cancelAllScheduledNotificationsAsync(): Promise<void>;
function addListener(listener: (notification: Notification) => any): EventSubscription;
function getBadgeNumberAsync(): Promise<number>;
function setBadgeNumberAsync(number: number): Promise<void>;
}
@@ -2651,13 +2700,14 @@ export class Svg extends Component<{ width: number, height: number, viewBox?: st
* Take Snapshot
*/
export function takeSnapshotAsync(
view?: (number | React.ReactElement<any>),
node: number | React.ReactElement<any> | React.RefObject<any>,
options?: {
width?: number,
height?: number,
format?: 'png' | 'jpg' | 'jpeg' | 'webm',
quality?: number,
result?: 'file' | 'base64' | 'data-uri',
width?: number;
height?: number;
format: 'png' | 'jpg' | 'raw' | 'webm';
quality: number;
snapshotContentContainer: boolean;
result: "tmpfile" | "base64" | "data-uri" | "zip-base64";
}
): Promise<string>;
File diff suppressed because it is too large Load Diff
+3606
View File
File diff suppressed because it is too large Load Diff
+30
View File
@@ -0,0 +1,30 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"jsx": "react",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"expo": [
"expo/v31"
],
"expo/*": [
"expo/v31/*"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"expo-tests.tsx"
]
}
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
"void-return": false,
"max-line-length": false
}
}