How to use
/**
- Sample React Native App
- https://github.com/facebook/react-native
- @flow */
;; const instructions = Platform; type Props = {};<Props> { DeviceEventEmitter; } { console; // DeviceEventEmitter.removeListener('onScanningResult',this.onScanningResult);//移除扫描监听 } { // NativeModules.BGNativeModuleExample.testPrint("Jack", { // height: '1.78m', // weight: '7kg' // }); NativeModulesBGNativeModuleExample } { NativeModulesBGNativeModuleExample; } { NativeModulesBGNativeModuleExample ; } { // alert(NativeModules.BGNativeModuleExample.BGModuleName) } { return <View style=stylescontainer> <Text style=styleswelcome> Welcome to React Native! </Text> <Text style=stylesinstructions> To get started edit Appjs </Text> <Text style=stylesinstructions> instructions </Text> <Text onPress=this>点击</Text> <Text onPress=this>回调函数</Text> <Text onPress=this>Promise回调</Text> <Text onPress=this>常量</Text> </View> ; } const styles = StyleSheet;
注释:添加module时候的build.gradle的SDK要和主工程的SDK相同最好