試圖找出如何我可以x秒 後不知何故隱藏工具提示它顯示了疊加後:如何隱藏工具提示後x毫秒
我使用react-bootstrap's tooltip與overlay一起
export class UserList extends Component {
render(){
const {
handleResetPassword,
resetEmailValidationState,
resetEmailValidationUser,
statusColor,
statusMessage,
users
} = this.props
const userList = users && users.map(
(user) =>
<User
handleResetPassword={handleResetPassword}
key={user.uuid}
resetEmailValidationState={resetEmailValidationState}
resetEmailValidationUser={resetEmailValidationUser}
statusColor={statusColor}
statusMessage={statusMessage}
user={user}
/>)
return(<Table className='ft-list' responsive>
<thead>
<tr>
<th>uuid</th>
<th>First</th>
<th>Last</th>
<th>email</th>
</tr>
</thead>
<tbody>{userList}</tbody>
</Table>)
}
}
export class User extends Component {
constructor(){
super()
this.state = {
showTooltip: false
}
this.buttonEl = undefined
}
componentWillReceiveProps(nextProps) {
const { resetEmailValidationUser, resetEmailValidationState } = nextProps,
{ uuid } = nextProps.user
this.setState({ showTooltip: uuid === resetEmailValidationUser && resetEmailValidationState === 'success'})
}
componentDidMount(){
if(this.overlay.show){
//this.overlay.show = false
ReactDOM.findDOMNode(this.overlay).show = false
}
}
render() {
const {
handleResetPassword,
resetEmailValidationState,
resetEmailValidationUser,
statusColor,
statusMessage } = this.props,
{ uuid, firstName, lastName, email } = this.props.user,
button = (
<span ref={(el) => this.buttonEl = el}>
<Overlay
animation
delayHide="5000"
placement='top'
show={this.state.showTooltip}
ref={(el) => this.overlay = el}
target={() => ReactDOM.findDOMNode(this.refs.target)}
>
<Tooltip id="overload-right">{statusMessage}</Tooltip>
</Overlay>
<Button
bsSize='xsmall'
className='ft-reset-password-link background-color-dark-grey'
onClick={() => handleResetPassword(uuid, email)}
ref="target"
>
reset password
</Button>
</span>)
return (
<tr>
<td>{uuid}</td>
<td>{firstName}</td>
<td>{lastName}</td>
<td>{email}</td>
<td>{button}</td>
</tr>
)
}
}
我不太明白我怎麼能觸發隱藏(設置顯示爲假但何時何地?)
不'delayHide'就夠了嗎? –
沒有我設置的,但你要隱藏()首先,你必須設置隱藏,但我需要能夠檢測到它正在顯示莫名其妙地設置隱藏 –
或者我想你可以嘗試隱藏覆蓋本身,而是可是我還是不知道該怎麼做 –