Make compatible with webpack (#244)

This commit is contained in:
Satyajit Sahoo 2017-02-09 02:30:58 +05:30 committed by Adam Miskiewicz
parent 752d876994
commit 1247806f9b
9 changed files with 31 additions and 15 deletions

View File

@ -21,7 +21,7 @@
"transform-flow-strip-types",
],
},
// For publishing to NPM for RN
// For publishing to NPM for web
"publish-web": {
"presets": ["es2015", "stage-1", "react"],
"plugins": [

View File

@ -7,6 +7,7 @@
"react-native-v1": "lib-rn/react-navigation.js",
"web": "lib/react-navigation.web.js"
},
"module": "lib/react-navigation.web.js",
"webpack": "lib/react-navigation.web.js",
"repository": {
"url": "git@github.com:react-community/react-navigation.git",

11
src/PlatformHelpers.js Normal file
View File

@ -0,0 +1,11 @@
/* @flow */
export const Linking = {
addEventListener: () => {},
removeEventListener: () => {},
getInitialURL: () => Promise.reject('Unsupported platform'),
};
export const BackAndroid = {
addEventListener: () => {},
};

View File

@ -0,0 +1,12 @@
/* @flow */
import {
BackAndroid,
Linking,
} from 'react-native';
export {
BackAndroid,
Linking,
};

View File

@ -1,11 +1,11 @@
/* @flow */
import React from 'react';
import invariant from 'fbjs/lib/invariant';
import {
BackAndroid,
Linking,
} from 'react-native';
import invariant from 'fbjs/lib/invariant';
} from './PlatformHelpers';
import NavigationActions from './NavigationActions';
import addNavigationHelpers from './addNavigationHelpers';

View File

@ -7,7 +7,6 @@ module.exports = {
// Core
get createNavigationContainer() { return require('./createNavigationContainer').default; },
get StateUtils() { return require('./StateUtils').default; },
get PropTypes() { return require('./PropTypes').default; },
get addNavigationHelpers() { return require('./addNavigationHelpers').default; },
get NavigationActions() { return require('./NavigationActions').default; },

View File

@ -78,9 +78,6 @@ module.exports = {
// https://github.com/facebookincubator/create-react-app/issues/290
extensions: ['.js', '.json', '.jsx', ''],
alias: {
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web',
'react-navigation': path.resolve(__dirname, '../../'),
},
},

View File

@ -81,9 +81,6 @@ module.exports = {
// https://github.com/facebookincubator/create-react-app/issues/290
extensions: ['.js', '.json', '.jsx', ''],
alias: {
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web',
'react-navigation': path.resolve(__dirname, '../../'),
},
},

View File

@ -57,7 +57,6 @@
"react-addons-css-transition-group": "~15.3.2",
"react-dom": "~15.3.2",
"react-markdown": "^2.4.2",
"react-native-web": "^0.0.55",
"react-navigation": "^0.0.0",
"slugify": "^1.1.0"
},