Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set scrollview scrollEnabled to true, continue to scroll and did not trigger the scroll event #17316

Closed
Micjoyce opened this issue Dec 22, 2017 · 1 comment
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@Micjoyce
Copy link

Micjoyce commented Dec 22, 2017

Is this a bug report?

Yes

Environment

Environment:
OS: macOS High Sierra 10.13.1
Node: 8.8.1
Yarn: 1.3.2
npm: 5.4.2
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
react-native: 0.48.2 => 0.48.2

Steps to Reproduce

1.View wrapped with a scrollview, scrollview's scrollEnabled prop is false
2.Set scrollEnabled to true when the view layer's onStartShSetSetPanResponderCapture event fires
3.Do not raise your hand to continue sliding down, scrollview's scrollEnabled prop is true but did not trigger a rolling event

Has any idea to fix this.

Reproducible Demo

import React from 'react';
import { StyleSheet, Text, View, ScrollView, PanResponder, Button } from 'react-native';

export default class App extends React.Component {
  constructor() {
    super()
    this.state = {
      enableScrollViewScroll: false
    }
    const data = [];
    for (let i = 0; i < 100; i++) {
      data.push({
        key: i + 'key',
        name: i + 'name'
      })
    }
    this.data = data;
  }
  componentWillMount() {
    this._outPanResponder = PanResponder.create({
      onStartShouldSetPanResponderCapture: (evt) => {
        this.setState({
          enableScrollViewScroll: true
        });
      },
    })
  }
  renderItem = (item) => {
    return (
      <View key={item.key} style={{ height: 40, backgroundColor: '#ccc' }}>
        <Text>{item.name}</Text>
      </View>
    )
  }
  render() {
    return (
      <View
        style={{ flex: 1 }}
        {...this._outPanResponder.panHandlers}
      >
        <View
          style={{ height: 200, backgroundColor: '#eee' }}
        >
          <Text>scrollEnabled: {this.state.enableScrollViewScroll.toString()}</Text>
        </View>
        <ScrollView
          scrollEnabled={this.state.enableScrollViewScroll}
        >
          {this.data.map(item => this.renderItem(item))}
        </ScrollView>
      </View>
    );
  }
}
@stale
Copy link

stale bot commented Feb 20, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 20, 2018
@stale stale bot closed this as completed Feb 27, 2018
@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

1 participant