From bf29450ff919ddf3350e606e97343a2c0f0f5d30 Mon Sep 17 00:00:00 2001 From: David Pett Date: Tue, 11 Sep 2018 10:29:17 -0500 Subject: [PATCH] add 'sketch' and 'vr' as platforms to react-primitives (#28674) * add 'sketch' and 'vr' as platforms to react-primitives * Update index.d.ts * fixed lint warnings * added test --- types/react-primitives/index.d.ts | 13 +++++++++++-- types/react-primitives/react-primitives-tests.tsx | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/types/react-primitives/index.d.ts b/types/react-primitives/index.d.ts index 7d276c6a94..ff9917317a 100644 --- a/types/react-primitives/index.d.ts +++ b/types/react-primitives/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for react-primitives 0.6 // Project: https://github.com/lelandrichardson/react-primitives // Definitions by: Ahmed Ghoneim +// David Pett // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -11,7 +12,7 @@ import { Easing, Image, PixelRatio, - Platform, + PlatformOSType as RNPlatformOSType, StyleSheet, Text, TouchableOpacityProps, @@ -20,13 +21,21 @@ import { export const Touchable: ComponentType; +// react-primitives also supports react-sketchapp and react-vr as platforms +export type PlatformOSType = RNPlatformOSType | 'sketch' | 'vr'; +export interface PlatformStatic { + OS: PlatformOSType; + Version: number | string; + select(specifics: { [platform in PlatformOSType | 'default']?: T }): T; +} +export const Platform: PlatformStatic; + export { Animated, Dimensions, Easing, Image, PixelRatio, - Platform, StyleSheet, Text, View diff --git a/types/react-primitives/react-primitives-tests.tsx b/types/react-primitives/react-primitives-tests.tsx index 68512f61c9..7fd45e132e 100644 --- a/types/react-primitives/react-primitives-tests.tsx +++ b/types/react-primitives/react-primitives-tests.tsx @@ -49,6 +49,9 @@ export default class Component extends React.Component<{}, State> { duration: 10000, easing: Easing.cubic }).start(); + if (Platform.OS === 'sketch') { + console.log('The Platform is sketch'); + } } render() {