reactnativecn / react-native-website

React Native 中文网
https://reactnative.cn
MIT License
216 stars 327 forks source link

ScrollView横向滚动闪动问题 #714

Closed tianming229 closed 10 months ago

tianming229 commented 1 year ago

不同设备偶现机率不同

https://github.com/reactnativecn/react-native-website/assets/76057323/9099c652-5a9e-481c-981c-4450016337d2 微信截图_20230530171900

源码: <ScrollView style={{ flex: 1 }} showsHorizontalScrollIndicator={false} alwaysBounceHorizontal={false} horizontal={true} ref={(ref) => (this.svrefIdx = ref)} onContentSizeChange={(contentWidth, contentHeight) => { if (this.state.selectMode === 'mother') { // console.log('first', contentWidth, contentHeight) } this.svrefIdx.scrollTo({ x: 0, y: 0, animated: true }); }} onScroll={(e) => { if (this.state.selectMode === 'mother') { const handleBox = findNodeHandle(this.refs.box) UIManager.measure(handleBox, (x, y, width, height, pageX, pageY) => { console.log('父组件宽度width:', width); console.log('父组件高度height:', height); }) const handle = findNodeHandle(this.refs.eeeRef) UIManager.measure(handle, (x, y, width, height, pageX, pageY) => { console.log('list相对父视图位置x:', x); console.log('list相对父视图位置y:', y); console.log('list组件宽度width:', width); console.log('list组件高度height:', height); console.log('list距离屏幕的绝对位置x:', pageX); console.log('list距离屏幕的绝对位置y:', pageY); console.log('=========:'); }) } }}

<View ref='box' style={[ { maxHeight: cx(188), flexDirection: 'row', flexWrap: 'wrap' }, nowData.length > 3 && { width: cx(520) }, ]} onLayout={(e) => { console.log('e', e.nativeEvent.layout) }}

{nowData.map((item: any, index: number) => this._renderList(item, index))}

github-actions[bot] commented 10 months ago

👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 10 months ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.