import _ from 'lodash'; import React, {useCallback, useState} from 'react'; import {View, Text, Dialog, WheelPicker, WheelPickerAlign, Colors, Typography, Button} from 'react-native-ui-lib'; const monthItems = _.map([ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ], item => ({label: item, value: item, align: WheelPickerAlign.RIGHT})); const yearItems = _.times(2050, i => i) .reverse() .map(item => ({label: `${item}`, value: item})); const dayItems = _.times(31, i => i + 1).map(day => ({label: `${day}`, value: day})); export default () => { const [showDialog, setShowDialog] = useState(false); const [yearsValue, setYearsValue] = useState(2022); const updateYearsInitialValue = useCallback((increaseYears: boolean) => { increaseYears ? setYearsValue(Math.min(yearsValue + 1, 2049)) : setYearsValue(Math.max(yearsValue - 1, 0)); }, [yearsValue]); const onChange = useCallback((value: number | string) => { setYearsValue(value as number); }, []); const onPickDaysPress = useCallback(() => { setShowDialog(true); }, []); const onDialogDismissed = useCallback(() => { setShowDialog(false); }, []); return ( Wheel Picker Months Years Move the wheel programmatically (by updating the initialValue prop)