Refactor update
This commit is contained in:
parent
37dea6c47a
commit
ed27109a51
7 changed files with 366 additions and 96 deletions
78
src/screens/SettingsScreen.js.old
Executable file
78
src/screens/SettingsScreen.js.old
Executable file
|
@ -0,0 +1,78 @@
|
|||
import React from 'react';
|
||||
import {
|
||||
View,
|
||||
Text,
|
||||
TextInput,
|
||||
} from 'react-native';
|
||||
import {
|
||||
Header,
|
||||
Button,
|
||||
} from 'react-native-elements';
|
||||
|
||||
|
||||
class SettingsScreen extends React.Component {
|
||||
// 1
|
||||
constructor(props) {
|
||||
super(props);
|
||||
let initv = this.getMyStringValue;
|
||||
this.state = { value : initv };
|
||||
|
||||
}
|
||||
|
||||
setStringValue = async (value) => {
|
||||
try {
|
||||
await AsyncStorage.setItem('key', value)
|
||||
} catch(e) {
|
||||
// save error
|
||||
}
|
||||
|
||||
//console.log('Done.')
|
||||
}
|
||||
|
||||
getMyStringValue = async () => {
|
||||
try {
|
||||
return await AsyncStorage.getItem('@key')
|
||||
} catch(e) {
|
||||
// read error
|
||||
}
|
||||
|
||||
//console.log('Done.')
|
||||
//this.state.value =rv;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static navigationOptions = ({ navigation }) => {
|
||||
return {
|
||||
title: navigation.getParam('otherParam', 'Settings'),
|
||||
headerStyle: {
|
||||
backgroundColor: '#3333ff',
|
||||
},
|
||||
headerTintColor: '#fff',
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
render() {
|
||||
let value = this.state.value;
|
||||
|
||||
return (
|
||||
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center'}}>
|
||||
<Text>Settings Screen{"\n"}{"\n"}
|
||||
RPI Media Center Control v 1.0 beta Settings{"\n"}</Text>
|
||||
<Text>{"\n"}server IP/hostname: </Text>
|
||||
<TextInput onChangeText={newValue => this.setStringValue(newValue)} style={{borderWidth: 1, width: 100}} >{value}</TextInput>
|
||||
<Text>{"\n"}</Text>
|
||||
|
||||
|
||||
|
||||
|
||||
</View>
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default SettingsScreen;
|
Loading…
Add table
Add a link
Reference in a new issue