octopitus / rn-sliding-up-panel

Draggable sliding up panel implemented in React Native https://octopitus.github.io/rn-sliding-up-panel/
MIT License
929 stars 157 forks source link

onBottomReached will not fire a callback #196

Closed sentry0 closed 3 years ago

sentry0 commented 3 years ago

Issue Description

onBottomReached seems to work fine when I do something like a console.log but it refuses to fire the callback for some reason. Am I do something silly or is this broken?

Steps to Reproduce / Code Snippets / Screenshots

const srdDocs = {
    attributes: attributes,
};

export default class SrdPanel extends Component {
    static propTypes = {
        filename: PropTypes.string.isRequired,
        entryKey: PropTypes.string.isRequired,
        show: PropTypes.bool.isRequired,
        onClose: PropTypes.func.isRequired,
    };

    _close() {
        console.log('before');
        this.props.onClose();
        console.log('after');
    }

    render() {
        const {height} = Dimensions.get('window');
        const srdEntry = srdDocs[this.props.filename];
        const pos = new Animated.Value(this.props.show ? verticalScale(150) : 0);

        return (
            <SlidingUpPanel animatedValue={pos} height={height} onBottomReached={() => this._close()}>
                <View style={{flex: 1, backgroundColor: BACKGROUND_COLOR, alignItems: 'center'}}>
                    <Text style={styles.modalHeader}>{srdEntry.title}</Text>
                </View>
            </SlidingUpPanel>
        );
    }
}

Environment

sentry0 commented 3 years ago

Nevermind... issue was on my end it looks like.

cdmoss commented 3 years ago

What was the issue? I'm having the same problem.