-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.other.ios.js
125 lines (107 loc) · 3.77 KB
/
index.other.ios.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Dimensions,
ScrollView,
AlertIOS,
Alert,
} from 'react-native';
var {width,height} = Dimensions.get('window')
import MLView from './MLView';//引入view
import SycScrollView from './SycScrollView'; //引入原生自定义view
// var SycScrollView = require('./SycScrollView');
// var SycScrollViewContns = require('react-native').UIManager.SycScrollView.Constants;//导入常量
var bannerImages = [
'http://upload-images.jianshu.io/upload_images/2321678-ba5bf97ec3462662.png?imageMogr2/auto-orient/strip%7CimageView2/2',
'http://upload-images.jianshu.io/upload_images/1487291-2aec9e634117c24b.jpeg?imageMogr2/auto-orient/strip%7CimageView2/2/w/480/q/100',
'http://f.hiphotos.baidu.com/zhidao/pic/item/e7cd7b899e510fb37a4f2df3db33c895d1430c7b.jpg'
];
export default class RNIOS extends Component {
constructor(Props) {
super(Props);
this.state = {
bannerNum :0
}
}
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
RNOCtest
</Text>
<MLView style={styles.content}
dict={{'name':'syc'}} //模拟RN使用原生组件回传数据到oc
onClickView={(e) => {//模拟原生回传数据给RN
Alert.alert(
'Alert Title',
'My Alert Msg',
[
{text: 'result'+e.nativeEvent, onPress: () => console.log('Ask me later pressed')},
{text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
{text: 'OK', onPress: () => console.log('OK Pressed')},
],
{ cancelable: false }
)
console.log('test' + e.nativeEvent.value);}}/>
{/*<ScrollView style = {{marginTop:64}}>*/}
{/*<View>*/}
{/*<SycScrollView style={styles.content}*/}
{/*autoScrollTimeInterval = {2}*/}
{/*imageURLStringsGroup = {bannerImages}*/}
{/*dict={{'name':'syc'}}*/}
{/*pageControlAliment = {0}*/}
{/*onClickView={(e) => {*/}
{/*console.log('test' + e.nativeEvent.value);*/}
{/*this.setState({bannerNum:e.nativeEvent.value});*/}
{/*}}*/}
{/*/>*/}
{/*<Text style={{fontSize: 15, margin: 10, textAlign:'center'}}>*/}
{/*点击banner -> {this.state.bannerNum}*/}
{/*</Text>*/}
{/*</View>*/}
{/*</ScrollView>*/}
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
sycScroll:{
flex: 1,
width:width,
height:height-64-40,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fa8b2d',
},content:{
backgroundColor: '#fa1b18',
borderColor:'#e7e7e7',
marginTop:10,
height:200,
width:width,
}
});
AppRegistry.registerComponent('RNIOS', () => RNIOS);