Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ You can check [index.js](https://github.com/xgfe/react-native-datepicker/blob/ma
| onCloseModal | - | `function` | This is called when the DatePicker Modal close |
| onPressMask | - | `function` | This is called when clicking the ios modal mask |
| modalOnResponderTerminationRequest | - | `function` | Set the callback for React Native's [Gesture Responder System](https://facebook.github.io/react-native/docs/gesture-responder-system.html#responder-lifecycle)'s call to `onResponderTerminationRequest`. By default this will reject a termination request, but can be overidden in case the View under the Modal is implementing custom gesture responders, and you wish for those to be overidden in certain cases. |
| TouchableComponent | `TouchableHighlight` | `Component` | Replace the `TouchableHighlight` with a custom `Component`. For example : `TouchableOpacity` |

### Property `customStyles` available keys

Expand Down
22 changes: 12 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,10 @@ class DatePicker extends Component {
disabled && customStyles.disabled
];

const TouchableComponent = this.props.TouchableComponent ? this.props.TouchableComponent : TouchableHighlight;

return (
<TouchableHighlight
<TouchableComponent
style={[Style.dateTouch, style]}
underlayColor={'transparent'}
onPress={this.onPressDate}
Expand All @@ -354,13 +356,13 @@ class DatePicker extends Component {
<View
style={{flex: 1}}
>
<TouchableHighlight
<TouchableComponent
style={Style.datePickerMask}
activeOpacity={1}
underlayColor={'#00000077'}
onPress={this.onPressMask}
>
<TouchableHighlight
<TouchableComponent
underlayColor={'#fff'}
style={{flex: 1}}
>
Expand All @@ -379,7 +381,7 @@ class DatePicker extends Component {
style={[Style.datePicker, customStyles.datePicker]}
/>
</View>
<TouchableHighlight
<TouchableComponent
underlayColor={'transparent'}
onPress={this.onPressCancel}
style={[Style.btnText, Style.btnCancel, customStyles.btnCancel]}
Expand All @@ -389,21 +391,21 @@ class DatePicker extends Component {
>
{cancelBtnText}
</Text>
</TouchableHighlight>
<TouchableHighlight
</TouchableComponent>
<TouchableComponent
underlayColor={'transparent'}
onPress={this.onPressConfirm}
style={[Style.btnText, Style.btnConfirm, customStyles.btnConfirm]}
>
<Text style={[Style.btnTextText, customStyles.btnTextConfirm]}>{confirmBtnText}</Text>
</TouchableHighlight>
</TouchableComponent>
</Animated.View>
</TouchableHighlight>
</TouchableHighlight>
</TouchableComponent>
</TouchableComponent>
</View>
</Modal>}
</View>
</TouchableHighlight>
</TouchableComponent>
);
}
}
Expand Down