Commit 142f06bb by leiyongsheng

添加native module调试

parent 422c2056
...@@ -8,13 +8,17 @@ ...@@ -8,13 +8,17 @@
import React from 'react'; import React from 'react';
import { import {
NativeModules,
SafeAreaView, SafeAreaView,
StyleSheet, StyleSheet,
ScrollView, ScrollView,
View, View,
Text, Text,
Button,
StatusBar, StatusBar,
Alert,
} from 'react-native'; } from 'react-native';
import BMCUI from './ui.js'
import { import {
Header, Header,
...@@ -39,6 +43,49 @@ const App: () => React$Node = () => { ...@@ -39,6 +43,49 @@ const App: () => React$Node = () => {
</View> </View>
)} )}
<View style={styles.body}> <View style={styles.body}>
<View style={styles.buttonContainer}>
<Button
style={styles.buttonStyle}
onPress={() => {
// BMCUI.show('"你点击了按钮!");\
console.log(NativeModules);
NativeModules.BMCUI.show("你点击了按钮111!");
// NativeModules.BMCUI.showWithDuration("你点击了按钮!", NativeModules.BMCUI.SHORT);
// Alert.alert("你点击了按钮");
}}
title="吐司"
/>
</View>
<View style={styles.buttonContainer}>
<Button
style={styles.buttonStyle}
onPress={() => {
BMCUI.showConfirmDialogWithCancelable(false, "你点击了按钮222!", "确定", (result) => {
console.log("你点击了取确定按钮,结果为:" + result);
});
// BMCUI.showConfirmDialog("你点击了按钮222!", "确定", (result) => {
// console.log("你点击了确定,结果为:" + result);
// });
// BMCUI.showConfirmDialogWithCancelableError((result) => {
// console.log("你点击了确定,结果为:" + result);
// }, true, "你点击了按钮222!", "确定");
}}
title="单按钮提示框"
/>
</View>
<View style={styles.buttonContainer}>
<Button
style={styles.buttonStyle}
onPress={() => {
BMCUI.showConfirmVsCancelDialog("你点击了按钮333!", "取消", "确定", (result) => {
console.log("你点击了取消单按钮,结果为:" + result);
}, (result) => {
console.log("你点击了取确定按钮,结果为:" + result);
});
}}
title="双按钮提示框"
/>
</View>
<View style={styles.sectionContainer}> <View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Step One 111</Text> <Text style={styles.sectionTitle}>Step One 111</Text>
<Text style={styles.sectionDescription}> <Text style={styles.sectionDescription}>
...@@ -85,7 +132,11 @@ const styles = StyleSheet.create({ ...@@ -85,7 +132,11 @@ const styles = StyleSheet.create({
}, },
sectionContainer: { sectionContainer: {
marginTop: 32, marginTop: 32,
paddingHorizontal: 24, paddingHorizontal: 24
},
buttonContainer: {
marginTop: 5,
paddingHorizontal: 24
}, },
sectionTitle: { sectionTitle: {
fontSize: 24, fontSize: 24,
......
android @ 5308f0b6
Subproject commit a3c051798cd3891c630fc5271346d67120eeb062 Subproject commit 5308f0b69d84c40a54636b3c97b4fc6c95840eea
/**
* This exposes the native BMCUI module as a JS module. This has a
* function 'show' which takes the following parameters:
*
* 1. String message: A string with the text to toast
*/
import { NativeModules } from 'react-native';
// 下一句中的BMCUI即对应上文
// public String getName()中返回的字符串
export default NativeModules.BMCUI;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment