Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions src/components/auth/AppleNativeAuthScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import * as Haptics from 'expo-haptics';
import AsyncStorage from '@react-native-async-storage/async-storage';
import AppleContactAuthModal from './AppleContactAuthModal';
import AppleBottomTray from '../ui/AppleBottomTray';
import * as AppleAuthentication from 'expo-apple-authentication';
import { AppleAuthenticationButton } from 'expo-apple-authentication';

const { width: SCREEN_WIDTH } = Dimensions.get('window');

Expand All @@ -31,6 +33,7 @@ export default function AppleNativeAuthScreen({ onAuthSuccess }: AppleNativeAuth
const [showMoreOptions, setShowMoreOptions] = useState(false);
const [showEmailModal, setShowEmailModal] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const [appleAuthAvailable, setAppleAuthAvailable] = useState(false);

// Animation values
const fadeAnim = useRef(new Animated.Value(0)).current;
Expand Down Expand Up @@ -65,6 +68,10 @@ export default function AppleNativeAuthScreen({ onAuthSuccess }: AppleNativeAuth
]).start();
}, []);

useEffect(() => {
AppleAuthentication.isAvailableAsync().then(setAppleAuthAvailable);
}, []);

const PASSKEY_KEY = 'interspace_has_passkey';

const checkPasskey = async () => {
Expand Down Expand Up @@ -175,18 +182,15 @@ export default function AppleNativeAuthScreen({ onAuthSuccess }: AppleNativeAuth
</View>

{/* Sign in with Apple - Secondary Option */}
<AppleAuthButton
onPress={handleSignInWithApple}
variant="tertiary"
>
<View style={styles.buttonContent}>
<Image
source={require('../../../assets/images/apple.png')}
style={[styles.appleIcon, { tintColor: Apple.Colors.systemBlue }]}
/>
<Text style={styles.tertiaryButtonText}>Sign in with Apple</Text>
</View>
</AppleAuthButton>
{appleAuthAvailable && (
<AppleAuthenticationButton
buttonType={AppleAuthentication.AppleAuthenticationButtonType.SIGN_IN}
buttonStyle={AppleAuthentication.AppleAuthenticationButtonStyle.BLACK}
cornerRadius={Apple.Radius.standard}
style={styles.appleSignInButton}
onPress={handleSignInWithApple}
/>
)}

{/* More Options */}
<TouchableOpacity
Expand Down Expand Up @@ -437,6 +441,11 @@ const styles = StyleSheet.create({
alignItems: 'center',
marginBottom: Apple.Spacing.medium,
},
appleSignInButton: {
width: '100%',
height: 50,
marginBottom: Apple.Spacing.medium,
},
appleButton: {
backgroundColor: Apple.Colors.label,
},
Expand Down