Skip to content

Commit

Permalink
fix: swift 통신을 위한 코드 수정
Browse files Browse the repository at this point in the history
fix: swift 통신을 위한 코드 수정
  • Loading branch information
urimeee authored Dec 29, 2024
2 parents e916d18 + fe247d0 commit 55a82ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
12 changes: 0 additions & 12 deletions src/pages/PlusPage/PlusPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,9 @@ import VersionInfo from '../../components/VersionInfo/VersionInfo';
const PlusPage = () => {
const addPageInfoTitles = ['서비스 이용약관', '개인정보 처리방침'];
const addPageSettingTitles = ['로그아웃', '회원탈퇴'];
const [userInfo, setUserInfo] = useState('');

useEffect(() => {
window.receiveUserInfo = function (info: string) {
console.log('connected!');
setUserInfo(info);
console.log('Received user info : ', info);
alert(`네이티브 통신 성공! 받은 데이터: ${JSON.stringify(info)}`);
return 'success';
};
}, []);

return (
<S.AddPageContainer>
<p>{userInfo}</p>
<UserProfile />
<S.AddPageBelowContainer>
<AddPageContainer title={'정보'} contentTitles={addPageInfoTitles} />
Expand Down
19 changes: 18 additions & 1 deletion src/pages/SchedulePage/SchedulePage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
import React from 'react';
import React, { useEffect, useState } from 'react';
import TextField from '../../components/TextField/TextField';
import ScheduleCard from '../../components/ScheduleCard/ScheduleCard';
import * as S from './SchedulePage.style';

const SchedulePage = () => {
const [userInfo, setUserInfo] = useState('');

useEffect(() => {
window.receiveUserInfo = function (info: string) {
console.log('connected!');
setUserInfo(info);
console.log('Received user info : ', info);
alert(`네이티브 통신 성공! 받은 데이터: ${JSON.stringify(info)}`);
return 'success';
};
}, []);

const buttonOnClick = () => {
console.log(userInfo);
};

return (
<S.Container>
<button onClick={buttonOnClick}>버튼</button>
<TextField />
<ScheduleCard />
</S.Container>
Expand Down

0 comments on commit 55a82ff

Please sign in to comment.