halilb / rn-credit-card Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
I would like to thank you for working on this productive library!
I have faced an issue while using it though that I would like you to look into and give it a fix:
CURRENT BEHAVIOR
I have the following translation object passed to the credit card form component:
<CreditCardForm
LottieView={LottieView}
horizontalStart
overrides={{
labelText: {
marginTop: 16
}
}}
translations={{
cardNumber: 'Numéro de Carte',
cardHolderName: 'Titulaire de Carte',
nameSurname: 'Nom et Prénom',
mmYY: 'MM/AA',
expiration: 'Expiration',
securityCode: 'Code de Sécurité',
next: 'Suivant',
done: 'Terminer',
cardNumberRequired: 'Numéro de Carte est obligatoire.',
cardNumberInvalid: 'Ce numéro de carte est invalide.',
cardHolderNameRequired: 'Nom de titulaire de la carte est obligatoire.',
cardHolderNameInvalid: 'Ce nom de titulaire de la carte est invalide.',
expirationRequired: "Date d'Expiration est obligatoire",
expirationInvalid: "Cette date d'expiration est invalide.",
securityCodeRequired: 'Code de Sécurité est obligatoire.',
securityCodeInvalid: 'Ce code de Sécurité est invalide.'
}}
/>
Every field gets translated as expected except the cardHolderNameRequired which displays the cardNumberRequired instead of its own value.
So, I attempt to skip the card number, they tell me that the card number is required. And I provide it, but when I reach the cardholder's name and attempt the skip, they tell me that the cardholder number is required instead of telling me that the cardholder's name is required. That affects the user experience because it confuses the user.
EXPECTED BEHAVIOR
The right corresponding validation message of the cardholder's name should be displayed instead of the incorrect one.
Please how do I extend the card number limit from 16 to say 19 ? I have a verve card of 19 digits and I was surprised I could not use it on the package.
Thank you for your help.
when use Example in doc Return this error Watch is not a function
Unable to resolve "AccessibilityInfo" from "node_modules\rn-credit-card\node_modules\react-native\Libraries\react-native\react-native-implementation.js"
How can I remove the card holder name field. I suggest it should be made optional, to be displayed or not
Very cool
It would be nice if you could include other necessary fields (identity of the cardholder and birthday)
I'm trying to use your example on .js
I removed references to FormModel, and I get this error TypeError: undefined is not an object
(evaluating 'errors[name]')
Here is my code after removing FormModel
import { FormProvider, useForm } from 'react-hook-form'
import {
Alert,
StyleSheet,
KeyboardAvoidingView,
Platform,
SafeAreaView,
} from 'react-native'
import LottieView from 'lottie-react-native'
import CreditCardForm, { Button, FormModel } from 'rn-credit-card'
const App = () => {
const formMethods = useForm ({
// to trigger the validation on the blur event
mode: 'onBlur',
defaultValues: {
holderName: '',
cardNumber: '',
expiration: '',
cvv: '',
},
})
const { handleSubmit, formState } = formMethods
function onSubmit(model) {
Alert.alert('Success: ' + JSON.stringify(model, null, 2))
}
return (
<FormProvider {...formMethods}>
<SafeAreaView style={styles.container}>
<KeyboardAvoidingView
style={styles.avoider}
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
>
<CreditCardForm
LottieView={LottieView}
horizontalStart
overrides={{
labelText: {
marginTop: 16,
},
}}
/>
</KeyboardAvoidingView>
{formState.isValid && (
<Button
style={styles.button}
title={'CONFIRM PAYMENT'}
onPress={handleSubmit(onSubmit)}
/>
)}
</SafeAreaView>
</FormProvider>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
avoider: {
flex: 1,
padding: 36,
},
button: {
margin: 36,
marginTop: 0,
},
})
export default App
Hi,
This is a lovely repo. Thanks for this!
My project requires me to show all the input fields together (instead of one sliding in after the other) . Is that possible ( Im sure it is, just cant figure out how!) ?
Thanks!
Useless Library
Hello,
I noticed in the documentation that there should be a prop "requiresName" to exclude the card holder name input, but setting it to false doesn't seem to make any difference. The card holder name is always displayed...
Example:
<CreditCardForm LottieView={LottieView} horizontalStart requiresName={false} />
Also typescript complains that the property "requiresName" does not exist on CreditCardForm:
Any fix or workaround to make this work as expected?
Kind regards,
Tim
Hello, very good.
Would it be possible to not display the card, only the input fields?
Hi, thank for good work.
I want to create back button like next button on the card form. Because some times we need to go back for edit.
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.