Skip to content

Commit

Permalink
Add ?Fbt to flow type for the title & message props
Browse files Browse the repository at this point in the history
Differential Revision: D6253195

fbshipit-source-id: eadb185eacdf341393d73357beab22bed1d0169e
  • Loading branch information
Jessica Cao authored and facebook-github-bot committed Nov 7, 2017
1 parent 515eb0e commit 2be3ae1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
9 changes: 5 additions & 4 deletions Libraries/Alert/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const NativeModules = require('NativeModules');
const Platform = require('Platform');

import type { AlertType, AlertButtonStyle } from 'AlertIOS';
import type { Fbt } from 'fbt';

This comment has been minimized.

Copy link
@chirag04

chirag04 Nov 8, 2017

Contributor

@hramos we need to add this to package.json?

This comment has been minimized.

Copy link
@hramos

hramos Nov 9, 2017

Contributor

Hmm let me follow up.


export type Buttons = Array<{
text?: string,
Expand Down Expand Up @@ -79,8 +80,8 @@ type Options = {
class Alert {

static alert(
title: ?string,
message?: ?string,
title: ?string | ?Fbt,
message?: ?string | ?Fbt,
buttons?: Buttons,
options?: Options,
type?: AlertType,
Expand All @@ -104,8 +105,8 @@ class Alert {
class AlertAndroid {

static alert(
title: ?string,
message?: ?string,
title: ?string | ?Fbt,
message?: ?string | ?Fbt,
buttons?: Buttons,
options?: Options,
): void {
Expand Down
12 changes: 7 additions & 5 deletions Libraries/Alert/AlertIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
*/
'use strict';

var RCTAlertManager = require('NativeModules').AlertManager;
const RCTAlertManager = require('NativeModules').AlertManager;

import type { Fbt } from 'fbt';

/**
* An Alert button type
Expand Down Expand Up @@ -133,8 +135,8 @@ class AlertIOS {
* );
*/
static alert(
title: ?string,
message?: ?string,
title: ?string | ?Fbt,
message?: ?string | ?Fbt,
callbackOrButtons?: ?(() => void) | ButtonsArray,
type?: AlertType,
): void {
Expand Down Expand Up @@ -192,8 +194,8 @@ class AlertIOS {
* );
*/
static prompt(
title: ?string,
message?: ?string,
title: ?string | ?Fbt,
message?: ?string | ?Fbt,
callbackOrButtons?: ?((text: string) => void) | ButtonsArray,
type?: ?AlertType = 'plain-text',
defaultValue?: string,
Expand Down

0 comments on commit 2be3ae1

Please sign in to comment.