Skip to content

Commit

Permalink
[Fix]intimacy filter 수정 시 generate 불가 상태 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyeongbin committed Dec 5, 2023
1 parent 7898beb commit 69b8b5e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
31 changes: 12 additions & 19 deletions src/screens/Translation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import FilterBtn, {personFilterType} from '../utils/FilterBtn';
import IntimacyBtn from '../utils/IntimacyBtn';
import {OnlineFilter, StoreFilter, UnivFilter} from '../assets/filterValues';
import {useFocusEffect} from '@react-navigation/native';
import App from '../../App';

// var Sound = require('react-native-sound');
// Sound.setCategory('Playback');
Expand All @@ -50,16 +49,6 @@ export default function Translation({navigation: {navigate}}) {
const intimacyAtomVal = useRecoilValue(IntimacyFilterAtom);
const userIdAtomVal = useRecoilValue(UserIdAtom);

// React.useEffect(() => {
// if (location === 'university') {
// setItems(UnivFilter);
// } else if (location === 'store') {
// setItems(StoreFilter);
// } else {
// setItems(OnlineFilter);
// }
// }, []);

useFocusEffect(
React.useCallback(() => {
if (location === 'university') {
Expand All @@ -84,13 +73,14 @@ export default function Translation({navigation: {navigate}}) {
}, [selectedFilter]),
);

useFocusEffect(
React.useCallback(() => {
if (pressed) {
setPressed(false);
}
}, [filterChanged]),
);
// useFocusEffect(
// React.useCallback(() => {
// console.log('if filter changed? text changed? filter useEffect');
// if (pressed) {
// setPressed(false);
// }
// }, [filterChanged, text]),
// );

React.useEffect(() => {
if (pressed) {
Expand Down Expand Up @@ -248,7 +238,10 @@ export default function Translation({navigation: {navigate}}) {
<Text style={styles.contourStyle}>Intimacy</Text>
</FilterContour>
<FilterWrapper>
<IntimacyBtn setFilterChanged={setFilterChanged} />
<IntimacyBtn
setPressed={setPressed}
setFilterChanged={setFilterChanged}
/>
</FilterWrapper>
<InputBoxWrapper>
<InputBox>
Expand Down
6 changes: 5 additions & 1 deletion src/utils/IntimacyBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type intimacyFilterType = {
};

export default function IntimacyBtn(props: {
setPressed: React.Dispatch<React.SetStateAction<boolean>>;
setFilterChanged?: React.Dispatch<React.SetStateAction<boolean>>;
}) {
const [filters, setFilters] = React.useState([
Expand All @@ -35,10 +36,13 @@ export default function IntimacyBtn(props: {

useFocusEffect(
React.useCallback(() => {
console.log('내부 intimacy filter useEffect');
setIntimacyFilter(selected.label);
if (props.setFilterChanged) {
props.setFilterChanged(true);
console.log('get filter changed');
props.setFilterChanged(() => true);
}
props.setPressed(false);
}, [selected]),
);

Expand Down

0 comments on commit 69b8b5e

Please sign in to comment.