콘텐츠로 이동

엑스포 Cheatsheet

Expo - React Native Apps

를 구축하는 가장 빠른 방법

Expo는 Android, iOS 및 JavaScript 및 React로 웹을 위한 범용 네이티브 앱 제작을위한 오픈 소스 플랫폼입니다. React Native와 Native 플랫폼에 내장된 도구와 서비스를 제공합니다.

본문 바로가기

설치하기

자주 묻는 질문

카지노사이트

Expo CLI 설치

카지노사이트

Expo Go 앱

카지노사이트

시작하기

새 프로젝트 만들기

카지노사이트

프로젝트 템플릿

카지노사이트

프로젝트 구조

기본 구조

카지노사이트

App.js 예제

카지노사이트

앱.json 제품 설명

카지노사이트

엑스포 CLI

개발 명령

카지노사이트

프로젝트 관리

카지노사이트

명령을 빌드

ο 회원 관리

개발 Workflow

장치에서 실행

카지노사이트

핫 리로드

카지노사이트

관련 링크

카지노사이트

핵심 부품

기본 부품

카지노사이트

목록 및 자료

카지노사이트

- 연혁

React 설정

카지노사이트

스택 탐색기

카지노사이트

탭 탐색기

카지노사이트

국가 관리

React 훅

오프화이트

Redux 설정

카지노사이트

오프화이트

사이트맵

스타일시트

카지노사이트

책임감 있는 디자인

카지노사이트

Styled 구성 요소 (Alternative)

카지노사이트

카지노사이트

API 및 서비스

엑스포 API

카지노사이트

HTTP 요청

카지노사이트

푸시 알림

설치하기

```bash

Install Expo Notifications

expo install expo-notifications

For bare workflow, additional setup required

See: https://docs.expo.dev/push-notifications/overview/

```의 경우

기본 알림

```javascript import * as Notifications from 'expo-notifications'; import * as Device from 'expo-device'; import { Platform } from 'react-native';

// Configure notifications Notifications.setNotificationHandler({ handleNotification: async () => ({ shouldShowAlert: true, shouldPlaySound: false, shouldSetBadge: false, }), });

const NotificationExample = () => { const [expoPushToken, setExpoPushToken] = useState(''); const [notification, setNotification] = useState(false);

useEffect(() => { registerForPushNotificationsAsync().then(token => setExpoPushToken(token));

const notificationListener = Notifications.addNotificationReceivedListener(notification => {
  setNotification(notification);
});

const responseListener = Notifications.addNotificationResponseReceivedListener(response => {
  console.log(response);
});

return () => {
  Notifications.removeNotificationSubscription(notificationListener);
  Notifications.removeNotificationSubscription(responseListener);
};

}, []);

const schedulePushNotification = async () => { await Notifications.scheduleNotificationAsync({ content: { title: "You've got mail! 📬", body: 'Here is the notification body', data: { data: 'goes here' }, }, trigger: { seconds: 2 }, }); };

const sendPushNotification = async (expoPushToken) => { const message = { to: expoPushToken, sound: 'default', title: 'Original Title', body: 'And here is the body!', data: { someData: 'goes here' }, };

await fetch('https://exp.host/--/api/v2/push/send', {
  method: 'POST',
  headers: {
    Accept: 'application/json',
    'Accept-encoding': 'gzip, deflate',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(message),
});

};

return ( Your expo push token: {expoPushToken}