Commit 80be55dd by leiyongsheng

修改导航测试

parent 41463039
android @ cfa005dd
Subproject commit e108a7d998fec6596b0dfdc572b478779f3f3f73 Subproject commit cfa005dd4b3902d32a52ef4eeaffb20ada906c4d
...@@ -9,6 +9,6 @@ import { name as appName } from './app.json'; ...@@ -9,6 +9,6 @@ import { name as appName } from './app.json';
AppRegistry.registerComponent(appName, (props) => { AppRegistry.registerComponent(appName, (props) => {
console.log('AppRegistry.registerComponent:' + props); console.log('AppRegistry.registerComponent:' + props);
return App; // return App;
// return NavigateEntryTest; return NavigateEntryTest;
}); });
...@@ -6,6 +6,7 @@ import { ...@@ -6,6 +6,7 @@ import {
Button, Button,
Image, Image,
ScrollView, ScrollView,
TextInput
} from 'react-native'; } from 'react-native';
import { IC_LAUNCHER, IC_WARN } from '../assets/images' import { IC_LAUNCHER, IC_WARN } from '../assets/images'
import { NavigationContainer } from '@react-navigation/native'; import { NavigationContainer } from '@react-navigation/native';
...@@ -91,6 +92,23 @@ function TabHome() { ...@@ -91,6 +92,23 @@ function TabHome() {
); );
} }
async function showBaseInfo(flag) {
try {
var result
if (flag === 1) {
result = await BMCInfo.getDeviceInfo();
} else if (flag === 2) {
result = await BMCInfo.getLoginInfo();
} else {
result = await BMCInfo.getUserInfo();
}
console.log("result:" + result + " \n token: " + result.token + " nickname:" + result.nickname + " Version:" + result.Version);
} catch (e) {
console.error(e);
}
}
class HomeScreen extends React.Component { class HomeScreen extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
...@@ -135,6 +153,7 @@ class HomeScreen extends React.Component { ...@@ -135,6 +153,7 @@ class HomeScreen extends React.Component {
const { otherParam } = this.props.route.params; const { otherParam } = this.props.route.params;
return ( return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<TextInput value="2121" style={{ height: 30, backgroundColor: "red", width: 100 }}></TextInput>
<Text>Home Screen</Text> <Text>Home Screen</Text>
<Text>itemId: {JSON.stringify(itemId)}</Text> <Text>itemId: {JSON.stringify(itemId)}</Text>
<Text>otherParam: {JSON.stringify(otherParam)}</Text> <Text>otherParam: {JSON.stringify(otherParam)}</Text>
...@@ -165,15 +184,18 @@ class HomeScreen extends React.Component { ...@@ -165,15 +184,18 @@ class HomeScreen extends React.Component {
<Text style={{ margin: 10 }}>result data: {this.props.route.params?.post}</Text> <Text style={{ margin: 10 }}>result data: {this.props.route.params?.post}</Text>
<Button <Button
title="show app info" title="show app info"
onPress={this.showUserInfo} // onPress={this.showUserInfo}
onPress={() => showBaseInfo(3)}
/> />
<Button <Button
title="show login info" title="show login info"
onPress={this.showLoginInfo} // onPress={this.showLoginInfo}
onPress={() => showBaseInfo(2)}
/> />
<Button <Button
title="show devices info" title="show devices info"
onPress={this.showDevicesInfo} // onPress={this.showDevicesInfo}
onPress={() => showBaseInfo(1)}
/> />
</View> </View>
); );
......
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