-
Notifications
You must be signed in to change notification settings - Fork 1
/
react-native.js
80 lines (76 loc) · 1.74 KB
/
react-native.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
* https://github.com/lelandrichardson/react-native-mock/blob/master/src/react-native.js
*/
'use strict';
const ReactNative = require('./react-native-mock/react-native');
const React = require('react');
/**
* render react-native component to HTML
*/
const renderToHTML = (type) => {
var proto = ReactNative[type].prototype;
if (typeof proto !== 'undefined') {
const render = function () {
var properties = {className: type};
Object.assign(properties, this.props);
/**
* use onClick for Simulate instead of onPress
*/
if (typeof this.props.onPress !== 'undefined') {
properties.onClick = this.props.onPress;
delete properties.onPress;
}
// TODO: add more event mapping
return (
<div {...properties}>{this.props.children}</div>
);
};
//proto.__reactAutoBindPairs[proto.__reactAutoBindPairs.indexOf['render'] + 1] = render;
proto['render'] = render;
}
};
/**
* react-native components
*/
[
'ActivityIndicatorIOS',
'ART',
'DatePickerIOS',
'DrawerLayoutAndroid',
'Image',
'ImageEditor',
'ImageStore',
'ListView',
'MapView',
'Modal',
'Navigator',
'NavigatorIOS',
'Picker',
'PickerIOS',
'ProgressBarAndroid',
'ProgressViewIOS',
'ScrollView',
'SegmentedControlIOS',
'SliderIOS',
'SnapshotViewIOS',
'Switch',
'PullToRefreshViewAndroid',
'RecyclerViewBackedScrollView',
'RefreshControl',
'SwitchAndroid',
'SwitchIOS',
'TabBarIOS',
'Text',
'TextInput',
'ToastAndroid',
'ToolbarAndroid',
'Touchable',
'TouchableHighlight',
'TouchableNativeFeedback',
'TouchableOpacity',
'TouchableWithoutFeedback',
'View',
'ViewPagerAndroid',
'WebView',
].forEach(renderToHTML);
module.exports = ReactNative;