Commit 510e8b2e by CaryaLiu

ios specific

parent 1c5d6ad0
...@@ -76,6 +76,10 @@ async function showConfirmVsCancelPromiseDialog(msg, leftTip, rightTip) { ...@@ -76,6 +76,10 @@ async function showConfirmVsCancelPromiseDialog(msg, leftTip, rightTip) {
// } // }
// } // }
function onRegionChange(event) {
console.log(event.region.latitude, event.region.longitue)
}
const App = () => { const App = () => {
var index = 0; var index = 0;
const region = { const region = {
...@@ -84,6 +88,8 @@ const App = () => { ...@@ -84,6 +88,8 @@ const App = () => {
latitudeDelta: 0.1, latitudeDelta: 0.1,
longitudeDelta: 0.1, longitudeDelta: 0.1,
}; };
return ( return (
<> <>
<StatusBar barStyle="dark-content" /> <StatusBar barStyle="dark-content" />
...@@ -98,7 +104,7 @@ const App = () => { ...@@ -98,7 +104,7 @@ const App = () => {
)} )}
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<CustomerView style={{height: 80}}/> <CustomerView style={{height: 80}}/>
<MapView region={region} zoomEnabled={false} style={{ flex: 1, height: 200}} /> <MapView region={region} zoomEnabled={false} onRegionChange={this.onRegionChange} style={{ flex: 1, height: 200}} />
</View> </View>
<View style={styles.body}> <View style={styles.body}>
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
...@@ -153,8 +159,7 @@ const App = () => { ...@@ -153,8 +159,7 @@ const App = () => {
// console.log("你点击了确定,结果为:" + result); // console.log("你点击了确定,结果为:" + result);
// }, true, "你点击了按钮222!", "确定"); // }, true, "你点击了按钮222!", "确定");
} else { } else {
Alert.alert("ios undefine"); NativeModules.ToastManager.showToast("iOS toast");
} }
}} }}
title="单按钮提示框" title="单按钮提示框"
......
...@@ -99,8 +99,8 @@ export default class CustomerView extends React.Component { ...@@ -99,8 +99,8 @@ export default class CustomerView extends React.Component {
}); });
} else { } else {
const alertEmitter = new NativeEventEmitter(NativeModules.AlertManager) const alertEmitter = new NativeEventEmitter(NativeModules.AlertManager)
this.subscription = alertEmitter.addListener('msg', (a) => { this.subscription = alertEmitter.addListener('AlertEvent', (a) => {
console.log("你收到事件" + a.test); console.log("你收到事件:" + a.btnTitle);
}); });
} }
} }
......
ios @ 6cab4d44
Subproject commit 068d46e210861b0b45160b9696df3031527cd46d Subproject commit 6cab4d4445022494b380f0f3bb6e29356b508d94
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
"ios": "react-native run-ios", "ios": "react-native run-ios",
"start": "react-native start", "start": "react-native start",
"test": "jest", "test": "jest",
"lint": "eslint ." "lint": "eslint .",
"bundle-ios": "node node_modules/react-native/local-cli/cli.js bundle --entry-file index.js --platform ios --dev false --bundle-output ./ios/bundle/main.jsbundle --assets-dest ./ios/bundle"
}, },
"dependencies": { "dependencies": {
"bufferutil": "^4.0.1", "bufferutil": "^4.0.1",
......
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