u
This commit is contained in:
1 parent
33113f279c
commit
c2c5cc92af
16 files changed
+864
-352
No files matched your search
@@ -1,42 +1,48 @@
|
||||
import dayjs from 'dayjs'
|
||||
import { useState } from 'react'
|
||||
import { StyleSheet, View } from 'react-native'
|
||||
import DateTimePicker from 'react-native-dates-picker'
|
||||
// DemoADatePicker.tsx
|
||||
import React, { useState } from 'react'
|
||||
import { Button, ScrollView, StyleSheet } from 'react-native'
|
||||
import { ADateTimeDrawer } from '@/components/common/ao'
|
||||
|
||||
export default function App() {
|
||||
export default function DemoADatePicker() {
|
||||
const [show, setShow] = useState(false)
|
||||
const [date, setDate] = useState(dayjs())
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<DateTimePicker
|
||||
mode="single"
|
||||
date={date}
|
||||
selectedItemColor="#fff"
|
||||
selectedTextStyle={{
|
||||
fontWeight: 'bold',
|
||||
color: '#00d279',
|
||||
<ScrollView contentContainerStyle={styles.container}>
|
||||
<ADateTimeDrawer
|
||||
isOpen={show}
|
||||
defaultDate={date}
|
||||
modeType="year-month"
|
||||
onConfirm={(val) => {
|
||||
console.log(val)
|
||||
}}
|
||||
headerTextStyle={{
|
||||
fontSize: 18,
|
||||
onClose={() => {
|
||||
setShow(false)
|
||||
}}
|
||||
headerButtonStyle={{
|
||||
backgroundColor: '#ffffff',
|
||||
borderRadius: 8,
|
||||
}}
|
||||
headerButtonColor="#00d279"
|
||||
headerButtonSize={18}
|
||||
headerButtonsPosition="right"
|
||||
onChange={params => setDate(params.date)}
|
||||
/>
|
||||
</View>
|
||||
<Button
|
||||
title="测试"
|
||||
onPress={() => {
|
||||
setShow(!show)
|
||||
}}
|
||||
>
|
||||
</Button>
|
||||
</ScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: '#F5FCFF',
|
||||
marginTop: 128,
|
||||
padding: 16,
|
||||
padding: 20,
|
||||
},
|
||||
label: {
|
||||
marginTop: 20,
|
||||
fontSize: 16,
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
result: {
|
||||
marginVertical: 5,
|
||||
fontSize: 14,
|
||||
color: '#333',
|
||||
},
|
||||
})
|
||||
Reference in new issue
Block a user