Skip to content

Commit

Permalink
styles(format): 누락된 Linting 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
seungholee-dev committed Jul 18, 2024
1 parent 0ac57ff commit ae6ec92
Showing 1 changed file with 40 additions and 35 deletions.
75 changes: 40 additions & 35 deletions src/components/common/ApplyButton.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { View, Text, TouchableOpacity, Alert, StyleSheet } from "react-native";
import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
import { CustomTheme } from "@styles/CustomTheme";

const { fontSub16 } = CustomTheme;
Expand All @@ -9,50 +9,55 @@ const ApplyButton = ({
background = false,
onPress = null,
disabled = false,
access = false,
}) => {
const rectangleStyle = background ? styles.rectangleShadow : styles.rectangle;
const navigation = useNavigation();
const rectangleStyle = background
? styles.rectangleShadow
: styles.rectangle;

const requestPermissions = async () => {
const { status: existingStatus } =
await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;
// const requestPermissions = async () => {
// const { status: existingStatus } = await Notifications.getPermissionsAsync();
// let finalStatus = existingStatus;

if (existingStatus !== "granted") {
const { status } = await Notifications.requestPermissionsAsync();
finalStatus = status;
}
// if (existingStatus !== 'granted') {
// const { status } = await Notifications.requestPermissionsAsync();
// finalStatus = status;
// }

if (finalStatus !== "granted") {
Alert.alert("알림", "설정에서 알림 권한을 허용해주세요.", [
{ text: "취소", style: "cancel" },
{
text: "설정으로 이동",
onPress: () => Linking.openSettings(),
},
]);
} else {
navigation.navigate("Login");
}
};
// if (finalStatus !== 'granted') {
// Alert.alert(
// '알림',
// '설정에서 알림 권한을 허용해주세요.',
// [
// { text: '취소', style: 'cancel' },
// { text: '설정으로 이동', onPress: () => Linking.openSettings() }
// ]
// );
// }
// else {
// navigation.navigate('Login');
// }
// };

const handlePress = () => {
if (onPress) {
onPress();
} else if (access) {
requestPermissions();
}
};
// const handlePress = () => {
// if (onPress) {
// onPress();
// } else if ({access}) {
// requestPermissions();
// }
// };

return (
<TouchableOpacity onPress={handlePress} disabled={disabled}>
<View>
<View style={rectangleStyle}>
<View style={[styles.apply, disabled && styles.disabled]}>
<TouchableOpacity
style={[styles.apply, disabled && styles.disabled]}
onPress={onPress}
disabled={disabled}
>
<Text style={styles.text}>{text}</Text>
</View>
</TouchableOpacity>
</View>
</TouchableOpacity>
</View>
);
};

Expand Down

0 comments on commit ae6ec92

Please sign in to comment.