Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_pickImageSource() {
try {
ActionSheet.show({
options: [
"Take Photo", "Pick From Album", "Cancel"
],
cancelButtonIndex: 2,
title: "Testing ActionSheet"
}, buttonIndex => {
// this 'buttonIndex value is a string on android and number on ios :-(
console.log(buttonIndex)
if (buttonIndex + "" === '0') {
this._pickImage(true)
} else if (buttonIndex + "" === '1') {
this._pickImage(false)
} else {
console.log('nothing')
}
})
Platform,
} from 'react-native';
import {
Container,
Button, Icon,
Text,
Header, Title,
Content,
Left, Body, Right,
Form, Label, Input, Picker, Switch,
Item as FormItem,
Spinner
} from 'native-base';
const Item = Picker.Item;
////
// Import BackgroundGeolocation plugin
// Note: normally you will not specify a relative url ../ here. I do this in the sample app
// because the plugin can be installed from 2 sources:
//
// 1. npm: react-native-background-geolocation
// 2. private github repo (customers only): react-native-background-geolocation-android
//
// This simply allows one to change the import in a single file.
import BackgroundGeolocation, {
State,
DeviceSettingsRequest
} from "../react-native-background-geolocation";
import SettingsService from './lib/SettingsService';
handleImage = ({ row, index }) => () => {
const { activeRowIndex, rows = [] } = this.state
ActionSheet.show({
options: ['Delete', 'Cancel'],
cancelButtonIndex: 1,
destructiveButtonIndex: 0,
title: "Delete Image"
}, i => {
if (i === 0) {
// this.changeRowType({ index: activeRowIndex, type: ROW_TYPES.TEXT })
this.removeRow({ index, focusPrev: true })
}
})
}
onPress={onPress}
>
{/* */}
));
};
Button.defaultProps = {
style: undefined,
enabled: true,
onPress: () => null,
title: '',
};
export default ArrowButton;
async populateMap(newEvent) {
try {
await this.props.getEvents();
if (this.props.errors.event) throw this.props.errors.event;
if (newEvent) this.focusMarker(newEvent);
Toast.show({
buttonText: "OK",
text: "Events fetched successfully.",
type: "success"
});
} catch (error) {
console.log("Error rendering map: ", error);
Toast.show({
buttonText: "OK",
text: "Error rendering map.",
type: "danger"
});
}
}
createRoom() {
let navigate = this.props.navigation.navigate;
if (this.state.name) {
const roomName = this.state.name;
const playerName = this.props.navigation.state.params.playerName;
socket.emit(CREATE_ROOM, roomName, playerName);
this.setState({ name: '' });
navigate('Lobby', { room: this.state.name, playerName });
} else {
Toast.show({
text: 'Please Enter Room Name!',
buttonText: 'Okay'
});
}
}
handleChange(text) {
createRoom() {
if (this.state.name) {
this.props.navigation.state.params.socket.emit(
'createRoom',
this.state.name
);
Toast.show({
text: 'Room Created!',
position: 'top',
buttonText: 'Okay'
});
} else {
Toast.show({
text: 'Please Enter Room Name!',
buttonText: 'Okay'
});
}
}
handleChange(text) {
delete () {
ActionSheet.show({
options: ['Delete', 'Cancel'],
cancelButtonIndex: 1,
destructiveButtonIndex: 0,
title: 'Do you really want to delete this entry?'
},
(buttonIndex) => {
if (buttonIndex === 0) {
Passwords.deleteItem(this.state.item.id)
.then(() => this.goBack())
.catch((err) => {
if (__DEV__) console.log('err', err)
})
}
})
}
}
const response = await userServices.put(data);
if (response instanceof Error) throw response;
const loginResponse = await authServices.login({
username: response.data.email,
password: values.newPassword2
});
if (loginResponse instanceof Error) throw new Error("Error logging in with new password.");
asyncStore.save("user", JSON.stringify(loginResponse));
this.clearForm(resetForm);
this.props.navigation.navigate("SettingsPage", {
refresh: true
});
Toast.show({
buttonText: "OK",
text: "Password change successful.",
type: "success"
});
} catch (error) {
Toast.show({
buttonText: "OK",
text: "Error changing password: " + (error.message || error),
type: "danger"
});
}
};