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
This commit is contained in:
David Pett
2018-09-11 08:29:17 -07:00
committed by Ryan Cavanaugh
parent b883a3573a
commit bf29450ff9
2 changed files with 14 additions and 2 deletions
+11 -2
View File
@@ -1,6 +1,7 @@
// Type definitions for react-primitives 0.6
// Project: https://github.com/lelandrichardson/react-primitives
// Definitions by: Ahmed Ghoneim <https://github.com/aghoneim92>
// David Pett <https://github.com/davidpett>
// 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<TouchableOpacityProps>;
// 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<T>(specifics: { [platform in PlatformOSType | 'default']?: T }): T;
}
export const Platform: PlatformStatic;
export {
Animated,
Dimensions,
Easing,
Image,
PixelRatio,
Platform,
StyleSheet,
Text,
View
@@ -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() {