From 7f9f305b9d40302612a961d5e44e4c60f2bdee50 Mon Sep 17 00:00:00 2001 From: Aditya Pawar Date: Tue, 3 Oct 2023 22:34:42 -0700 Subject: [PATCH] Fix andriod date taking up the screen --- package-lock.json | 10 +++++----- package.json | 2 +- src/components/Account.tsx | 26 +++++++++++++++----------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index ffc11f21..3071c3fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -52,7 +52,7 @@ "eslint-plugin-react-hooks": "^4.6.0", "husky": "^8.0.3", "prettier": "^2.8.8", - "typescript": "^4.2.0" + "typescript": "^5.1.3" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -16482,16 +16482,16 @@ } }, "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/ua-parser-js": { diff --git a/package.json b/package.json index 7e30981a..270abcba 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "eslint-plugin-react-hooks": "^4.6.0", "husky": "^8.0.3", "prettier": "^2.8.8", - "typescript": "^4.2.0" + "typescript": "^5.1.3" }, "private": true } diff --git a/src/components/Account.tsx b/src/components/Account.tsx index 1a7de129..61acfa09 100644 --- a/src/components/Account.tsx +++ b/src/components/Account.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { StyleSheet, View, Alert, ScrollView } from 'react-native'; +import { StyleSheet, View, Alert, ScrollView, Platform } from 'react-native'; import { Button, Input } from 'react-native-elements'; import { Session } from '@supabase/supabase-js'; import DateTimePicker from '@react-native-community/datetimepicker'; @@ -28,6 +28,7 @@ export default function Account({ session }: { session: Session }) { const [birthday, setBirthday] = useState(new Date()); const [gender, setGender] = useState(''); const [raceEthnicity, setRaceEthnicity] = useState(''); + const [showDatePicker, setShowDatePicker] = useState(Platform.OS === 'ios'); const getProfile = async () => { try { @@ -131,16 +132,19 @@ export default function Account({ session }: { session: Session }) { value={raceEthnicity} onChange={setRaceEthnicity} /> - { - if (date.nativeEvent.timestamp) { - setBirthday(new Date(date.nativeEvent.timestamp)); - } - }} - /> + {showDatePicker && ( + { + setShowDatePicker(Platform.OS === 'ios'); + if (date.nativeEvent.timestamp) { + setBirthday(new Date(date.nativeEvent.timestamp)); + } + }} + /> + )}