Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
refactor: Replace JavaScript with TypeScript and AndroidX support
  • Loading branch information
Johan-dutoit authored Jul 9, 2019
1 parent 8de2847 commit 11dcf31
Show file tree
Hide file tree
Showing 46 changed files with 1,340 additions and 2,630 deletions.
4 changes: 0 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,4 @@ jobs:
name: Yarn Install
command: |
yarn install --frozen-lockfile --no-progress --non-interactive --cache-folder ~/.cache/yarn
- run:
name: Flow
command: |
yarn flow
- save_cache: *save-cache-yarn
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
typings
node_modules
example/android-bundle.js
example/ios-bundle.js

# generated by bob
lib
52 changes: 52 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/

const typescriptEslintRecommended = require('@typescript-eslint/eslint-plugin/dist/configs/recommended.json');
const typescriptEslintPrettier = require('eslint-config-prettier/@typescript-eslint');

module.exports = {
extends: ['@react-native-community'],
overrides: [
{
files: ['*.ts', '*.tsx'],
// Apply the recommended Typescript defaults and the prettier overrides to all Typescript files
rules: Object.assign(
typescriptEslintRecommended.rules,
typescriptEslintPrettier.rules,
{
'@typescript-eslint/explicit-member-accessibility': 'off',
},
),
},
{
files: ['example/**/*.ts', 'example/**/*.tsx'],
rules: {
// Turn off rules which are useless and annoying for the example files files
'@typescript-eslint/explicit-function-return-type': 'off',
'react-native/no-inline-styles': 'off',
},
},
{
files: ['**/__tests__/**/*.ts', '**/*.spec.ts'],
env: {
jest: true,
},
rules: {
// Turn off rules which are useless and annoying for unit test files
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
{
files: ['*.ts', '*.tsx'],
rules: {
'no-dupe-class-members': 'off',
},
},
],
};
69 changes: 0 additions & 69 deletions .flowconfig

This file was deleted.

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pbxproj -text
67 changes: 44 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
### Android Studio ###
.idea/
.gradle/
local.properties
# OSX
#
.DS_Store

### Xcode ###
# node.js
#
node_modules/
npm-debug.log
yarn-error.log

## Build generated
build/
DerivedData/

## Various settings
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
Expand All @@ -18,23 +20,42 @@ DerivedData/
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
xcuserdata
*.xccheckout
*.xcscmblueprint
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

### /Xcode ###
# CocoaPods
/ios/Pods/

### OS X
.DS_Store
# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

### Node
node_modules
*.log
# BUCK
buck-out/
\.buckd/
debug.keystore

## Android iml
*.iml
# Editor config
.vscode

# Outputs
coverage

.tmp
example/android-bundle.js
example/ios-bundle.js
index.android.bundle
index.ios.bundle

.vscode/
# generated by bob
lib/
6 changes: 4 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"trailingComma": "all",
"requirePragma": true,
"singleQuote": true,
"arrowParens": "always"
"trailingComma": "all",
"bracketSpacing": false,
"jsxBracketSameLine": true
}
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Global owners
* @johan-dutoit @janicduplessis
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contributing to React Native ImagePicker

## Development Process
All work on React Native ImagePicker happens directly on GitHub. Contributors send pull requests which go through a review process.

> **Working on your first pull request?** You can learn how from this *free* series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
1. Fork the repo and create your branch from `master` (a guide on [how to fork a repository](https://help.github.com/articles/fork-a-repo/)).
2. Run `yarn` or `npm install` to install all required dependencies.
3. Now you are ready to make your changes!

## Tests & Verifications
Currently we use `TypeScript` for typechecking, `eslint` with `prettier` for linting and formatting the code, and `jest` for unit testing.

* `yarn test`: Run all tests and validations.
* `yarn validate:android`: Run Spotless style checker on the Java code.
* `yarn validate:eslint`: Run `eslint`.
* `yarn validate:eslint --fix`: Run `eslint` and automatically fix issues. This is useful for correcting code formatting.
* `yarn validate:typescript`: Run `typescript` typechecking.
* `yarn test:jest`: Run unit tests with `jest`.

## Sending a pull request
When you're sending a pull request:

* Prefer small pull requests focused on one change.
* Verify that all tests and validations are passing.
* Follow the pull request template when opening a pull request.

## Commit message convention
We prefix our commit messages with one of the following to signify the kind of change:

* **build**: Changes that affect the build system or external dependencies.
* **ci**, **chore**: Changes to our CI configuration files and scripts.
* **docs**: Documentation only changes.
* **feat**: A new feature.
* **fix**: A bug fix.
* **perf**: A code change that improves performance.
* **refactor**: A code change that neither fixes a bug nor adds a feature.
* **style**: Changes that do not affect the meaning of the code.
* **test**: Adding missing tests or correcting existing tests.

## Release process
We use [Semantic Release](http://semantic-release.org) to automatically release new versions of the library when changes are merged into master. Using the commit message convention described above, it will detect if we need to release a patch, minor, or major version of the library.

## Reporting issues
You can report issues on our [bug tracker](https://github.com/react-native-community/react-native-ImagePicker/issues). Please search for existing issues and follow the issue template when opening an issue.

## License
By contributing to React Native ImagePicker, you agree that your contributions will be licensed under the **MIT** license.
6 changes: 3 additions & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)
MIT License

Copyright (c) 2015 Marc Shilling
Copyright (c) 2015-present, Facebook, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ A React Native module that allows you to use native UI to select a photo/video f

This library started as a basic bridge of the native iOS image picker, and I want to keep it that way. As such, functionality beyond what the native `UIImagePickerController` supports will not be supported here. **Multiple image selection, more control over the crop tool, and landscape support** are things missing from the native iOS functionality - **not issues with my library**. If you need these things, [react-native-image-crop-picker](https://github.com/ivpusic/react-native-image-crop-picker) might be a better choice for you.

## React Native Compatibility
To use this library you need to ensure you are using the correct version of React Native. If you are using a version of React Native that is lower than `0.57` you will need to upgrade that before attempting to use this library.

| `@react-native-community/netinfo` version | Required React Native Version |
| ----------------------------------------- | --------------------------------------------------------------------------------- |
| `1.x.x` | `>= 0.60` or `>= 0.59` if using [Jetifier](https://github.com/mikehardy/jetifier) |
| `0.x.x` | `<= 0.59` |


## Getting Started

```
Expand Down
Loading

0 comments on commit 11dcf31

Please sign in to comment.