Skip to content

Commit

Permalink
Replace global.alert use to fix eslint warnings (facebook#22184)
Browse files Browse the repository at this point in the history
Summary:
Replaces `alert` with `Alert.alert` to fix eslint warnings.
Pull Request resolved: facebook#22184

Reviewed By: TheSavior

Differential Revision: D13105636

Pulled By: RSNara

fbshipit-source-id: 82a9e55fd002051e3cf8238e29d37b2b33f66f0e
  • Loading branch information
vcalvello authored and facebook-github-bot committed Nov 20, 2018
1 parent b96c7db commit fad5357
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 15 deletions.
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

0 comments on commit fad5357

Please sign in to comment.