Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

Commit

Permalink
Copy from react-navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvicenti committed Oct 11, 2018
0 parents commit a06f602
Show file tree
Hide file tree
Showing 68 changed files with 17,750 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["react-native"]
}
62 changes: 62 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
version: 2

defaults: &defaults
docker:
- image: circleci/node:7.10
working_directory: ~/project

jobs:
install-dependencies:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/project
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- restore_cache:
keys:
- v1-dependencies-example-{{ checksum "example/package.json" }}
- v1-dependencies-example-
- run: |
yarn install
yarn install --cwd example
- save_cache:
key: v1-dependencies-{{ checksum "package.json" }}
paths: node_modules
- save_cache:
key: v1-dependencies-example-{{ checksum "example/package.json" }}
paths: example/node_modules
- persist_to_workspace:
root: .
paths: .
lint:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- run: |
yarn run lint
unit-tests:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- run: yarn test -- --coverage
- store_artifacts:
path: coverage
destination: coverage

workflows:
version: 2
build-and-test:
jobs:
- install-dependencies
- lint:
requires:
- install-dependencies
- unit-tests:
requires:
- install-dependencies
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]

# change these settings to your own preference
indent_style = space
indent_size = 2

# we recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
jest-setup.js
16 changes: 16 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "eslint-config-satya164",

"plugins": ["react-native-globals"],

"env": {
"es6": true,
"react-native-globals/all": true,
},

"rules": {
"import/no-unresolved": "off",
"react/sort-comp": "off",
"jest/no-disabled-tests": "off",
}
}
53 changes: 53 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# OSX
#
.DS_Store

# XDE
.expo/

# VSCode
.vscode/
tsconfig.json
jsconfig.json

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IJ
#
.idea
.gradle
local.properties

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

# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore

# Build
dist/
15 changes: 15 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"increment": "conventional:angular",
"changelogCommand": "conventional-changelog -p angular | tail -n +3",
"safeBump": false,
"src": {
"commitMessage": "chore: release %s",
"tagName": "v%s"
},
"npm": {
"publish": true
},
"github": {
"release": true
}
}
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 React Native Community

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
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.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# React Navigation Core

[![CircleCI badge](https://circleci.com/gh/react-navigation/react-navigation-core/tree/master.svg?style=shield)](https://circleci.com/gh/react-navigation/react-navigation-core/tree/master)


## Docs

Documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/).
7 changes: 7 additions & 0 deletions jest-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* eslint-env jest
*/

// No setup

import React from 'react';
90 changes: 90 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"name": "@react-navigation/core",
"version": "3.0.0-alpha.1",
"description": "Core utilities for the react-navigation framework",
"main": "dist/index.js",
"files": [
"dist/",
"src/",
"LICENSE.md",
"README.md"
],
"react-native": "src/index.js",
"scripts": {
"test": "jest",
"lint": "eslint .",
"format": "eslint . --fix",
"build": "babel --no-babelrc --plugins=syntax-jsx,syntax-class-properties,syntax-object-rest-spread,transform-flow-strip-types src --copy-files --out-dir dist --ignore '**/__tests__/**'",
"prepare": "yarn build",
"release": "release-it"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"keywords": [
"react-navigation",
"routing",
"ios",
"android",
"stack"
],
"repository": {
"type": "git",
"url": "git+https://github.com/react-navigation/react-navigation-core.git"
},
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/react-navigation/react-navigation-core/issues"
},
"homepage": "https://github.com/react-navigation/react-navigation-core#readme",
"dependencies": {
"hoist-non-react-statics": "^3.0.1",
"path-to-regexp": "^2.4.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-jest": "^22.4.1",
"babel-plugin-syntax-class-properties": "^6.13.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-syntax-object-rest-spread": "^6.13.0",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-preset-react-native": "^4.0.0",
"conventional-changelog-cli": "^2.0.5",
"eslint": "^4.12.1",
"eslint-config-satya164": "^1.0.1",
"eslint-plugin-react-native-globals": "^0.1.0",
"husky": "^0.14.3",
"jest": "^22.1.3",
"jest-expo": "^30.0.0",
"prettier": "^1.8.2",
"react": "16.3.1",
"react-dom": "16.3.1",
"react-native": "^0.57.2",
"react-test-renderer": "16.3.1",
"release-it": "^7.6.1"
},
"peerDependencies": {
"react": "*"
},
"jest": {
"preset": "react-native",
"testRegex": "/__tests__/[^/]+-test\\.js$",
"setupFiles": [
"<rootDir>/jest-setup.js"
],
"coveragePathIgnorePatterns": [
"jest-setup.js"
],
"modulePathIgnorePatterns": [
"<rootDir>/example/"
],
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|react-clone-referenced-element|react-navigation-deprecated-tab-navigator|react-navigation)"
]
},
"prettier": {
"trailingComma": "es5",
"singleQuote": true
}
}
57 changes: 57 additions & 0 deletions src/NavigationActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const BACK = 'Navigation/BACK';
const INIT = 'Navigation/INIT';
const NAVIGATE = 'Navigation/NAVIGATE';
const SET_PARAMS = 'Navigation/SET_PARAMS';

const back = (payload = {}) => ({
type: BACK,
key: payload.key,
immediate: payload.immediate,
});

const init = (payload = {}) => {
const action = {
type: INIT,
};
if (payload.params) {
action.params = payload.params;
}
return action;
};

const navigate = payload => {
const action = {
type: NAVIGATE,
routeName: payload.routeName,
};
if (payload.params) {
action.params = payload.params;
}
if (payload.action) {
action.action = payload.action;
}
if (payload.key) {
action.key = payload.key;
}
return action;
};

const setParams = payload => ({
type: SET_PARAMS,
key: payload.key,
params: payload.params,
});

export default {
// Action constants
BACK,
INIT,
NAVIGATE,
SET_PARAMS,

// Action creators
back,
init,
navigate,
setParams,
};
Loading

0 comments on commit a06f602

Please sign in to comment.