Comments (11)
<DatePicker confirm={date => { this.confirmDate(date); }} cancel={() => this.dateClear()} cancelText={cancelText} toolBarCancelStyle={{color:'#158EE9',}} confirmText={okText} toolBarConfirmStyle={{color:'#158EE9',}} monthDisplayMode = {'en-long'} maxDate={maxDate} defaultDate={new Date()} // onValueChange={date => this.onDateChange(date)} />
可以提供其他信息吗?比如是在同一个界面触发的,还是跳转到扫码界面返回后,日期组件的日期显示发生变化?看这个代码没有发现有什么问题
from react-native-common-date-picker.
只要扫码过后,不管是不是相同页面,日期组件的可选日期就会有部分没有显示,但还是可以滑动选择得到日期
from react-native-common-date-picker.
感谢提供详细信息。我今晚回去试试扫码看是否能够重现这个问题,如果有问题的话,会尽快修改发一个补丁版本。
from react-native-common-date-picker.
RPReplay_Final1639665520.MP4
@Adaniuaaa 尝试了react-native-camera
,无法重现你说的问题。如果方便,可以提供一下你的demo
代码。或者,是不是你当前页面做的其他特殊处理导致的问题?
from react-native-common-date-picker.
是Android
scan page:
`import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, Animated, Easing } from 'react-native';
import { RNCamera } from 'react-native-camera';
class ScanScreen extends Component {
constructor(props) {
super(props);
this.state = {
moveAnim: new Animated.Value(0)
};
}
componentDidMount() {
this.startAnimation();
}
startAnimation = () => {
this.state.moveAnim.setValue(0);
Animated.timing(
this.state.moveAnim,
{
toValue: -200,
duration: 1500,
easing: Easing.linear
}
).start(() => this.startAnimation());
};
onBarCodeRead = (result) => {
this.camera.stopRecording();
if (this.props.scanHandler) {
this.props.scanHandler(result.data);
}
};
render() {
return (
<View style={styles.container}>
{this.props.type === 'QR' &&
<RNCamera
ref={ref => {
this.camera = ref;
}}
autoFocus={RNCamera.Constants.AutoFocus.on}
style={styles.preview}
type={RNCamera.Constants.Type.back}
googleVisionBarcodeType={RNCamera.Constants.GoogleVisionBarcodeDetection.BarcodeType.QR_CODE}
flashMode={RNCamera.Constants.FlashMode.auto}
onBarCodeRead={(e) => this.onBarCodeRead(e)}
>
<View style={styles.rectangleContainer}>
<View style={styles.rectangle}/>
<Animated.View style={[
styles.border,
{transform: [{translateY: this.state.moveAnim}]}]}/>
<Text style={styles.rectangleText}>{'Scan QR code'}</Text>
</View>
</RNCamera>
}
{this.props.type !== 'QR' &&
<RNCamera
ref={ref => {
this.camera = ref;
}}
autoFocus={RNCamera.Constants.AutoFocus.on}
style={styles.preview}
type={RNCamera.Constants.Type.back}
flashMode={RNCamera.Constants.FlashMode.on}
onBarCodeRead={this.onBarCodeRead}
>
<View style={styles.rectangleContainer}>
<View style={styles.rectangle}/>
<Animated.View style={[
styles.border,
{transform: [{translateY: this.state.moveAnim}]}]}/>
<Text style={styles.rectangleText}>{'Scan'}</Text>
</View>
</RNCamera>
}
</View>
);
}
}
export default ScanScreen;
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'row'
},
preview: {
flex: 1,
justifyContent: 'flex-end',
alignItems: 'center'
},
rectangleContainer: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'transparent'
},
rectangle: {
height: 200,
width: 200,
borderWidth: 1,
borderColor: '#00FF00',
backgroundColor: 'transparent'
},
rectangleText: {
flex: 0,
color: '#fff',
marginTop: 10
},
border: {
flex: 0,
width: 200,
height: 2,
backgroundColor: '#00FF00',
}
});`
date page:
<Modal visible={this.state.visible} animationType={"slide"} onRequestClose={() => this.cancel()}> <DatePicker confirm={date => { this.confirmDate(date); }} cancel={() => this.dateClear()} cancelText={'clear'} toolBarCancelStyle={{color:'#158EE9',}} confirmText={'ok'} toolBarConfirmStyle={{color:'#158EE9',}} monthDisplayMode = {'en-long'} maxDate={'2026-12-31'} defaultDate={new Date()} // onValueChange={date => this.onDateChange(date)} /> </Modal>
from react-native-common-date-picker.
是FlatList的问题吗?很奇怪
from react-native-common-date-picker.
@Adaniuaaa 你这个是,从日期所在的页面,进入到扫码页面,再返回到日期页面?扫码成功返回日期页面有没有做什么setState
操作,我看你代码有一个 this.props.scanHandler(result.data);
操作。
from react-native-common-date-picker.
@Adaniuaaa 你这个是,从日期所在的页面,进入到扫码页面,再返回到日期页面?扫码成功返回日期页面有没有做什么
setState
操作,我看你代码有一个this.props.scanHandler(result.data);
操作。
日期页面和扫码页面是分开的,没有数据关联,我只是去扫码页面做扫码操作,然后去日期页面就会看到日期显示不全
from react-native-common-date-picker.
@Adaniuaaa 我现在身边没有Android
真机,我用Android
模拟器没有问
题
from react-native-common-date-picker.
@Adaniuaaa 我现在身边没有
Android
真机,我用Android
模拟器没有问 题
也是先进入日期页面,然后进去扫码,返回到日期页面,点击按钮让modal
显示日期
from react-native-common-date-picker.
@Adaniuaaa 你可以用这个demo
本地跑真机看看哈,如果能够复现,你可以修改一下代码提交一个demo
或代码段。demo链接🔗
from react-native-common-date-picker.
Related Issues (20)
- Day and date values do not match when used with negative offset timezones HOT 1
- 组件打包到线上环境,点击事件延迟十分严重基本上两秒左右(android, ios)所有机型 HOT 1
- CalendarList是否支持默认选中日期 HOT 1
- CalendarList doesn't focus on current date HOT 3
- How to change text color on start and end date if the background is black? HOT 1
- Friday & Saturday are missing from calendar HOT 1
- 太卡了吧,点了个日历两三秒才反应,这还玩啥 HOT 1
- Default Date not seleceted HOT 2
- react-native-common-date-picker模块引入时报错 HOT 2
- Can't change the fontFamily HOT 1
- Cannot able to give the text colors for selected date
- 支持时间选择吗 HOT 1
- 老兄,datePicker/DatePicker.js 里面能不能修改一点,兼容更多版本? HOT 3
- 确实太卡了....
- onPressDate 回调问题 HOT 1
- Disabled dates HOT 1
- How to get selected value when showToolBar is false in DatePicker? HOT 1
- CalendarList组件支持defaultValues嘛? HOT 2
- defaultDate 再次点击不会更新 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-common-date-picker.