Quantcast
Channel: react-native TouchableNativeFeedback onPress not working - Stack Overflow
Viewing all articles
Browse latest Browse all 8

react-native TouchableNativeFeedback onPress not working

$
0
0

I have created a composed component to compose TouchableNativeFeedback to wrapperComponent.

export default function withFeedback2(    WrappedComponent) {    return class extends BaseComponent {        constructor(props) {            super(props);        }        render() {            return (<View><TouchableNativeFeedback                        onPress={() => this.props.onContainerViewPress()}><WrappedComponent {...this.props} /></TouchableNativeFeedback>                    {/* <TouchableOpacity                        onPress={this.props.onContainerViewPress ? () => this.props.onContainerViewPress() : null}><WrappedComponent {...this.props} /></TouchableOpacity> */}</View>            );        }    };}

But OnPress event of TochableNativeFeedback is not firing. Whereas OnPress event is fired correctly and onContainerViewPress prop of wrappercomponent is called if wrappercomponent wrapped under TouchableOpacity.

I am testing this on the Android Platform.


Viewing all articles
Browse latest Browse all 8

Trending Articles