rn调用原生view方法,不是属性,直接通过view名来调用
import { NativeModules } from 'react-native';
原生view
class MegaMediaPlayerRNManager : SimpleViewManager<MediaLiveStreamVideoView>() { override fun getName(): String { return "RNTPlay" }
..
@ReactMethod() fun release() { //这里是需要调用原生的方法 }
}
//RN调用
try {
if (Platform.OS === 'android') {
NativeModules.RNTPlay.release();
//NativeModules.你在原生定义的View名称.view里面的方法名
}
}catch (error){
}
原文地址:https://blog.csdn.net/qq_34812958/article/details/137931683
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!