mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at remove_new_user_progress_guide 68 lines 1.7 kB view raw
1import React from 'react' 2import {StyleSheet, TextInput, TextInputProps} from 'react-native' 3// @ts-ignore 4import {unstable_createElement} from 'react-native-web' 5 6import {DateFieldProps} from '#/components/forms/DateField/types' 7import {toSimpleDateString} from '#/components/forms/DateField/utils' 8import * as TextField from '#/components/forms/TextField' 9import {CalendarDays_Stroke2_Corner0_Rounded as CalendarDays} from '#/components/icons/CalendarDays' 10 11export * as utils from '#/components/forms/DateField/utils' 12export const LabelText = TextField.LabelText 13 14const InputBase = React.forwardRef<HTMLInputElement, TextInputProps>( 15 ({style, ...props}, ref) => { 16 return unstable_createElement('input', { 17 ...props, 18 ref, 19 type: 'date', 20 style: [ 21 StyleSheet.flatten(style), 22 { 23 background: 'transparent', 24 border: 0, 25 }, 26 ], 27 }) 28 }, 29) 30 31InputBase.displayName = 'InputBase' 32 33const Input = TextField.createInput(InputBase as unknown as typeof TextInput) 34 35export function DateField({ 36 value, 37 onChangeDate, 38 label, 39 isInvalid, 40 testID, 41 accessibilityHint, 42}: DateFieldProps) { 43 const handleOnChange = React.useCallback( 44 (e: any) => { 45 const date = e.target.valueAsDate || e.target.value 46 47 if (date) { 48 const formatted = toSimpleDateString(date) 49 onChangeDate(formatted) 50 } 51 }, 52 [onChangeDate], 53 ) 54 55 return ( 56 <TextField.Root isInvalid={isInvalid}> 57 <TextField.Icon icon={CalendarDays} /> 58 <Input 59 value={value} 60 label={label} 61 onChange={handleOnChange} 62 onChangeText={() => {}} 63 testID={testID} 64 accessibilityHint={accessibilityHint} 65 /> 66 </TextField.Root> 67 ) 68}