Example of hitSlop Prop in View TouchableOpacity in React Native

Hello friends, In today’s tutorial we would learn about hitSlop prop in react native, How hitSlop works with View and TouchableOpacity button. The main work of hitSlop is to increase the touchable area of a View or button. So using this we can make a Touchable View completely clickable or a part of it clickable. So in this tutorial we would learn about Example of hitSlop Prop in View TouchableOpacity in React Native Android iOS.

Contents in this project Example of hitSlop Prop in View TouchableOpacity in React Native :-

1. Open your project’s main App.js file and import View, StyleSheet, Text and TouchableOpacity component.

2. Creating our main export default App component.

3. Creating return() block, Now here we would first make a Root View component -> make a Child View component and put the Touchable Opacity button inside it. Now we would apply the hitSlop prop on Touchable and set its area on all top, left, bottom and right side.

4. Creating Style.

5. Complete Source Code for our React Native Project’s Main App.js File :

Screenshot :-

Example of hitSlop Prop in View TouchableOpacity in React Native

Leave a Reply

Your email address will not be published. Required fields are marked *