import
React
{
Component
}
from
'react'
;
import
{
View
Crayon-sy" style="margin:0px; padding:0px; border:0px; font-style:inherit; height:inherit; font-size:inherit!important; line-height:inherit!important; color:rgb(51,
Text
Crayon-sy" style="margin:0px; padding:0px; border:0px; font-style:inherit; height:inherit; font-size:inherit!important; line-height:inherit!important; color:rgb(51,
StyleSheet
Crayon-sy" style="margin:0px; padding:0px; border:0px; font-style:inherit; height:inherit; font-size:inherit!important; line-height:inherit!important; color:rgb(51,
Image
Crayon-sy" style="margin:0px; padding:0px; border:0px; font-style:inherit; height:inherit; font-size:inherit!important; line-height:inherit!important; color:rgb(51,
Alert
Crayon-sy" style="margin:0px; padding:0px; border:0px; font-style:inherit; height:inherit; font-size:inherit!important; line-height:inherit!important; color:rgb(51,
NativeAppEventEmitter
Crayon-sy" style="margin:0px; padding:0px; border:0px; font-style:inherit; height:inherit; font-size:inherit!important; line-height:inherit!important; color:rgb(51,
//引用NativeAppEventEmitter组件进行监听Native端派发的事件
'react-native'
;
var
TestOJO
require
NativeModules
TestOJO
;
o2cFun
addListener
(
'eventName'
Crayon-sy" style="margin:0px; padding:0px; border:0px; font-style:inherit; height:inherit; font-size:inherit!important; line-height:inherit!important; color:rgb(51,
para
=
>
alert
'被OC触发'
'字典数据:\n name:'
+
name
+
'\n age:'
age
)
;
// 千万不要忘记忘记取消订阅,通常在componentWillUnmount函数中实现。
// o2cFun.remove();
export
default
class
Main
extends
Component
{
constructor
props
{
super
;
this
state
{
selectedTab
'home'
;
}
{
;
}
render
{
return
(
<
View
style
{
{
flex
1
alignItems
'center'
}
>
<
Text
styles
himiTextStyle
>
Himi
React
Native
系列教程
<
/
Text
>
Text
onPress
)
>
{
j2oFun1
'Himi'
12321
;
j2oFun2
{
Crayon-h" style="margin:0px; padding:0px; border:0px; font-style:inherit; height:inherit; font-size:inherit!important; line-height:inherit!important; color:rgb(0,
age
:
Crayon-cn" style="margin:0px; padding:0px; border:0px; font-style:inherit; height:inherit; font-size:inherit!important; line-height:inherit!important; color:rgb(206,
array
[
'hi,Himi'
'i,m'
'a array!'
]
;
j2oCallbackEvent
Crayon-sy" style="margin:0px; padding:0px; border:0px; font-style:inherit; height:inherit; font-size:inherit!important; line-height:inherit!important; color:rgb(51,
error
callBackEvents
{
if
{
console
error
;
else
{
@H_
403_1981@
'J2O带返回值'
'数组的三个值:\n[0]:'
[
]
'\n[1]:'
'\n[2]:'
2
;