Commit 7cb8077e by HaOuiha

update

parent cd1feaf6
......@@ -8,8 +8,8 @@ import { width } from '../../../constants/Layout';
import { Overlay } from 'react-native-elements';
import { connect } from 'react-redux';
import { updateDetail } from '../../../reduxStore/actions/currentSelectedAction';
import Slider from 'react-native-slider';
import Modal from 'react-native-modalbox';
class updateDetailScreen extends Component {
static navigationOptions = ({ navigation }) => {
......@@ -116,7 +116,7 @@ class updateDetailScreen extends Component {
) : (
<View style={styles.textInputContainer}>
<TextInput
multiline={true}
multiline={this.state.field === 'Description' ? true : false}
style={[theme.description, { fontSize: 14 }]}
onChangeText={data => this.setState({ data })}
value={data}
......@@ -127,7 +127,31 @@ class updateDetailScreen extends Component {
<Button full style={styles.saveButton} onPress={() => this.toggleModal(true)}>
<Text style={[theme.normalText, theme.textWhite]}>SAVE</Text>
</Button>
<Overlay
<Modal
coverScreen
swipeToClose={false}
animationDuration={250}
style={{ height: '25%', width: '90%', borderRadius: 20 }}
position={'center'}
isOpen={isVisible}
onClosed={() => this.toggleModal(false)}
>
<View style={styles.overlayStyle}>
<Text style={[theme.normalText, theme.textDark, theme.centerText, { marginHorizontal: 30 }]}>
Are you sure you want to save this item?
</Text>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Button transparent style={{ width: '40%' }} onPress={() => this.toggleModal(false)}>
<Text style={{ color: color.grey }}>CANCEL</Text>
</Button>
<Button style={styles.saveButtonModal} rounded onPress={() => this.handleConfirm()}>
<Text>SAVE</Text>
</Button>
</View>
</View>
</Modal>
{/* <Overlay
borderRadius={20}
height={'25%'}
width={'90%'}
......@@ -148,7 +172,7 @@ class updateDetailScreen extends Component {
</Button>
</View>
</>
</Overlay>
</Overlay> */}
</View>
);
}
......@@ -166,6 +190,7 @@ export default connect(
const styles = StyleSheet.create({
overlayStyle: {
padding: 20,
flex: 1,
alignItems: 'center',
justifyContent: 'space-around',
},
......
......@@ -23,7 +23,7 @@ export default class WifiSelectScreen extends React.Component {
),
};
};
renderWifiList() {
renderWifiList = () => {
return (
<FlatList
data={mock.filter(x => x.connected === false)}
......@@ -34,15 +34,13 @@ export default class WifiSelectScreen extends React.Component {
style={{ marginBottom: isIphoneX() ? 100 : 65 }}
/>
);
}
renderWifiCard(item) {
};
renderWifiCard = item => {
return (
<TouchableOpacity
style={[
styles.cardContainer,
{
backgroundColor: item.connected ? 'rgba(238,84,84,0.2)' : color.white,
},
{ backgroundColor: item.connected ? 'rgba(238,84,84,0.2)' : color.white },
]}
>
<View style={[theme.rowContainer, { justifyContent: 'space-between' }]}>
......@@ -61,7 +59,7 @@ export default class WifiSelectScreen extends React.Component {
</View>
</TouchableOpacity>
);
}
};
render() {
return (
<ScrollView style={[theme.container, {}]}>
......
......@@ -228,9 +228,7 @@ class McbLinkScreen extends React.Component {
}
}}
ItemSeparatorComponent={() => <View style={{ margin: 5 }} />}
keyExtractor={(item, index) => {
`elec${index}`;
}}
keyExtractor={(item, index) => `elec${index}`}
key={`scrollPage${index}`}
/>
);
......@@ -296,11 +294,7 @@ class McbLinkScreen extends React.Component {
<TextInput
placeholder="Device name"
style={[theme.normalText, { width: '100%' }]}
onChangeText={text =>
this.setState({
deviceName: text,
})
}
onChangeText={text => this.setState({ deviceName: text })}
value={deviceName}
/>
</View>
......@@ -333,10 +327,7 @@ class McbLinkScreen extends React.Component {
<Image
style={[
styles.electronicIcon,
{
tintColor: dynamicColor,
resizeMode: 'contain',
},
{ tintColor: dynamicColor, resizeMode: 'contain' },
]}
source={getDeviceIcon(item.type)}
/>
......@@ -412,7 +403,7 @@ class McbLinkScreen extends React.Component {
animationDuration={360}
style={[styles.addModal]}
position={'bottom'}
isOpen={this.state.isAddElectronicVisible}
visible={this.state.isAddElectronicVisible}
onClosed={() => this.setState({ isAddElectronicVisible: false })}
>
{this.renderAddModal()}
......
......@@ -179,7 +179,7 @@ class SmartMeterDetailScreen extends Component {
<Card style={{ padding: 15, marginBottom: 20, borderRadius: 10, borderColor: color.white }}>
<Row style={{ justifyContent: 'center', alignItems: 'center' }}>
<Left>
<Text style={[theme.smallTitle, { color: color.darkGrey }]}>{name || 'Untitled'}</Text>
<Text style={[theme.smallTitle, { color: color.darkGrey }]}>{name}</Text>
</Left>
<Right>
<Switch
......@@ -361,12 +361,7 @@ class SmartMeterDetailScreen extends Component {
};
return (
<Card
style={{
borderColor: color.white,
borderRadius: 8,
}}
>
<Card style={{ borderColor: color.white, borderRadius: 8 }}>
<Row
style={{ paddingVertical: 7, paddingLeft: 7, paddingRight: Platform.OS === 'android' ? 12 : 7 }}
onPress={handleOnPressMcbLink}
......@@ -451,7 +446,7 @@ class SmartMeterDetailScreen extends Component {
/>
) : (
<View style={{ marginTop: 20 }}>
<Text>{this.props.error}</Text>
<Text>{'Something went wrong ' + this.props.error}</Text>
</View>
)
// </Card>
......
......@@ -129,7 +129,7 @@ class SmartMeterScreen extends PureComponent {
</>
) : (
<View>
<Text>{error}</Text>
<Text>{'Something went wrong ' + error}</Text>
</View>
);
}
......@@ -165,9 +165,7 @@ const mapStateToProps = state => ({
error: state.allMainDeviceReducer.error,
});
const mapDispatchToProps = {
getAllMainDeviceInfo,
};
const mapDispatchToProps = { getAllMainDeviceInfo };
export default connect(
mapStateToProps,
......
......@@ -29,19 +29,16 @@ class AuthLoadingScreen extends Component {
}, 900); // 1200
};
_bootstrapAsync = async () => {
bootstrapAsync = async () => {
this.showLogoThenIndicator();
try {
// Preload data from an external API
// Preload data using AsyncStorage
// Preload data from an external API && Preload data using AsyncStorage
const alreadyLaunched = await AsyncStorage.getItem('alreadyLaunched');
const RememberedLogin = await AsyncStorage.getItem('RememberedLogin');
app.auth().onAuthStateChanged(async user => {
if (user) {
console.log(user);
// const idToken = await app.auth().currentUser.getIdToken(/* forceRefresh */ true);
// console.log(idToken);
await this.props.getCurrentUser(user);
this.props.navigation.navigate(RememberedLogin === 'true' ? 'Main' : 'Login');
// createMockData();
......@@ -56,7 +53,7 @@ class AuthLoadingScreen extends Component {
componentDidMount = () => {
this._isMounted = true;
this._bootstrapAsync();
this.bootstrapAsync();
};
componentWillUnmount = () => {
......@@ -67,13 +64,7 @@ class AuthLoadingScreen extends Component {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
{this.state.isShowImg ? (
<Image
style={{
width: width * 0.9,
resizeMode: 'contain',
}}
source={logo}
/>
<Image style={{ width: width * 0.9, resizeMode: 'contain' }} source={logo} />
) : (
<ActivityIndicator size="large" color="#f44c4c" />
)}
......
......@@ -21,7 +21,7 @@ export default class LoginScreen extends Component {
const { username, password } = values;
try {
await app.auth().signInWithEmailAndPassword(username, password);
this.success();
await this.success();
} catch (error) {
alert(error);
}
......
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