maicongilton / react-native-customisable-alert Goto Github PK
View Code? Open in Web Editor NEWA customisable alert for React Native
License: MIT License
A customisable alert for React Native
License: MIT License
I need to create a window with a one call place, so custom alerts don't work for me.
I tried to implement the window call using this method:
export async function openModal(title: string, text: string, cancelText: string, continueText: string): Promise<boolean> {
return new Promise((resolve) => {
showAlert({
customIcon: 'none',
dismissable: true,
title: title,
message: text,
leftBtnLabel: cancelText,
btnLabel: continueText,
alertType: 'warning',
onPress: () => {
closeAlert();
resolve(true);
},
onDismiss: () => {
closeAlert();
resolve(false);
},
})
});
}
And I'm using CustomizableAlert with modified styles, but I can't change buttons style in any way.
<CustomisableAlert
titleStyle={{
fontSize: 18,
fontWeight: 'bold',
color: 'white',
textAlign: 'left',
}}
textStyle={{
color: 'white',
textAlign: 'left',
paddingTop: 16,
}}
alertContainerStyle={{
backgroundColor: '#2B2930',
padding: 24,
borderRadius: 28,
}}
btnLabelStyle={{
color: 'white',
}}
btnStyle={{
style: {
backgroundColor: 'transparent',
margin: 0,
padding: 0,
}
}}
/>```
given this style:
containerStyle: {
backgroundColor: "red"
}
the backdrop color of the modal turns red instead of the alert box color.
Use case : In a component screen we have multiple modals implemented these have forms ,we tried to "showAlert" but is hiding behind the other modals.
const loggedOut = async () => {
// setModalVisible(!modalVisible);
AsyncStorage.removeItem('userID');
AsyncStorage.removeItem('profileCompletedStep');
AsyncStorage.removeItem('first_welcome');
AsyncStorage.removeItem('isUserMobileNumberVerified');
navigation.reset({
index: 0,
routes: [{name: 'LoginStack'}],
});
};
how can i remove tittle from alert
like this but it display "Title"
///
showAlert({
visible: true,
title: '',
message: translate('customAlert.lbl_are_you_sure'),
alertType: 'warning',
onPress: () => {
BackHandler.exitApp(), setAlertVisible(false);
closeAlert();
},
onDismiss: () => {
closeAlert();
setAlertVisible(false);
},
btnLabel: translate('customAlert.btn_Exit'),
leftBtnLabel: translate('customAlert.btn_Dismiss'),
});
After exiting the alert, the alert is displayed again for a short while, possibly the App.jsx is rendered alert again for a short time. Is there a way to solve this problem?
I need to show at least 3 modals on same screen. Can I define a rendering priority to the modals and have them one by one on the screen ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.