Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default ImgManipulator
ImgManipulator.defaultProps = {
onPictureChoosed: ({ uri, base64 }) => console.log('URI:', uri, base64),
btnTexts: {
crop: 'Crop',
rotate: 'Rotate',
done: 'Done',
processing: 'Processing',
},
dragVelocity: 100,
resizeVelocity: 50,
saveOptions: {
compress: 1,
format: ImageManipulator.SaveFormat.PNG,
base64: false,
},
}
ImgManipulator.propTypes = {
isVisible: PropTypes.bool.isRequired,
onPictureChoosed: PropTypes.func,
btnTexts: PropTypes.object,
saveOptions: PropTypes.object,
photo: PropTypes.object.isRequired,
onToggleModal: PropTypes.func.isRequired,
dragVelocity: PropTypes.number,
resizeVelocity: PropTypes.number,
}
const check = (props.calendars || []).find(
calendar => calendar.date === state.input.date
);
if (check) {
Alert.alert('同じ日にスケジュールが既に登録されています');
return;
}
}
let image = '';
if (state.image) {
const manipResult = await ImageManipulator.manipulateAsync(
state.image,
[{ rotate: 0 }, { flip: ImageManipulator.FlipType.Vertical }],
{ compress: 1, format: ImageManipulator.SaveFormat.PNG, base64: true }
);
image = manipResult.base64 || '';
}
db.transaction((tx: SQLite.Transaction) => {
const item: Item = {
title: state.input.title,
kind: state.kind || getKind(state.input.title),
image,
};
insertItem(tx, item, save);
});
}, [
props.calendars,
_rotate = async (deg: number) => {
await this._manipulate([{ rotate: deg }], {
format: ImageManipulator.SaveFormat.PNG,
});
}