Skip to content

Commit

Permalink
[change] Export stubs for iOS/Android modules
Browse files Browse the repository at this point in the history
Fix #958
Fix #967
  • Loading branch information
necolas committed Jun 4, 2018
1 parent a8e5d43 commit cf43ffd
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/babel-plugin-react-native-web/src/moduleMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module.exports = {
Slider: true,
StatusBar: true,
StyleSheet: true,
SwipeableListView: true,
Switch: true,
Text: true,
TextInput: true,
Expand Down
114 changes: 112 additions & 2 deletions packages/react-native-web/src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import UnimplementedView from './modules/UnimplementedView';

import createElement from './exports/createElement';
import findNodeHandle from './exports/findNodeHandle';
import processColor from './exports/processColor';
Expand Down Expand Up @@ -69,6 +71,43 @@ import ColorPropType from './exports/ColorPropType';
import EdgeInsetsPropType from './exports/EdgeInsetsPropType';
import PointPropType from './exports/PointPropType';

const emptyObject = {};
// compat (components)
const DatePickerIOS = UnimplementedView;
const DrawerLayoutAndroid = UnimplementedView;
const ImageEditor = UnimplementedView;
const ImageStore = UnimplementedView;
const InputAccessoryView = UnimplementedView;
const MaskedViewIOS = UnimplementedView;
const NavigatorIOS = UnimplementedView;
const PickerIOS = UnimplementedView;
const ProgressBarAndroid = UnimplementedView;
const ProgressViewIOS = UnimplementedView;
const SegmentedControlIOS = UnimplementedView;
const SnapshotViewIOS = UnimplementedView;
const SwipeableFlatList = UnimplementedView;
const SwipeableListView = UnimplementedView;
const TabBarIOS = UnimplementedView;
const ToastAndroid = UnimplementedView;
const ToolbarAndroid = UnimplementedView;
const ViewPagerAndroid = UnimplementedView;
const WebView = UnimplementedView;
const YellowBox = UnimplementedView;
// compat (apis)
const ActionSheetIOS = emptyObject;
const AlertIOS = emptyObject;
const CameraRoll = emptyObject;
const DatePickerAndroid = emptyObject;
const ImagePickerIOS = emptyObject;
const PermissionsAndroid = emptyObject;
const PushNotificationIOS = emptyObject;
const Settings = emptyObject;
const StatusBarIOS = emptyObject;
const Systrace = emptyObject;
const TimePickerAndroid = emptyObject;
const TVEventHandler = emptyObject;
const VibrationIOS = emptyObject;

export {
// top-level API
createElement,
Expand Down Expand Up @@ -138,7 +177,42 @@ export {
// propTypes
ColorPropType,
EdgeInsetsPropType,
PointPropType
PointPropType,
// compat (components)
DatePickerIOS,
DrawerLayoutAndroid,
ImageEditor,
ImageStore,
InputAccessoryView,
MaskedViewIOS,
NavigatorIOS,
PickerIOS,
ProgressBarAndroid,
ProgressViewIOS,
SegmentedControlIOS,
SnapshotViewIOS,
SwipeableFlatList,
SwipeableListView,
TabBarIOS,
ToastAndroid,
ToolbarAndroid,
ViewPagerAndroid,
WebView,
YellowBox,
// compat (apis)
ActionSheetIOS,
AlertIOS,
CameraRoll,
DatePickerAndroid,
ImagePickerIOS,
PermissionsAndroid,
PushNotificationIOS,
Settings,
StatusBarIOS,
Systrace,
TimePickerAndroid,
TVEventHandler,
VibrationIOS
};

const ReactNative = {
Expand Down Expand Up @@ -210,7 +284,43 @@ const ReactNative = {
// propTypes
ColorPropType,
EdgeInsetsPropType,
PointPropType
PointPropType,

// compat (components)
DatePickerIOS,
DrawerLayoutAndroid,
ImageEditor,
ImageStore,
InputAccessoryView,
MaskedViewIOS,
NavigatorIOS,
PickerIOS,
ProgressBarAndroid,
ProgressViewIOS,
SegmentedControlIOS,
SnapshotViewIOS,
SwipeableFlatList,
SwipeableListView,
TabBarIOS,
ToastAndroid,
ToolbarAndroid,
ViewPagerAndroid,
WebView,
YellowBox,
// compat (apis)
ActionSheetIOS,
AlertIOS,
CameraRoll,
DatePickerAndroid,
ImagePickerIOS,
PermissionsAndroid,
PushNotificationIOS,
Settings,
StatusBarIOS,
Systrace,
TimePickerAndroid,
TVEventHandler,
VibrationIOS
};

export default ReactNative;

0 comments on commit cf43ffd

Please sign in to comment.