-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TM] Add spec for AlertManager #24906
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c1dc4d3
[TM] Add spec for AlertManager
sasurau4 360a8ec
fix lint
sasurau4 01dfd43
use string instead of union and enums for spec of AlertManager
sasurau4 b6dca5b
use es module instead of commonjs in Alert
sasurau4 2b5b22f
replace call-sites inside ALert.js
sasurau4 7091b2e
fix pointed out
sasurau4 fa8beb3
move types to NativeAlertManager
sasurau4 b80f17d
fix lint
sasurau4 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* Copyright 2004-present Facebook. All Rights Reserved. | ||
* | ||
* @flow strict-local | ||
* @format | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import type {TurboModule} from 'RCTExport'; | ||
import * as TurboModuleRegistry from 'TurboModuleRegistry'; | ||
import Platform from '../Utilities/Platform'; | ||
|
||
export type Buttons = Array<{ | ||
text?: string, | ||
onPress?: ?() => void, | ||
style?: AlertButtonStyle, | ||
}>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It also doesn't support enums. 😔 |
||
|
||
export type Options = { | ||
cancelable?: ?boolean, | ||
onDismiss?: ?() => void, | ||
}; | ||
|
||
/* 'default' | plain-text' | 'secure-text' | 'login-password' */ | ||
export type AlertType = string; | ||
|
||
/* 'default' | 'cancel' | 'destructive' */ | ||
export type AlertButtonStyle = string; | ||
|
||
type Args = {| | ||
sasurau4 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
title: string, | ||
message?: string, | ||
buttons?: Buttons, | ||
type?: string, | ||
defaultValue?: string, | ||
cancelButtonKey?: string, | ||
destructiveButtonKey?: string, | ||
keyboardType?: string, | ||
|}; | ||
|
||
export interface Spec extends TurboModule { | ||
+alertWithArgs: ( | ||
args: Args, | ||
callback: (id: number, value: string) => void, | ||
) => void; | ||
} | ||
|
||
export default (Platform.OS === 'ios' | ||
? TurboModuleRegistry.getEnforcing<Spec>('AlertManager') | ||
: undefined); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a minor and no need to update it, but you also can use