엑스포 Cheatsheet¶
Expo - React Native Apps
를 구축하는 가장 빠른 방법Expo는 Android, iOS 및 JavaScript 및 React로 웹을 위한 범용 네이티브 앱 제작을위한 오픈 소스 플랫폼입니다. React Native와 Native 플랫폼에 내장된 도구와 서비스를 제공합니다.
본문 바로가기¶
- 설치
- 시작
- 프로젝트 구조
- Expo CLI
- 개발사업
- 핵심 부품
- 네비게이션
- 전략
- 문의
- API 및 서비스
- 봉사
- 파일 시스템
- 카메라와 미디어
- 위치 서비스
- 인증
- 건축 및 출판
- EAS (Expo Application Services)
- 모범 사례
설치하기¶
자주 묻는 질문¶
카지노사이트
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 (
async function registerForPushNotificationsAsync() { let token; if (Device.isDevice) { const { status: existingStatus } = await Notifications.getPermissionsAsync(); let finalStatus = existingStatus; if (existingStatus !== 'granted') { const { status } = await Notifications.requestPermissionsAsync(); finalStatus = status; } if (finalStatus !== 'granted') { alert('Failed to get push token for push notification!'); return; } token = (await Notifications.getExpoPushTokenAsync()).data; } else { alert('Must use physical device for Push Notifications'); }
if (Platform.OS === 'android') { Notifications.setNotificationChannelAsync('default', { name: 'default', importance: Notifications.AndroidImportance.MAX, vibrationPattern: [0, 250, 250, 250], lightColor: '#FF231F7C', }); }
return token; } ```에 대하여
파일 시스템¶
파일 작업¶
```bash
Install FileSystem¶
expo install expo-file-system ```의 경우
```javascript import * as FileSystem from 'expo-file-system';
const FileSystemExample = () => { const [fileContent, setFileContent] = useState('');
const writeFile = async () => { const fileUri = FileSystem.documentDirectory + 'test.txt'; const content = 'Hello, Expo FileSystem!';
try {
await FileSystem.writeAsStringAsync(fileUri, content);
alert('File written successfully!');
} catch (error) {
console.error('Error writing file:', error);
}
};
const readFile = async () => { const fileUri = FileSystem.documentDirectory + 'test.txt';
try {
const content = await FileSystem.readAsStringAsync(fileUri);
setFileContent(content);
} catch (error) {
console.error('Error reading file:', error);
}
};
const deleteFile = async () => { const fileUri = FileSystem.documentDirectory + 'test.txt';
try {
await FileSystem.deleteAsync(fileUri);
alert('File deleted successfully!');
setFileContent('');
} catch (error) {
console.error('Error deleting file:', error);
}
};
const getFileInfo = async () => { const fileUri = FileSystem.documentDirectory + 'test.txt';
try {
const info = await FileSystem.getInfoAsync(fileUri);
console.log('File info:', info);
} catch (error) {
console.error('Error getting file info:', error);
}
};
const downloadFile = async () => { const fileUri = FileSystem.documentDirectory + 'downloaded.jpg'; const downloadUrl = 'https://example.com/image.jpg';
try {
const { uri } = await FileSystem.downloadAsync(downloadUrl, fileUri);
console.log('Downloaded to:', uri);
} catch (error) {
console.error('Error downloading file:', error);
}
};
return (
{fileContent ? (
<View style={{ marginTop: 20 }}>
<Text>File Content:</Text>
<Text>{fileContent}</Text>
</View>
) : null}
</View>
); }; ```에 대하여
카메라 및 미디어¶
관련 기사¶
```bash
Install Camera¶
expo install expo-camera ```의 경우
카지노사이트
이미지 Picker¶
카지노사이트
카지노사이트
문의사항¶
위치 설정¶
카지노사이트
카지노사이트
인증현황¶
엑스포 AuthSession¶
카지노사이트
```javascript import * as AuthSession from 'expo-auth-session'; import * as WebBrowser from 'expo-web-browser';
WebBrowser.maybeCompleteAuthSession();
const AuthExample = () => { const [user, setUser] = useState(null);
// Google OAuth const [request, response, promptAsync] = AuthSession.useAuthRequest( { clientId: 'YOUR_GOOGLE_CLIENT_ID', scopes: ['openid', 'profile', 'email'], redirectUri: AuthSession.makeRedirectUri({ useProxy: true, }), }, { authorizationEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth', } );
useEffect(() => { if (response?.type === 'success') { const { authentication } = response; // Use the access token to get user info fetchUserInfo(authentication.accessToken); } }, [response]);
const fetchUserInfo = async (token) => {
try {
const response = await fetch('https://www.googleapis.com/userinfo/v2/me', {
headers: { Authorization: Bearer ${token} },
});
const userInfo = await response.json();
setUser(userInfo);
} catch (error) {
console.error('Error fetching user info:', error);
}
};
const signIn = () => { promptAsync(); };
const signOut = () => { setUser(null); };
return (
Firebase 인증¶
```bash
Install Firebase¶
npm install firebase ```의 경우
카지노사이트
건물 및 출판¶
엑스포 빌드 (Legacy)¶
```bash
Build for iOS¶
expo build:ios
Build for Android¶
expo build:android
Build for web¶
expo build:web
Check build status¶
expo build:status
Download build¶
expo build:download
Publish to Expo¶
expo publish
Set release channel¶
expo publish --release-channel production ```의 경우
App Store 배포¶
```bash
iOS App Store¶
1. Build IPA: expo build:ios¶
2. Download IPA¶
3. Upload to App Store Connect using Transporter or Xcode¶
Google Play Store¶
1. Build APK/AAB: expo build:android¶
2. Download APK/AAB¶
3. Upload to Google Play Console¶
```를 호출합니다.
EAS (Expo 신청 서비스)¶
EAS 설치¶
```bash
Install EAS CLI¶
npm install -g eas-cli
Login to Expo account¶
eas login
Initialize EAS in project¶
eas build:configure
Create development build¶
eas build --profile development --platform ios eas build --profile development --platform android
Create production build¶
eas build --profile production --platform ios eas build --profile production --platform android
Build for all platforms¶
eas build --platform all ```의 경우
제품 정보 제품 설명¶
json
// eas.json
{
"cli": {
"version": ">= 2.0.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal",
"ios": {
"resourceClass": "m1-medium"
}
},
"preview": {
"distribution": "internal"
},
"production": {
"ios": {
"resourceClass": "m1-medium"
}
}
},
"submit": {
"production": {
"ios": {
"appleId": "your-apple-id@example.com",
"ascAppId": "1234567890",
"appleTeamId": "ABCDEF1234"
},
"android": {
"serviceAccountKeyPath": "../path/to/api-key.json",
"track": "internal"
}
}
}
}로
EAS 제출¶
카지노사이트
EAS 업데이트¶
오프화이트
최고의 연습¶
프로젝트 구조¶
카지노사이트
성능 최적화¶
__CODE_BLOCK_49_로그
오류 처리¶
카지노사이트
보안 모범 사례¶
```javascript // Secure storage import * as SecureStore from 'expo-secure-store';
const storeSecureData = async (key, value) => { await SecureStore.setItemAsync(key, value); };
const getSecureData = async (key) => { return await SecureStore.getItemAsync(key); };
// API key protection // Never store API keys in code // Use environment variables or secure storage
// Input validation const validateEmail = (email) => { const emailRegex = /[\s@]+@[\s@]+.[\s@]+$/; return emailRegex.test(email); };
const sanitizeInput = (input) => { return input.trim().replace(/[<>]/g, ''); };
// Network security const secureApiCall = async (url, options = {}) => { const defaultOptions = { headers: { 'Content-Type': 'application/json', // Add authentication headers }, ...options, };
try {
const response = await fetch(url, defaultOptions);
if (!response.ok) {
throw new Error(HTTP error! status: ${response.status});
}
return await response.json();
} catch (error) {
console.error('API call failed:', error);
throw error;
}
};
```를 호출합니다.
제품정보¶
Expo는 단순하게 하는 강력한 플랫폼입니다. React Native 개발 제공:
- **Rapid 개발 **: 빠른 프로젝트 설정 및 개발 워크플로우
- Rich API Access: 기본 코드를 작성하지 않고도 기본 API 세트
- Universal Apps: iOS, Android 및 단일 코드베이스에서 웹 빌드
- Over-the-Air 업데이트: 앱 스토어 승인 없이 푸시 업데이트
- 개발 도구: 우수한 디버깅 및 테스트 도구
- **빌딩 서비스 **: 클라우드 기반 건물 및 배포 EAS
- ** 커뮤니티 **: 큰 생태계와 적극적인 커뮤니티 지원
Expo는 신속한 프로토 타이핑, MVP 및 광범위한 네이티브 커스터마이징이 필요하지 않은 생산 앱에 이상적입니다. 사용자 정의 네이티브 모듈을 필요로 하는 앱의 경우, Expo는 개발자가 원활한 경험을 유지하면서 유연성을 유지할 수 있도록 작업 흐름과 개발 빌드를 제공합니다.
<문서> 기능 copyToClipboard () 이름 * const 명령어 = document.querySelectorAll('code'); let allCommands = ''; 명령. forEach(cmd =>의 경우 모든Commands +=cmd.textContent + navigator.clipboard.write텍스(allCommands); alert('모든 명령은 클립보드에 복사!'); 이름 *
함수 생성PDF() { 창. 인쇄 (); 이름 *