Skip to content
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

Replace global.alert use to fix eslint warnings #22184

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions RNTester/js/AccessibilityIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,22 @@

const React = require('react');
const ReactNative = require('react-native');
const {AccessibilityInfo, Text, View, TouchableOpacity} = ReactNative;
const {AccessibilityInfo, Text, View, TouchableOpacity, Alert} = ReactNative;

class AccessibilityIOSExample extends React.Component<{}> {
render() {
return (
<View>
<View
onAccessibilityTap={() => alert('onAccessibilityTap success')}
onAccessibilityTap={() =>
Alert.alert('Alert', 'onAccessibilityTap success')
}
accessible={true}>
<Text>Accessibility normal tap example</Text>
</View>
<View onMagicTap={() => alert('onMagicTap success')} accessible={true}>
<View
onMagicTap={() => Alert.alert('Alert', 'onMagicTap success')}
accessible={true}>
<Text>Accessibility magic tap example</Text>
</View>
<View accessibilityLabel="Some announcement" accessible={true}>
Expand Down
15 changes: 11 additions & 4 deletions RNTester/js/ActionSheetIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@

const React = require('react');
const ReactNative = require('react-native');
const {ActionSheetIOS, StyleSheet, takeSnapshot, Text, View} = ReactNative;
const {
ActionSheetIOS,
StyleSheet,
takeSnapshot,
Text,
View,
Alert,
} = ReactNative;

const BUTTONS = ['Option 0', 'Option 1', 'Option 2', 'Delete', 'Cancel'];
const DESTRUCTIVE_INDEX = 3;
Expand Down Expand Up @@ -106,7 +113,7 @@ class ShareActionSheetExample extends React.Component<
subject: 'a subject to go in the email heading',
excludedActivityTypes: ['com.apple.UIKit.activity.PostToTwitter'],
},
error => alert(error),
error => Alert.alert('Error', error),
(completed, method) => {
let text;
if (completed) {
Expand Down Expand Up @@ -146,7 +153,7 @@ class ShareScreenshotExample extends React.Component<{}, $FlowFixMeState> {
url: uri,
excludedActivityTypes: ['com.apple.UIKit.activity.PostToTwitter'],
},
error => alert(error),
error => Alert.alert('Error', error),
(completed, method) => {
let text;
if (completed) {
Expand All @@ -158,7 +165,7 @@ class ShareScreenshotExample extends React.Component<{}, $FlowFixMeState> {
},
);
})
.catch(error => alert(error));
.catch(error => Alert.alert('Error', error));
};
}

Expand Down
4 changes: 2 additions & 2 deletions RNTester/js/GeolocationExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

const React = require('react');
const ReactNative = require('react-native');
const {StyleSheet, Text, View} = ReactNative;
const {StyleSheet, Text, View, Alert} = ReactNative;

exports.framework = 'React';
exports.title = 'Geolocation';
Expand Down Expand Up @@ -41,7 +41,7 @@ class GeolocationExample extends React.Component<{}, $FlowFixMeState> {
const initialPosition = JSON.stringify(position);
this.setState({initialPosition});
},
error => alert(JSON.stringify(error)),
error => Alert.alert('Error', JSON.stringify(error)),
{enableHighAccuracy: true, timeout: 20000, maximumAge: 1000},
);
this.watchID = navigator.geolocation.watchPosition(position => {
Expand Down
6 changes: 4 additions & 2 deletions RNTester/js/MultiColumnExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

const React = require('react');
const ReactNative = require('react-native');
const {FlatList, StyleSheet, Text, View} = ReactNative;
const {FlatList, StyleSheet, Text, View, Alert} = ReactNative;

const RNTesterPage = require('./RNTesterPage');

Expand Down Expand Up @@ -91,7 +91,9 @@ class MultiColumnExample extends React.PureComponent<
data={filteredData}
key={this.state.numColumns + (this.state.fixedHeight ? 'f' : 'v')}
numColumns={this.state.numColumns || 1}
onRefresh={() => alert('onRefresh: nothing to refresh :P')}
onRefresh={() =>
Alert.alert('Alert', 'onRefresh: nothing to refresh :P')
}
refreshing={false}
renderItem={this._renderItemComponent}
disableVirtualization={!this.state.virtualized}
Expand Down
6 changes: 4 additions & 2 deletions RNTester/js/TextInputExample.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Button = require('Button');
const InputAccessoryView = require('InputAccessoryView');
const React = require('react');
const ReactNative = require('react-native');
const {Text, TextInput, View, StyleSheet, Slider, Switch} = ReactNative;
const {Text, TextInput, View, StyleSheet, Slider, Switch, Alert} = ReactNative;

class WithLabel extends React.Component<$FlowFixMeProps> {
render() {
Expand Down Expand Up @@ -862,7 +862,9 @@ exports.examples = [
returnKeyType="next"
blurOnSubmit={true}
multiline={true}
onSubmitEditing={event => alert(event.nativeEvent.text)}
onSubmitEditing={event =>
Alert.alert('Alert', event.nativeEvent.text)
}
/>
</View>
);
Expand Down
4 changes: 2 additions & 2 deletions RNTester/js/TransparentHitTestExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

const React = require('react');
const ReactNative = require('react-native');
const {Text, View, TouchableOpacity} = ReactNative;
const {Text, View, TouchableOpacity, Alert} = ReactNative;

class TransparentHitTestExample extends React.Component<{}> {
render() {
return (
<View style={{flex: 1}}>
<TouchableOpacity onPress={() => alert('Hi!')}>
<TouchableOpacity onPress={() => Alert.alert('Alert', 'Hi!')}>
<Text>HELLO!</Text>
</TouchableOpacity>

Expand Down