Commit 54d429fa by HaOuiha

binding value & add loading to gradientbn

parent 9071f391
......@@ -52,6 +52,7 @@ class Login extends Component {
Keyboard.dismiss();
}}
title={'login'}
loading={this.props.loading}
/>
</>
);
......
......@@ -2,6 +2,8 @@ import React from 'react';
import LinearGradient from 'react-native-linear-gradient';
import { color } from '../constants/Styles';
import { Button, Text } from 'native-base';
import { ActivityIndicator } from 'react-native';
const GradientBtn = props => {
return (
<LinearGradient
......@@ -10,8 +12,12 @@ const GradientBtn = props => {
end={{ x: 1.0, y: 0.0 }}
style={{ borderRadius: 100, alignItems: 'center', marginTop: 30 }}
>
<Button full transparent onPress={props.onPress}>
<Button full transparent onPress={props.onPress} disabled={props.loading}>
{props.loading ? (
<ActivityIndicator color={color.white} />
) : (
<Text style={{ color: color.white, fontFamily: 'Avenir-Roman' }}>{props.title.toUpperCase()}</Text>
)}
</Button>
</LinearGradient>
);
......
......@@ -12,7 +12,8 @@ const MeterCard = ({ item, onPressEachCard }) => {
styles.meterOn,
{ backgroundColor: item.breakerStatus === 1 ? 'rgba(65, 204, 0, 0.59)' : 'rgba(223, 0, 0, 0.59)' },
]}
></View>
/>
{/* <View style={[styles.meterOnInner, { backgroundColor: item.breakerStatus === 1 ? 'rgba(65, 204, 0, 0.2)' : 'rgba(223, 0, 0, 0.2)'}]} /> */}
<View style={[theme.centerContainer, { paddingLeft: 10 }]}>
{item.img ? (
<Image source={{ uri: item.img }} style={styles.meterImgStyle} />
......@@ -25,7 +26,7 @@ const MeterCard = ({ item, onPressEachCard }) => {
<View style={[theme.containerWithPadding, { flex: 2 }]}>
<Text style={[theme.smallTitle]}>{item.name}</Text>
<Text style={[theme.description, theme.mt1]} numberOfLines={2}>
{item.description}
{item.description || 'No description'}
</Text>
</View>
<View style={[theme.rowContainer, { position: 'absolute', top: 10, right: 5 }]}>
......@@ -57,6 +58,15 @@ const styles = StyleSheet.create({
left: 0,
bottom: 0,
width: 10,
borderBottomLeftRadius: 8,
borderTopLeftRadius: 8,
position: 'absolute',
},
meterOnInner: {
top: 0,
left: 10,
bottom: 0,
width: 4,
position: 'absolute',
},
meterImgStyle: {
......
import app, { fireStore } from '../../firebase';
import { fireStore } from '../../firebase';
import AsyncStorage from '@react-native-community/async-storage';
export const GET_CURRENT_USER = 'GET_CURRENT_USER';
export const GET_CURRENT_USER_LOADING = 'GET_CURRENT_USER_LOADING';
export const getCurrentUserAction = (displayName, email, emailVerified, phoneNumber, uid, photoURL) => ({
type: GET_CURRENT_USER,
......@@ -13,6 +14,11 @@ export const getCurrentUserAction = (displayName, email, emailVerified, phoneNum
photoURL,
});
export const getCurrentUserLoadingAction = bool => ({
type: GET_CURRENT_USER_LOADING,
isLoading: bool,
});
export const getCurrentUser = user => async dispatch => {
try {
const appUser = await fireStore
......@@ -22,9 +28,16 @@ export const getCurrentUser = user => async dispatch => {
const appUserData = appUser.data();
const { displayName, email, emailVerified, phoneNumber, photoURL, token } = appUserData;
//firestore > firebase.user
const isEmailVerified = emailVerified ? emailVerified : user.emailVerified;
if (!isEmailVerified) {
const userRef = fireStore.collection('user').doc(user.uid);
await userRef.update({ emailVerified: isEmailVerified });
}
await AsyncStorage.setItem('token', token);
dispatch(getCurrentUserAction(displayName, email, emailVerified, phoneNumber, user.uid, photoURL));
dispatch(getCurrentUserAction(displayName, email, isEmailVerified, phoneNumber, user.uid, photoURL));
} catch (e) {
alert('getCurrentUser error');
console.log(e);
......@@ -33,15 +46,17 @@ export const getCurrentUser = user => async dispatch => {
export const updateUser = userData => async (dispatch, getState) => {
const { currentUserReducer } = getState();
const { email, emailVerified, uid, photoURL } = currentUserReducer;
const { displayName, email, emailVerified, uid, photoURL, phoneNumber } = currentUserReducer;
try {
const newDisplayName = userData.displayName;
const newPhoneNumber = userData.phoneNumber;
const newDisplayName = userData ? userData.displayName : displayName;
const newPhoneNumber = userData ? userData.phoneNumber : phoneNumber;
const userRef = fireStore.collection('user').doc(uid);
await userRef.update({
displayName: newDisplayName,
email,
emailVerified,
phoneNumber: newPhoneNumber,
photoURL,
});
......
......@@ -37,11 +37,6 @@ export const getBreakersStatusAction = breakerStatus => ({
breakerStatus,
});
// export const setDesiredSahdowAction = desiredBreakerStatus => ({
// type: SET_DESIRED_BREAKERS_STATUS_SHADOW,
// desiredBreakerStatus,
// });
export const getCurrentSelectedShadow = deviceId => async (dispatch, getState) => {
const { currentSelectedDeviceReducer } = getState();
const { currentSelectedData } = currentSelectedDeviceReducer;
......@@ -56,12 +51,30 @@ export const getCurrentSelectedShadow = deviceId => async (dispatch, getState) =
// const tempBreakersStatus = _.pick(value, ['CMD_MSG', 'SM1', 'MD_STA', 'ML0', 'ML1', 'ML2', 'ML3', 'ML4']);
const tempBreakersStatus = _.pick(value, ['SM1', 'ML1', 'ML2', 'ML3', 'ML4']);
const breakersStatus = { ...tempBreakersStatus, SM1: { BK_S: tempBreakersStatus.SM1.BK_S } };
// console.log('breakersStatus', breakersStatus);
let shadowTimers = [];
let shadowValue = null;
for (let i = 1; i <= 4; i++) {
for (let j = 1; j <= 8; j++) {
shadowTimers.push(`L${i}B${j}T`);
shadowValue = _.omit(value, [
'CMD_MSG',
'TIME_NOW',
'TIME_ZONE',
'VERSION',
'ML1',
'ML2',
'ML3',
'ML4',
'MAB1T',
...shadowTimers,
]);
}
}
dispatch(getBreakersStatusAction(breakersStatus));
dispatch(getCurrentSelectedShadowAction(value || null));
dispatch(getCurrentSelectedShadowAction(shadowValue || null));
} catch (error) {
dispatch(errorAction(error.message || error || 'Error'));
}
......@@ -70,7 +83,6 @@ export const getCurrentSelectedShadow = deviceId => async (dispatch, getState) =
export const getCurrentSelectedData = (deviceId, showLoading) => async dispatch => {
try {
//FIRESTORE
showLoading && dispatch(loadingAction(true));
const currentSelectedDevice = await fireStore
......@@ -91,8 +103,28 @@ export const getCurrentSelectedData = (deviceId, showLoading) => async dispatch
const tempBreakersStatus = _.pick(value, ['SM1', 'ML1', 'ML2', 'ML3', 'ML4']);
const breakersStatus = { ...tempBreakersStatus, SM1: { BK_S: tempBreakersStatus.SM1.BK_S } };
let shadowTimers = [];
let shadowValue = null;
for (let i = 1; i <= 4; i++) {
for (let j = 1; j <= 8; j++) {
shadowTimers.push(`L${i}B${j}T`);
shadowValue = _.omit(value, [
'CMD_MSG',
'TIME_NOW',
'TIME_ZONE',
'VERSION',
'ML1',
'ML2',
'ML3',
'ML4',
'MAB1T',
...shadowTimers,
]);
}
}
dispatch(getBreakersStatusAction(breakersStatus));
dispatch(getCurrentSelectedShadowAction(value || null));
dispatch(getCurrentSelectedShadowAction(shadowValue || null));
dispatch(getCurrentSelectedDataAction(currentSelectedDeviceDataMoreInfo));
showLoading && dispatch(loadingAction(false));
} catch (error) {
......
import { GET_CURRENT_USER } from '../actions/cerrentUserAction';
import { GET_CURRENT_USER, GET_CURRENT_USER_LOADING } from '../actions/cerrentUserAction';
const initState = {
displayName: '',
......@@ -7,6 +7,7 @@ const initState = {
phoneNumber: '',
uid: '',
photoURL: '',
isLoading: false,
};
const currentUserReducer = (state = initState, action) => {
......@@ -21,6 +22,8 @@ const currentUserReducer = (state = initState, action) => {
uid: action.uid,
photoURL: action.photoURL,
};
case GET_CURRENT_USER_LOADING:
return { ...state, isLoading: action.isLoading };
default:
return state;
}
......
......@@ -97,9 +97,9 @@ class McbLinkScreen extends React.Component {
};
setSubBreakersState = () => {
const { existedSubBreakersData, shadow, existedConnectedDevice } = this.props;
const { existedSubBreakersData, breakerStatus, existedConnectedDevice, shadow } = this.props;
const mcbIndex = this.props.navigation.getParam('mcbIndex');
const status = shadow[`ML${mcbIndex + 1}`];
const status = breakerStatus[`ML${mcbIndex + 1}`];
let subBreakersInfo = [];
......@@ -145,24 +145,6 @@ class McbLinkScreen extends React.Component {
await this.props.setSubBreakerStatus(value, mcbIndex, index);
await this.props.getCurrentSelectedShadow();
this.setState({ isWaiting: false });
// const getShadowInterval = setInterval(async () => {
// this.setState(() => {
// if (this.props.desiredBreakerStatus === this.props.breakerStatus) {
// clearInterval(getShadowInterval);
// return { isWaiting: false };
// } else {
// if (checkedTimes >= 2) {
// clearInterval(getShadowInterval);
// checkedTimes = 0;
// }
// return { isWaiting: false };
// }
// });
// ++checkedTimes;
// await this.props.getCurrentSelectedShadow();
// this.setSubBreakersState();
// }, 3000);
};
const { subBreakerStatus, isWaiting } = this.state;
const subStatus = subBreakerStatus[`L${mcbIndex + 1}B${index + 1}`] === 0 ? false : true;
......@@ -604,8 +586,6 @@ const mapStateToProps = state => ({
existedConnectedDevice: state.timersReducer.existedConnectedDevice,
shadow: state.currentSelectedDeviceReducer.shadow,
breakerStatus: state.currentSelectedDeviceReducer.breakerStatus,
// desiredBreakerStatus: state.currentSelectedDeviceReducer.desiredBreakerStatus,
breakerStatus: state.currentSelectedDeviceReducer.breakerStatus,
});
const mapDispatchToProps = {
......
......@@ -16,15 +16,6 @@ import { isIphoneX } from '../../../utils/isPhoneX';
import { withNavigationFocus } from 'react-navigation';
import _ from 'lodash';
let deviceData = [
{ name: 'AC Volt', limit: 1000, value: 0, unit: 'V' },
{ name: 'AC Current', limit: 1000, value: 0, unit: 'A' },
{ name: 'Watt', limit: 1000, value: 0, unit: 'V' },
{ name: 'Leakage Current', limit: 1000, value: 0, unit: 'mA' },
{ name: 'Units/KWh', limit: 1000, value: 0, unit: '' },
{ name: 'Arcing Fault', limit: 1000, value: 0, unit: '' },
];
class SmartMeterDetailScreen extends Component {
static navigationOptions = ({ navigation }) => {
return {
......@@ -50,6 +41,15 @@ class SmartMeterDetailScreen extends Component {
mcbLinksInfo: [],
subBreakersInfo: [],
isWaiting: false,
deviceData: [
{ name: 'AC Volt', limit: 1000, value: 0, unit: 'V' },
{ name: 'AC Current', limit: 1000, value: 0, unit: 'A' },
{ name: 'Watt', limit: 1000, value: 0, unit: 'V' },
{ name: 'Leakage Current', limit: 1000, value: 0, unit: 'mA' },
{ name: 'Units/KWh', limit: 1000, value: 0, unit: '' },
{ name: 'Arcing Fault', limit: 1000, value: 0, unit: '' },
],
};
_mcbLinksListMounted = false;
......@@ -60,7 +60,7 @@ class SmartMeterDetailScreen extends Component {
await this.props.getCurrentSelectedData(deviceId, true);
await this.props.getTimers();
this.getDataInterval = setInterval(() => this.props.getCurrentSelectedData(deviceId), 5000);
this.getDataInterval = setInterval(() => this.props.getCurrentSelectedData(deviceId), 6000);
};
componentDidMount = async () => {
......@@ -91,12 +91,26 @@ class SmartMeterDetailScreen extends Component {
clearInterval(this.getDataInterval);
}
}
if (prevProps.shadow !== this.props.shadow) {
this.setState({
deviceData: [
{ name: 'AC Volt', limit: 1000, value: this.props.shadow.SM1.VOLT, unit: 'V' },
{ name: 'AC Current', limit: 1000, value: this.props.shadow.SM1.AMP, unit: 'A' },
{ name: 'Watt', limit: 1000, value: this.props.shadow.SM1.WATT, unit: 'V' },
{ name: 'Leakage Current', limit: 1000, value: this.props.shadow.SM1.LEAK, unit: 'mA' },
{ name: 'Units/KWh', limit: 1000, value: this.props.shadow.SM1.UNIT, unit: '' },
{ name: 'untitled', limit: 1000, value: 0, unit: '' },
],
});
}
};
handleToggle = async value => {
clearInterval(this.getDataInterval);
this.setState({ isWaiting: true });
await this.props.setMainStatus(value);
this.setState({ isWaiting: false });
this.getDataInterval = setInterval(() => this.props.getCurrentSelectedData(deviceId), 6000);
};
componentWillUnmount = () => {
......@@ -166,7 +180,7 @@ class SmartMeterDetailScreen extends Component {
</Right>
</Row>
<Text numberOfLines={2} style={[theme.description, theme.mt1, { fontSize: 14 }]}>
{description || ''}
{description || 'No description'}
</Text>
<Row style={theme.mt1}>
<Text style={[theme.description, theme.textDark, { marginRight: 5 }]}>
......@@ -235,9 +249,11 @@ class SmartMeterDetailScreen extends Component {
const renderSubBreaker = (subBreaker, indexSubBreakers) => {
const handleOnPressSubBreakerSwitch = async value => {
clearInterval(this.getDataInterval);
this.setState({ isWaiting: true });
await this.props.setSubBreakerStatus(value, indexMcbLinks, indexSubBreakers);
this.setState({ isWaiting: false });
this.getDataInterval = setInterval(() => this.props.getCurrentSelectedData(deviceId), 6000);
};
return (
......@@ -344,7 +360,7 @@ class SmartMeterDetailScreen extends Component {
{(this._mcbLinksListMounted || !isLoadingValues) && this.renderMainDatailsCard()}
{(this._mcbLinksListMounted || !isLoadingValues) && (
<FlatList
data={deviceData}
data={this.state.deviceData}
renderItem={({ item, index }) => this.renderCards(item, index)}
contentContainerStyle={{ overflow: 'hidden' }}
numColumns={3}
......@@ -379,10 +395,9 @@ const mapStateToProps = state => ({
error: state.timersReducer.error,
existedMcbLinksData: state.timersReducer.existedMcbLinksData,
existedSubBreakersData: state.timersReducer.existedSubBreakersData,
// shadow: state.currentSelectedDeviceReducer.shadow,
shadow: state.currentSelectedDeviceReducer.shadow,
breakerStatus: state.currentSelectedDeviceReducer.breakerStatus,
// desiredBreakerStatus: state.currentSelectedDeviceReducer.desiredBreakerStatus,
});
const mapDispatchToProps = {
......
......@@ -86,7 +86,8 @@ class SmartMeterScreen extends PureComponent {
// !error ? (
return (
<View style={[theme.container, theme.containerWithPadding]}>
<View style={[theme.container]}>
<View style={theme.containerWithPadding}>
<Text style={[theme.smallTitle, theme.textDark, { marginBottom: 10 }]}>Smart Device</Text>
<SearchBar
......@@ -98,6 +99,7 @@ class SmartMeterScreen extends PureComponent {
onChangeText={text => this.updateSearch(text)}
value={this.state.search}
/>
</View>
<FlatList
refreshControl={
......@@ -110,7 +112,11 @@ class SmartMeterScreen extends PureComponent {
colors={[color.primary]}
/>
}
contentContainerStyle={{ paddingBottom: isIphoneX() ? 90 : 55 }} //iPhoneX BottomSpace = 34
contentContainerStyle={{
paddingBottom: isIphoneX() ? 90 : 55,
paddingHorizontal: 15,
paddingTop: 5,
}} //iPhoneX BottomSpace = 34
data={data}
extraData={this.props || this.state}
keyExtractor={(item, index) => item.deviceId}
......
......@@ -216,15 +216,11 @@ class TimerScreen extends PureComponent {
if (selectedBreaker === 'main') {
const isSuccess = await this.props.createNewTimer(null, null, timerData);
if (isSuccess) {
this.resetStateAndProps();
}
isSuccess && this.resetStateAndProps();
} else if (selectedBreaker && selectedSubBreaker) {
const isSuccess = await this.props.createNewTimer(selectedBreaker, selectedSubBreaker[0].id, timerData);
if (isSuccess) {
this.resetStateAndProps();
}
isSuccess && this.resetStateAndProps();
} else alert('please select (Sub) Breaker');
}
//Edit MODE
......@@ -276,8 +272,6 @@ class TimerScreen extends PureComponent {
repeatOn: this.props.selectedTimerData.repeatOn,
});
}
// console.log(this.state);
};
componentDidMount = () => {
......@@ -625,7 +619,7 @@ class TimerScreen extends PureComponent {
refreshControl={
<RefreshControl
refreshing={this.props.isLoading}
onRefresh={async () => await this.props.getTimers()}
onRefresh={this.props.getTimers}
title="Pull to refresh"
tintColor={color.primary}
titleColor={color.darkGrey}
......@@ -636,14 +630,8 @@ class TimerScreen extends PureComponent {
data={this.state.timersData}
extraData={this.state || this.props}
ListEmptyComponent={() => (
<View>
<Text
style={[
theme.modalText,
theme.mt2,
{ flex: 1, justifyContent: 'center', alignItems: 'center', paddingHorizontal: 30 },
]}
>
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'center' }}>
<Text style={[theme.modalText, theme.mt2, { paddingHorizontal: 30 }]}>
{this._isMounted ? 'No timers' : ''}
</Text>
</View>
......@@ -656,7 +644,6 @@ class TimerScreen extends PureComponent {
/>
{/* Create & Update Timer Modal */}
<Modal
coverScreen
swipeArea={45}
......@@ -691,10 +678,7 @@ class TimerScreen extends PureComponent {
style={[styles.filterModal]}
position={'bottom'}
isOpen={this.state.isFilterVisible}
onClosed={() => {
// this.resetStateAndProps();
this.props.setEditModalVisible(false);
}}
onClosed={() => this.props.setEditModalVisible(false)}
>
{this.renderFilterModal()}
</Modal>
......
......@@ -6,7 +6,7 @@ import { width } from '../../constants/Layout';
import app from '../../firebase';
import { connect } from 'react-redux';
import { getCurrentUser } from '../../reduxStore/actions/cerrentUserAction';
import { fireStore } from '../../firebase';
// import { fireStore } from '../../firebase';
class AuthLoadingScreen extends Component {
static navigationOptions = {
......@@ -22,11 +22,7 @@ class AuthLoadingScreen extends Component {
_isMounted = false;
showLogoThenIndicator = () => {
setTimeout(() => {
if (this._isMounted) {
this.setState({ isShowImg: false });
}
}, 900); // 1200
setTimeout(() => this._isMounted && this.setState({ isShowImg: false }), 1200); // 1200
};
bootstrapAsync = async () => {
......@@ -41,7 +37,7 @@ class AuthLoadingScreen extends Component {
app.auth().onAuthStateChanged(async user => {
if (user) {
await this.props.getCurrentUser(user);
this.props.navigation.navigate('Main');
await this.props.navigation.navigate('Main');
}
});
} else {
......@@ -86,105 +82,3 @@ export default connect(
null,
mapDispatchToProps
)(AuthLoadingScreen);
// const createMockData = () => {
// console.log('writting data');
// // const deviceId = 'iYs6Th9Pkg1vTEDIyPa5';
// // const deviceId = '8998c7d5-4476-41d9-81c6-9ef2dbac2505';
// const deviceId = '267a494c-a6b6-4b74-a952-82ba8d5db783';
// const batch = fireStore.batch();
// /*------------------------------*/
// const mainRef = fireStore.doc(`device/${deviceId}`);
// batch.set(mainRef, main);
// // for (let i = 1; i <= 2; i++) {
// // let mainTimerRef = fireStore
// // .collection('device')
// // .doc(deviceId)
// // .collection('Timers')
// // .doc();
// // batch.set(mainTimerRef, timer);
// // }
// /*------------------------------*/
// for (let i = 1; i <= 4; i++) {
// const mcbLinks = {
// type: 'mcbLink',
// name: `MCB Link ${i}`,
// description: `description ${i}`,
// };
// let mcbLinksRef = fireStore
// .collection('device')
// .doc(deviceId)
// .collection('mcbLinks')
// .doc(i.toString());
// batch.set(mcbLinksRef, mcbLinks);
// }
// /*------------------------------*/
// for (let i = 1; i <= 4; i++) {
// for (let j = 1; j <= 8; j++) {
// let subBreakers = {
// type: 'subBreaker',
// name: `Sub Breaker ${j}`,
// description: `description ${j}`,
// };
// let subBreakersRef = fireStore
// .collection('device')
// .doc(deviceId)
// .collection('mcbLinks')
// .doc(i.toString())
// .collection('subBreakers')
// .doc(j.toString());
// // for (let z = 1; z <= 1; z++) {
// // let subBreakerTimerRef = fireStore
// // .collection('device')
// // .doc(deviceId)
// // .collection('mcbLinks')
// // .doc(i.toString())
// // .collection('subBreakers')
// // .doc(j.toString())
// // .collection('Timers')
// // .doc();
// // batch.set(subBreakerTimerRef, timer);
// // }
// batch.set(subBreakersRef, subBreakers);
// }
// }
// batch.commit();
// };
// const main = {
// type: 'main',
// name: 'Main',
// description: 'description',
// notification: true,
// rcbo: 10,
// };
// const initTime = new Date();
// initTime.setFullYear(2019);
// initTime.setMonth(0);
// initTime.setDate(0);
// initTime.setSeconds(0);
// const timer = {
// isActive: false,
// isPowerOn: false,
// timer: 0,
// repeatOn: [
// { id: 0, isRepeat: false, day: 'Sunday' },
// { id: 1, isRepeat: false, day: 'Monday' },
// { id: 2, isRepeat: false, day: 'Tuesday' },
// { id: 3, isRepeat: false, day: 'Wednesday' },
// { id: 4, isRepeat: false, day: 'Thursday' },
// { id: 5, isRepeat: false, day: 'Friday' },
// { id: 6, isRepeat: false, day: 'Saturday' },
// ],
// };
......@@ -5,7 +5,7 @@ import AsyncStorage from '@react-native-community/async-storage';
import LoginForm from '../../components/Form/LoginForm';
import { KeyboardAvoidingView, View } from 'react-native';
import app from '../../firebase';
import { getCurrentUser } from '../../reduxStore/actions/cerrentUserAction';
import { getCurrentUser, getCurrentUserLoadingAction } from '../../reduxStore/actions/cerrentUserAction';
import { connect } from 'react-redux';
class LoginScreen extends Component {
......@@ -20,16 +20,21 @@ class LoginScreen extends Component {
};
handleSignIn = async values => {
this.props.getCurrentUserLoadingAction(true);
const { email, password } = values;
try {
const userCredential = await app.auth().signInWithEmailAndPassword(email, password);
if (userCredential) {
await this.props.getCurrentUser(userCredential.user);
if (this.props.emailVerified && this.props.emailVerified === true) {
await AsyncStorage.setItem('alreadyLaunched', 'true');
if (this.state.isCheck === true) {
await AsyncStorage.setItem('RememberedLogin', 'true');
}
this.props.navigation.navigate('Main');
} else {
alert('Please verify your email first!');
}
}
} catch (error) {
const errorCode = error.code;
......@@ -41,8 +46,12 @@ class LoginScreen extends Component {
} else {
alert(errorMessage);
}
console.log(error);
}
this.props.getCurrentUserLoadingAction(false);
};
componentDidUpdate = () => {
console.log(this.props.emailVerified);
};
render() {
......@@ -50,7 +59,7 @@ class LoginScreen extends Component {
return (
<KeyboardAvoidingView style={theme.introContainer}>
<Text style={[theme.title, theme.textDark]}>Login</Text>
<LoginForm onSubmit={this.handleSignIn}>
<LoginForm onSubmit={this.handleSignIn} loading={this.props.isLoading}>
<View style={[theme.rowContainer, theme.mt1, { justifyContent: 'space-between' }]}>
<View style={[theme.rowContainer]}>
<Icon
......@@ -82,9 +91,15 @@ class LoginScreen extends Component {
const mapDispatchToProps = {
getCurrentUser,
getCurrentUserLoadingAction,
};
const mapStateTOProps = state => ({
emailVerified: state.currentUserReducer.emailVerified,
isLoading: state.currentUserReducer.isLoading,
});
export default connect(
null,
mapStateTOProps,
mapDispatchToProps
)(LoginScreen);
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