강의

멘토링

커뮤니티

Inflearn Community Q&A

harati's profile image
harati

asked

Practical React Native for iOS/Android App Development - Basic

Accessing Contacts

react-native-contacts 6버전에서 바꿔줘야합니다.

Written on

·

611

0

최신버전에서는 아래와 같이 바꿔줘야합니다.

//contacts 6버전대
      Contacts.getAll()
    .then((contacts=> {
      // work with contacts
    })
    .catch((e=> { //handle error 
   })

reactreact-nativees6

Answer 2

0

참고해주세요
const getContacts = () => {
    requestContactPermission().then((didGetPermission=> {
      if (didGetPermission) {
        Contacts.getAll()
          .then((contacts=> {
            // console.warn(contacts);
            setMyContacts(contacts);
          })
          .catch((err=> {
            console.error(err);
            throw err;
          });
      } else {
        alert('no permission');
      }
    });
 };

0

최신버전으로 수정하신 코드를 공유해 주실 수 있으신가요??..ㅠ

harati's profile image
harati

asked

Ask a question