-
Notifications
You must be signed in to change notification settings - Fork 0
feat: webview setting #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b852b01
feat: webview 도입 설정
99mini e4a0cd9
fix: remove unnessart code
99mini 829bbe9
fix: 개발환경에서 사용
99mini abb4e25
feat: safe area 전송
99mini 886c12e
chore: import order
99mini f03dcae
feat: 웹뷰 레퍼런스 관리를 위한 zustand 스토어 구현
99mini 7780ad9
feat: 웹뷰 URL 환경변수 설정 및 리뷰 없을 때 빈 화면 UI 추가
99mini 253190d
refactor: 웹뷰 네비게이션 히스토리 관리 기능 추가 및 스토어 구조 개선
99mini 13e9ef4
feat: 웹뷰 메시지 타입 분리 및 인증 방식 변경
99mini f431af8
style: 메뉴 컴포넌트의 폰트 스타일 테마 적용 및 가격 표시 UI 개선
99mini aa616f4
refactor: Appbar 컴포넌트들의 경로 구조 정리 및 index 파일 추가
99mini e174ad7
chore: @ummgoban/shared 패키지 버전 업데이트 (20250808 -> 20250812)
99mini 9d09015
refactor: 장바구니 데이터 관리를 queryClient로 변경하고 웹뷰 라우팅 추가
99mini 7ed8444
fix: 마켓 상세 웹뷰 URI 설정 및 타이틀 변경
99mini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { | ||
| DetailStackParamList, | ||
| FeedStackParamList, | ||
| HomeStackParamList, | ||
| MyPageStackParamList, | ||
| RegisterStackParamList, | ||
| RootStackParamList, | ||
| } from '@/types/StackNavigationType'; | ||
| import {StackNavigationProp} from '@react-navigation/stack'; | ||
|
|
||
| export function routeToDetail( | ||
| navigation: StackNavigationProp< | ||
| | RootStackParamList | ||
| | HomeStackParamList | ||
| | FeedStackParamList | ||
| | RegisterStackParamList | ||
| | DetailStackParamList | ||
| | MyPageStackParamList | ||
| >, | ||
| marketId: number, | ||
| ) { | ||
| navigation.navigate('Detail', { | ||
| screen: 'MarketDetail', | ||
| params: {marketId}, | ||
| webview: { | ||
| uri: __DEV__ ? 'http://172.30.1.34:4173' : 'https://ummgoban.com', | ||
| title: 'webview', | ||
| }, | ||
| }); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import React from 'react'; | ||
| import WebViewScreen from '@/webview/WebViewScreen'; | ||
|
|
||
| type RouteWithWeb = {params: {webview?: {uri: string; title?: string}}}; | ||
|
|
||
| const withWebViewGate = <P extends {route?: RouteWithWeb}>( | ||
| NavigatorComponent: React.ComponentType<P>, | ||
| ) => { | ||
| return function WebViewGateComponent(props: P) { | ||
| const webview = props.route?.params?.webview; | ||
|
|
||
| if (webview?.uri) { | ||
| return <WebViewScreen {...webview} />; | ||
| } | ||
| return <NavigatorComponent {...props} />; | ||
| }; | ||
| }; | ||
|
|
||
| export default withWebViewGate; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import {useFocusEffect} from '@react-navigation/native'; | ||
| import React, {useCallback, useRef, useState} from 'react'; | ||
| import {BackHandler, Linking} from 'react-native'; | ||
| import {WebView} from 'react-native-webview'; | ||
|
|
||
| type Props = { | ||
| uri: string; | ||
| title?: string; | ||
| }; | ||
|
|
||
| const WebViewScreen = ({uri}: Props) => { | ||
| const webRef = useRef<WebView>(null); | ||
| const [canGoBack, setCanGoBack] = useState(false); | ||
|
|
||
| useFocusEffect( | ||
| useCallback(() => { | ||
| const sub = BackHandler.addEventListener('hardwareBackPress', () => { | ||
| if (canGoBack) { | ||
| webRef.current?.goBack(); | ||
| return true; | ||
| } | ||
| return false; | ||
| }); | ||
| return () => sub.remove(); | ||
| }, [canGoBack]), | ||
| ); | ||
|
|
||
| return ( | ||
| <WebView | ||
| ref={webRef} | ||
| source={{uri}} | ||
| onNavigationStateChange={s => setCanGoBack(s.canGoBack)} | ||
| javaScriptEnabled | ||
| domStorageEnabled | ||
| setSupportMultipleWindows={false} | ||
| // 필요 시 스킴 필터/외부 링크 분리 | ||
| onShouldStartLoadWithRequest={req => { | ||
| if (!/^https?:/.test(req.url)) { | ||
99mini marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Linking.openURL(req.url); | ||
| return false; | ||
| } | ||
| return true; | ||
| }} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export default WebViewScreen; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.