Skip to content

Commit

Permalink
chore: Dependencies update + formatting
Browse files Browse the repository at this point in the history
Updated the dependencies and formatted the codebase
  • Loading branch information
mmazzarolo committed Apr 25, 2020
1 parent 1681edc commit 214613a
Show file tree
Hide file tree
Showing 12 changed files with 380 additions and 1,086 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -54,7 +54,7 @@ const Example = () => {
setDatePickerVisibility(false);
};

const handleConfirm = date => {
const handleConfirm = (date) => {
console.warn("A date has been picked: ", date);
hideDatePicker();
};
Expand Down Expand Up @@ -112,11 +112,11 @@ You can also display both the datepicker and the timepicker in one step by setti

### I can't set the initial date on the picker

Please make sure you're using the `date` props (and not the `value` one).
Please make sure you're using the `date` props (and not the `value` one).

### The picker shows up twice on Android

This seems to be a known issue of the [`@react-native-community/datetimepicker`](https://github.com/react-native-community/datetimepicker/issues/54). Please see [this thread](https://github.com/react-native-community/datetimepicker/issues/54) for a couple of workarounds.
This seems to be a known issue of the [`@react-native-community/datetimepicker`](https://github.com/react-native-community/datetimepicker/issues/54). Please see [this thread](https://github.com/react-native-community/datetimepicker/issues/54) for a couple of workarounds.

### How do I change the color of the Android date and time pickers?

Expand Down
6 changes: 3 additions & 3 deletions example/App.js
Expand Up @@ -17,7 +17,7 @@ const App = () => {
setPickerMode(null);
};

const handleConfirm = date => {
const handleConfirm = (date) => {
console.warn("A date has been picked: ", date);
hidePicker();
};
Expand All @@ -40,8 +40,8 @@ const style = StyleSheet.create({
root: {
flex: 1,
justifyContent: "center",
alignItems: "center"
}
alignItems: "center",
},
});

export default App;
2 changes: 1 addition & 1 deletion example/babel.config.js
@@ -1,3 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
presets: ["module:metro-react-native-babel-preset"],
};
10 changes: 3 additions & 7 deletions example/index.js
@@ -1,9 +1,5 @@
/**
* @format
*/

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import { AppRegistry } from "react-native";
import App from "./App";
import { name as appName } from "./app.json";

AppRegistry.registerComponent(appName, () => App);
7 changes: 0 additions & 7 deletions example/metro.config.js
@@ -1,10 +1,3 @@
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/

module.exports = {
transformer: {
getTransformOptions: async () => ({
Expand Down
25 changes: 11 additions & 14 deletions package.json
Expand Up @@ -35,15 +35,15 @@
"prop-types": "^15.7.2"
},
"devDependencies": {
"@semantic-release/git": "^8.0.0",
"@semantic-release/git": "^9.0.0",
"eslint": "^6.7.2",
"eslint-config-prettier": "^6.5.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react-app": "^6.2.1",
"husky": "^4.0.10",
"lint-staged": "^9.5.0",
"prettier": "^1.19.1",
"semantic-release": "^16.0.2"
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react-app": "^6.2.2",
"husky": "^4.2.5",
"lint-staged": "^10.1.7",
"prettier": "^2.0.5",
"semantic-release": "^17.0.7"
},
"peerDependencies": {
"@react-native-community/datetimepicker": ">=1.0.0"
Expand All @@ -55,16 +55,13 @@
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"yarn lint:fix",
"git add"
"yarn lint:fix"
],
"*.json": [
"prettier --write",
"git add"
"prettier --write"
],
"*.md": [
"prettier --write",
"git add"
"prettier --write"
]
}
}
38 changes: 19 additions & 19 deletions scripts/examples_postinstall.js
Expand Up @@ -24,32 +24,32 @@
* "postinstall": "node ../scripts/examples_postinstall.js node_modules/react-native-library-name/"
*/

'use strict';
"use strict";

const fs = require('fs');
const path = require('path');
const fs = require("fs");
const path = require("path");

/// Delete all files and directories for the given path
const removeFileDirectoryRecursively = fileDirPath => {
const removeFileDirectoryRecursively = (fileDirPath) => {
// Remove file
if (!fs.lstatSync(fileDirPath).isDirectory()) {
fs.unlinkSync(fileDirPath);
return;
}

// Go down the directory an remove each file / directory recursively
fs.readdirSync(fileDirPath).forEach(entry => {
fs.readdirSync(fileDirPath).forEach((entry) => {
const entryPath = path.join(fileDirPath, entry);
removeFileDirectoryRecursively(entryPath);
});
fs.rmdirSync(fileDirPath);
};

/// Remove example/node_modules/react-native-library-name/node_modules directory
const removeLibraryNodeModulesPath = nodeModulesPath => {
const removeLibraryNodeModulesPath = (nodeModulesPath) => {
if (!fs.existsSync(nodeModulesPath)) {
console.log(
`No node_modules found at ${nodeModulesPath}. Skipping delete.`,
`No node_modules found at ${nodeModulesPath}. Skipping delete.`
);
return;
}
Expand All @@ -66,21 +66,21 @@ const removeLibraryNodeModulesPath = nodeModulesPath => {
const removeLibraryNpmIgnorePaths = (npmIgnorePath, libraryNodeModulesPath) => {
if (!fs.existsSync(npmIgnorePath)) {
console.log(
`No .npmignore found at ${npmIgnorePath}. Skipping deleting content.`,
`No .npmignore found at ${npmIgnorePath}. Skipping deleting content.`
);
return;
}

fs.readFileSync(npmIgnorePath, 'utf8')
fs.readFileSync(npmIgnorePath, "utf8")
.split(/\r?\n/)
.forEach(entry => {
.forEach((entry) => {
if (entry.length === 0) {
return;
}

const npmIgnoreLibraryNodeModulesEntryPath = path.resolve(
libraryNodeModulesPath,
entry,
entry
);
if (!fs.existsSync(npmIgnoreLibraryNodeModulesEntryPath)) {
return;
Expand All @@ -89,11 +89,11 @@ const removeLibraryNpmIgnorePaths = (npmIgnorePath, libraryNodeModulesPath) => {
try {
removeFileDirectoryRecursively(npmIgnoreLibraryNodeModulesEntryPath);
console.log(
`Successfully deleted: ${npmIgnoreLibraryNodeModulesEntryPath}`,
`Successfully deleted: ${npmIgnoreLibraryNodeModulesEntryPath}`
);
} catch (err) {
console.log(
`Error deleting ${npmIgnoreLibraryNodeModulesEntryPath}: ${err.message}`,
`Error deleting ${npmIgnoreLibraryNodeModulesEntryPath}: ${err.message}`
);
}
});
Expand All @@ -110,13 +110,13 @@ const removeLibraryNpmIgnorePaths = (npmIgnorePath, libraryNodeModulesPath) => {
const libraryNodeModulesPath =
process.argv.length > 2
? path.resolve(cwd, process.argv[2])
: path.resolve(cwd, 'node_modules', require('../package.json').name);
: path.resolve(cwd, "node_modules", require("../package.json").name);

console.log('Removing nested node_modules directory...');
const nodeModulesPath = path.resolve(libraryNodeModulesPath, 'node_modules');
console.log("Removing nested node_modules directory...");
const nodeModulesPath = path.resolve(libraryNodeModulesPath, "node_modules");
removeLibraryNodeModulesPath(nodeModulesPath);

console.log('Processing .npmignore entries...');
const npmIgnorePath = path.resolve(__dirname, '../.npmignore');
console.log("Processing .npmignore entries...");
const npmIgnorePath = path.resolve(__dirname, "../.npmignore");
removeLibraryNpmIgnorePaths(npmIgnorePath, libraryNodeModulesPath);
})();
})();
6 changes: 3 additions & 3 deletions src/DateTimePickerModal.android.js
Expand Up @@ -10,17 +10,17 @@ export class DateTimePickerModal extends React.PureComponent {
onConfirm: PropTypes.func.isRequired,
onHide: PropTypes.func,
maximumDate: PropTypes.instanceOf(Date),
minimumDate: PropTypes.instanceOf(Date)
minimumDate: PropTypes.instanceOf(Date),
};

static defaultProps = {
date: new Date(),
isVisible: false,
onHide: () => {}
onHide: () => {},
};

state = {
currentMode: null
currentMode: null,
};

currentDate = this.props.date;
Expand Down

0 comments on commit 214613a

Please sign in to comment.