액션 레퍼런스
지원 액션 목록
| 액션 | 값 | 설명 |
|---|---|---|
CAMERA_CAPTURE | "CAMERA_CAPTURE" | 카메라 촬영 |
GPS_GET | "GPS_GET" | GPS 위치 조회 |
FILE_SELECT | "FILE_SELECT" | 파일 선택 |
FILE_SAVE | "FILE_SAVE" | 파일 저장 |
NFC_WRITE | "NFC_WRITE" | NFC 쓰기 |
NFC_READ | "NFC_READ" | NFC 읽기 |
QR_SCAN | "QR_SCAN" | QR 코드 스캔 |
NAVIGATION_POP | "NAVIGATION_POP" | 네이티브 뒤로가기 |
HAPTIC | "HAPTIC" | 햅틱 피드백 |
액션별 사용 예시
GPS 조회
tsx
const { send } = useBridgeProvider();useBridgeResponse(Actions.GPS_GET, async (data) => {const { coords } = data as GPSGetResponse;console.log(coords.latitude, coords.longitude);return {};});send(Actions.GPS_GET, { accuracy: "high" });// accuracy: "low" | "balanced" | "high"
햅틱 피드백
ts
const { send } = useBridgeProvider();send(Actions.HAPTIC, { style: "success" }); // 성공send(Actions.HAPTIC, { style: "warning" }); // 경고send(Actions.HAPTIC, { style: "error" }); // 오류send(Actions.HAPTIC, { style: "light" }); // 약한 충격send(Actions.HAPTIC, { style: "heavy" }); // 강한 충격send(Actions.HAPTIC, { style: "selection" }); // 선택
뒤로가기 (네이티브 스택 pop)
ts
const { send } = useBridgeProvider();// 네이티브 앱의 WebView 스택을 닫습니다send(Actions.NAVIGATION_POP);
QR 스캔
tsx
useBridgeResponse(Actions.QR_SCAN, async (data) => {const { text } = data as { text: string };handleQrResult(text);return {};});send(Actions.QR_SCAN);
타입 레퍼런스
GPS 타입
ts
// GPS_GET 요청 payloadinterface GPSGetRequest {accuracy?: "low" | "balanced" | "high";}// GPS_GET 응답 datainterface GPSGetResponse {coords: GPSCoordinates;timestamp: number;}interface GPSCoordinates {latitude: number;longitude: number;altitude: number | null;accuracy: number | null;altitudeAccuracy: number | null;heading: number | null;speed: number | null;}
햅틱 타입
ts
type ImpactFeedbackStyle = "light" | "medium" | "heavy" | "soft" | "rigid";type NotificationFeedbackType = "success" | "warning" | "error";type HapticStyle = ImpactFeedbackStyle | NotificationFeedbackType | "selection";// HAPTIC 요청 payloadinterface HapticRequest {style: HapticStyle;}
에러 타입
ts
type BridgeError =| "TIMEOUT"| "PERMISSION_DENIED"| "NOT_SUPPORTED"| "CANCELLED"| "UNKNOWN";