Send dismiss event when popover is closed
Summary: Dismissing the popover will stiop the user from being prompted for a while, so we only want to send this event when the user was proactively prompted in the first place - which is when we're using the eligibility check. Reviewed By: passy Differential Revision: D17343227 fbshipit-source-id: 95a071e34ce318fe49640c6ee9f68127957f390c
This commit is contained in:
committed by
Facebook Github Bot
parent
25739aebc2
commit
d3be6357ef
@@ -20,6 +20,8 @@ import GK from '../fb-stubs/GK';
|
||||
import * as UserFeedback from '../fb-stubs/UserFeedback';
|
||||
import {FeedbackPrompt} from '../fb-stubs/UserFeedback';
|
||||
|
||||
const useEligibilityCheck = GK.get('flipper_use_itsr_eligibility_check');
|
||||
|
||||
type Props = {
|
||||
onRatingChanged: (rating: number) => void;
|
||||
};
|
||||
@@ -254,7 +256,7 @@ export default class RatingButton extends Component<Props, State> {
|
||||
state = {
|
||||
promptData: null,
|
||||
isShown: false,
|
||||
userIsEligible: !GK.get('flipper_use_itsr_eligibility_check'),
|
||||
userIsEligible: !useEligibilityCheck,
|
||||
};
|
||||
|
||||
constructor(props: Props) {
|
||||
@@ -265,7 +267,11 @@ export default class RatingButton extends Component<Props, State> {
|
||||
}
|
||||
|
||||
onClick() {
|
||||
this.setState({isShown: !this.state.isShown});
|
||||
const willBeShown = !this.state.isShown;
|
||||
this.setState({isShown: willBeShown});
|
||||
if (!willBeShown && useEligibilityCheck) {
|
||||
UserFeedback.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
submitRating(rating: number) {
|
||||
|
||||
@@ -27,6 +27,9 @@ export async function submitComment(
|
||||
): Promise<void> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
export async function dismiss(): Promise<void> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
export async function getPrompt(): Promise<FeedbackPrompt> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user