Skip to content

Commit

Permalink
Disable push token on simulators
Browse files Browse the repository at this point in the history
  • Loading branch information
robertying committed Jun 6, 2020
1 parent a2a4574 commit 6e2e7f4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/screens/NoticeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
} from '../helpers/notification';
import DateTimePicker from '@react-native-community/datetimepicker';
import Modal from 'react-native-modal';
import Device from 'react-native-device-info';
import Button from '../components/Button';
import {removeTags} from '../helpers/html';
import Snackbar from 'react-native-snackbar';
Expand All @@ -74,8 +75,10 @@ const NoticeScreen: INavigationScreen = (props) => {

useEffect(() => {
(async () => {
const token = await Notifications.getDevicePushTokenAsync();
updateDeviceToken(token.data);
if (!Device.isEmulatorSync()) {
const token = await Notifications.getDevicePushTokenAsync();
updateDeviceToken(token.data);
}
})();
}, []);

Expand Down

0 comments on commit 6e2e7f4

Please sign in to comment.