Introduce Platform in React
React Native provides Platform.
This commit is contained in:
parent
28b44cf67c
commit
5f21e4c5b6
|
@ -1,9 +1,11 @@
|
|||
/* global __DEV__ */
|
||||
|
||||
import React from 'react';
|
||||
import { Linking, Navigator, Platform } from 'react-native';
|
||||
import { Linking, Navigator } from 'react-native';
|
||||
import { Provider } from 'react-redux';
|
||||
|
||||
import { Platform } from '../../base/react';
|
||||
|
||||
import { _getRouteToRender } from '../functions';
|
||||
import { AbstractApp } from './AbstractApp';
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import { Platform } from 'react-native';
|
||||
import {
|
||||
RTCPeerConnection,
|
||||
RTCSessionDescription
|
||||
} from 'react-native-webrtc';
|
||||
import { RTCPeerConnection, RTCSessionDescription } from 'react-native-webrtc';
|
||||
|
||||
import { Platform } from '../../react';
|
||||
import { POSIX } from '../../react-native';
|
||||
|
||||
// XXX At the time of this writing extending RTCPeerConnection using ES6 'class'
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import React, { Component } from 'react';
|
||||
import { Platform, View } from 'react-native';
|
||||
import { View } from 'react-native';
|
||||
import { RTCView } from 'react-native-webrtc';
|
||||
|
||||
import { Platform } from '../../../react';
|
||||
|
||||
import { styles } from './styles';
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
// Re-export react-native's Platform because we want to provide a minimal
|
||||
// equivalent on Web.
|
||||
import { Platform } from 'react-native';
|
||||
export default Platform;
|
|
@ -0,0 +1,20 @@
|
|||
const userAgent = navigator.userAgent;
|
||||
let OS;
|
||||
|
||||
if (userAgent.match(/Android/i)) {
|
||||
OS = 'android';
|
||||
} else if (userAgent.match(/iP(ad|hone|od)/i)) {
|
||||
OS = 'ios';
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a minimal equivalent of react-native's Platform abstraction.
|
||||
*/
|
||||
export default {
|
||||
/**
|
||||
* The operating system on which the application is executing.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
OS
|
||||
};
|
|
@ -1,3 +1,4 @@
|
|||
export * from './components';
|
||||
export * from './functions';
|
||||
export { default as Platform } from './Platform';
|
||||
export { default as Symbol } from './Symbol';
|
||||
|
|
Loading…
Reference in New Issue