Introduce Platform in React

React Native provides Platform.
pull/1245/head
Lyubomir Marinov 8 years ago
parent 28b44cf67c
commit 5f21e4c5b6
  1. 4
      react/features/app/components/App.native.js
  2. 7
      react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js
  3. 4
      react/features/base/media/components/native/Video.js
  4. 4
      react/features/base/react/Platform.native.js
  5. 20
      react/features/base/react/Platform.web.js
  6. 1
      react/features/base/react/index.js

@ -1,9 +1,11 @@
/* global __DEV__ */ /* global __DEV__ */
import React from 'react'; import React from 'react';
import { Linking, Navigator, Platform } from 'react-native'; import { Linking, Navigator } from 'react-native';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { Platform } from '../../base/react';
import { _getRouteToRender } from '../functions'; import { _getRouteToRender } from '../functions';
import { AbstractApp } from './AbstractApp'; 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'; import { POSIX } from '../../react-native';
// XXX At the time of this writing extending RTCPeerConnection using ES6 'class' // XXX At the time of this writing extending RTCPeerConnection using ES6 'class'

@ -1,7 +1,9 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Platform, View } from 'react-native'; import { View } from 'react-native';
import { RTCView } from 'react-native-webrtc'; import { RTCView } from 'react-native-webrtc';
import { Platform } from '../../../react';
import { styles } from './styles'; 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 './components';
export * from './functions'; export * from './functions';
export { default as Platform } from './Platform';
export { default as Symbol } from './Symbol'; export { default as Symbol } from './Symbol';

Loading…
Cancel
Save