handleClick = function() {
this.setState(function (state) {
return {
isActive: !state.isActive
};
});
};
this.handleClick=this.handleClick.bind()
_getPostcards () {
try {
this.setState({isFecth:true})
const url = domain + '?app_id='+ app_id +'&category='+ category +'&page=' + this.state.page
return fetch(url)
.then((response) => response.json())
.then((responseJson) => {
console.log(responseJson)
this.setState({ data: responseJson.photos, pageMax: responseJson.pages })
this.setState({isFecth:false}) //<--------
})
.catch((error) =>{
console.error(error);
this.setState({isFecth:false}) //<--------
});
} catch (e) {
throw e
this.setState({isFecth:false}) //<--------
}
}
const HomeDetails = createStackNavigator(
{
Home: {
screen: HomeScreen,
navigationOptions: {
hideStatusBar: true,
header: null,
}
},
Details: {
screen: DetailsScreen,
navigationOptions: {
hideStatusBar: true,
header: null,
}
}
},
{
initialRouteName: "Home"
}
);
const DrawerNavigator = createDrawerNavigator(
{
Home: {
screen: HomeDetails,
navigationOptions: {
hideStatusBar: true,
header: null,
}
},
Categoryes: {
screen: CategoryesScreen,
navigationOptions: {
hideStatusBar: true,
header: null,
}
}
},
{
hideStatusBar: true,
drawerBackgroundColor: 'rgba(255,255,255,.9)',
overlayColor: '#6b52ae',
contentOptions: {
activeTintColor: '#fff',
activeBackgroundColor: '#6b52ae',
},
}
);
{this.state.isFetch&&<View style={navigationPostcards}>
<TouchableOpacity onPress={this._backwardPostcards} style={arrowContainer}>
<Image source={require('./src/components/uikit/images/arrowBack.png')} style={arrow} />
</TouchableOpacity>
<TouchableOpacity onPress={this._nextPostcards} style={arrowContainer}>
<Image source={require('./src/components/uikit/images/arrowNext.png')} style={arrow} />
</TouchableOpacity>
<View style={pagesCountContainer}>
<Image source={require('./src/components/uikit/images/pagesCountIcon.png')} style={pagesCountIcon} /><Text style={pageCountInfo}>{page + ' / ' + pageMax}</Text>
</View>
</View>}
_getPostcards () {
try {
this.setState({isFecth:true})
const url = domain + '?app_id='+ app_id +'&category='+ category +'&page=' + this.state.page
return fetch(url)
.then((response) => response.json())
.then((responseJson) => {
console.log(responseJson)
this.setState({ data: responseJson.photos, pageMax: responseJson.pages })
this.setState({isFecth:false}) //<--------
})
.catch((error) =>{
console.error(error);
this.setState({isFecth:false}) //<--------
});
} catch (e) {
throw e
this.setState({isFecth:false}) //<--------
}
}
Import your .svg file inside a React component:
import Logo from "./logo.svg";
mAuth.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "createUserWithEmail:success");
FirebaseUser user = mAuth.getCurrentUser();
updateUI(user);
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "createUserWithEmail:failure", task.getException());
Toast.makeText(EmailPasswordActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
updateUI(null);
}
// ...
}
});
export function registerUserWithEmailAndPassword(nickname, email, password) {
return (dispatch) => {
firebase.auth()
.createUserWithEmailAndPassword(email, password)
.then((user) => {
//вот тут вы получаете юзера данные которые нужно сохранить
firebase.database()
.ref('usersChat/' + user._user.uid)
.set({
nickname: nickname,
uid: user._user.uid,
timestamp: Date.now(),
email: email
})
return user
})
.catch((error) => {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
dispatch({
type: types.userRegisterErr,
payload: errorMessage
});
});
}
}