Skip to main content

공유

예제

참조

메서드

share()

tsx
static share(content: ShareContent, options?: ShareOptions);

텍스트 콘텐츠를 공유하기 위한 대화상자를 연다.

iOS에서는 Promise를 반환하며, 이 Promise는 actionactivityType을 포함한 객체와 함께 호출된다. 사용자가 대화상자를 닫더라도 Promise는 여전히 해결되며, 이때 actionShare.dismissedAction이 되고 나머지 키는 정의되지 않는다. 일부 공유 옵션은 iOS 시뮬레이터에서 표시되지 않거나 작동하지 않을 수 있다.

Android에서는 항상 actionShare.sharedAction인 상태로 Promise가 해결된다.

속성:

이름타입설명
content
필수
objectmessage - 공유할 메시지
url - 공유할 URL
iOS

title - 메시지의 제목
Android

urlmessage 중 적어도 하나는 필수이다.
optionsobjectdialogTitle
Android

excludedActivityTypes
iOS

subject - 이메일을 통해 공유할 제목
iOS

tintColor
iOS

anchor - 액션 시트가 고정될 노드 (iPad에서 사용)
iOS

속성

sharedAction

tsx
static sharedAction: 'sharedAction';

콘텐츠가 성공적으로 공유되었다.

dismissedAction
iOS

tsx
static dismissedAction: 'dismissedAction';

다이얼로그가 닫혔음을 나타낸다.