강의

멘토링

로드맵

인프런 커뮤니티 질문&답변

harati님의 프로필 이미지
harati

작성한 질문수

iOS/Android 앱 개발을 위한 실전 React Native - Basic

연락처에 접근하기

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

작성

·

632

0

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

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

퀴즈

Native React Native 라이브러리를 설치한 후, `npm install` 또는 `yarn add` 외에 플랫폼별로 추가 설정 단계를 거치는 주된 이유는 무엇일까요?

라이브러리의 최신 버전 호환성 확인

네이티브 코드와 연결 및 기기 자원 접근 권한 설정

애플리케이션의 사용자 인터페이스 디자인 변경

개발 서버와의 통신 속도 최적화

답변 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님의 프로필 이미지
harati

작성한 질문수

질문하기