Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d369e7ece0 | ||
|
|
6c6b4f64ca | ||
|
|
13c6b86560 |
@ -17,7 +17,7 @@ A react-native component from displaying tooltip. Uses UIMenuController.
|
||||
|
||||
- `actions`: Array of actions `[{text: 'Copy', onPress: () => Clipboard.set(this.someValue) }]`
|
||||
- `longPress`: Boolean indicating if the tooltip should be showing on longPress, false by default.
|
||||
- `arrowDirection`: String indicating the direction of the tooltip arrow. Possible values are: `up`, `down`, `left`, and `right`. Default is `down`.
|
||||
- `arrowDirection`: String indicating the direction of the tooltip arrow. Possible values are: `up`, `down`, `left`, `right`, and `default`. Default is `default`, which means to point up or down at the object of focus based on its location on the screen.
|
||||
|
||||
#### Props from TouchableHighlight.propTypes
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ export default class ToolTip extends PureComponent {
|
||||
text: PropTypes.string.isRequired,
|
||||
onPress: PropTypes.func
|
||||
})),
|
||||
arrowDirection: PropTypes.oneOf(['up', 'down', 'left', 'right']),
|
||||
arrowDirection: PropTypes.oneOf(['up', 'down', 'left', 'right', 'default']),
|
||||
longPress: PropTypes.bool,
|
||||
onHide: PropTypes.func,
|
||||
onShow: PropTypes.func,
|
||||
@ -27,7 +27,7 @@ export default class ToolTip extends PureComponent {
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
arrowDirection: 'down',
|
||||
arrowDirection: 'default',
|
||||
onHide: () => true,
|
||||
onShow: () => true
|
||||
};
|
||||
@ -60,13 +60,13 @@ export default class ToolTip extends PureComponent {
|
||||
getTouchableHighlightProps = () => {
|
||||
const props = {};
|
||||
|
||||
Object.keys(TouchableHighlight.propTypes).forEach((key) => props[key] = this.props[key]);
|
||||
// Object.keys(TouchableHighlight.propTypes).forEach((key) => props[key] = this.props[key]);
|
||||
|
||||
if (this.props.longPress) {
|
||||
props.onLongPress = this.showMenu;
|
||||
} else {
|
||||
props.onPress = this.showMenu;
|
||||
}
|
||||
// if (this.props.longPress) {
|
||||
// props.onLongPress = this.showMenu;
|
||||
// } else {
|
||||
// props.onPress = this.showMenu;
|
||||
// }
|
||||
|
||||
return props;
|
||||
};
|
||||
|
||||
21
ToolTipMenu.podspec
Normal file
21
ToolTipMenu.podspec
Normal file
@ -0,0 +1,21 @@
|
||||
require 'json'
|
||||
|
||||
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "ToolTipMenu"
|
||||
s.version = package['version']
|
||||
s.summary = package['description']
|
||||
s.license = package['license']
|
||||
|
||||
s.authors = package['author']
|
||||
s.homepage = package['repository']['url']
|
||||
s.platform = :ios, "7.0"
|
||||
s.ios.deployment_target = '7.0'
|
||||
|
||||
s.source = { :git => "https://github.com/BlueWallet/react-native-tooltip.git", :tag => "#{s.version}" }
|
||||
s.preserve_paths = '*'
|
||||
s.source_files = "ToolTipMenu/*.{h,m}"
|
||||
|
||||
s.dependency 'React'
|
||||
end
|
||||
@ -35,12 +35,14 @@ RCT_EXPORT_METHOD(show:(nonnull NSNumber *)reactTag
|
||||
|
||||
if([arrowDirection isEqualToString: @"up"]){
|
||||
menuCont.arrowDirection = UIMenuControllerArrowUp;
|
||||
}else if ([arrowDirection isEqualToString: @"right"]){
|
||||
} else if ([arrowDirection isEqualToString: @"right"]){
|
||||
menuCont.arrowDirection = UIMenuControllerArrowRight;
|
||||
}else if ([arrowDirection isEqualToString: @"left"]) {
|
||||
} else if ([arrowDirection isEqualToString: @"left"]) {
|
||||
menuCont.arrowDirection = UIMenuControllerArrowLeft;
|
||||
} else {
|
||||
} else if ([arrowDirection isEqualToString: @"down"]) {
|
||||
menuCont.arrowDirection = UIMenuControllerArrowDown;
|
||||
} else {
|
||||
menuCont.arrowDirection = UIMenuControllerArrowDefault;
|
||||
}
|
||||
menuCont.menuItems = menuItems;
|
||||
[menuCont setMenuVisible:YES animated:YES];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user