Skip to content

Commit

Permalink
Add two features
Browse files Browse the repository at this point in the history
1. Work with text with transparent background.
2. Respond to press event.
  • Loading branch information
luqiuyuan committed May 24, 2017
1 parent 94359a2 commit b8cb99a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-popover-tooltip",
"version": "1.0.2",
"version": "1.0.3",
"description": "ReactNative component showing tooltip with menu items.",
"main": "src/index.js",
"scripts": {
Expand Down
12 changes: 11 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ class PopoverTooltip extends React.Component {
this.hideModal = this.hideModal.bind(this);
}

componentWillMount() {
this.setState({opposite_opacity: this.state.opacity.interpolate({
inputRange: [0, 1],
outputRange: [1, 0]
})});
}

toggleModal() {
const { isModalOpen } = this.state;
this.setState({ isModalOpen: !isModalOpen });
Expand Down Expand Up @@ -79,11 +86,14 @@ class PopoverTooltip extends React.Component {
<TouchableOpacity
ref={component => this._component_wrapper = component}
style={[componentWrapperStyle]}
onPress={this.props.onPress}
onLongPress={this.toggle.bind(this)}
delayLongPress={100}
activeOpacity={1.0}
>
{buttonComponent}
<Animated.View style={{opacity:this.state.opposite_opacity}}>
{buttonComponent}
</Animated.View>
<Modal
visible={this.state.isModalOpen}
transparent
Expand Down

0 comments on commit b8cb99a

Please sign in to comment.