We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to edit some details of my contact like givenName, familyName etc. So how can I do it? This is my code so far -
const EditContactScreen = ({ route, navigation }) => { const { data } = route.params; const [firstName, setFirstName] = useState(data.givenName); const [lastName, setLastName] = useState(data.familyName); const [number, setNumber] = useState(data.phoneNumbers[0].number); const [email, setEmail] = useState(''); const [contactId, setContactId] = useState(''); const editContact = () => { PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_CONTACTS, { title: 'Contacts', message: 'This app would like to view your contacts.', buttonPositive: 'Please accept bare mortal', }) .then((res) => { console.log('Permission: ', res); if (res === 'granted') { let updatedContact = { recordID: data.recordID, emailAddresses: [{ label: 'work', email: email, }], phoneNumbers: [{ label: 'mobile', number: number, }], familyName: lastName, givenName: firstName, }; Contacts.updateContact(updatedContact).then(() => { console.log('Contact updated successfully'); navigation.goBack(); }).catch(error => { console.log('Error updating contact:', error); }); } }) .catch((error) => { console.error('Permission error: ', error); }); }; const onSubmit = () => { editContact(); }; return ( <View style={styles.container}> <TextInput defaultValue={firstName} onChangeText={text => setFirstName(text)} /> <TextInput defaultValue={lastName} onChangeText={text => setLastName(text)} /> <TextInput defaultValue={number} onChangeText={text => setNumber(text)} /> <TouchableHighlight style={[styles.button]} onPress={onSubmit} > <Text style={styles.btnText}>Save Contact</Text> </TouchableHighlight> </View> ); };
on calling editContact () it is giving me error as [Error: Invalid recordId or rawContactId] so what should I do?
[Error: Invalid recordId or rawContactId]
The text was updated successfully, but these errors were encountered:
what's in recordID: data.recordID? are you passing a recordID inside route.params?
recordID: data.recordID
recordID
route.params
Sorry, something went wrong.
No branches or pull requests
I want to edit some details of my contact like givenName, familyName etc. So how can I do it? This is my code so far -
on calling editContact () it is giving me error as
[Error: Invalid recordId or rawContactId]
so what should I do?The text was updated successfully, but these errors were encountered: