This repository has been archived by the owner on May 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 656a48d
Showing
18 changed files
with
9,353 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["react-native"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
dist/ | ||
jest-setup.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# React Navigation Web | ||
|
||
[![npm version](https://badge.fury.io/js/%40react-navigation%2Fweb.svg)](https://badge.fury.io/js/%40react-navigation%2Fweb) [![CircleCI badge](https://circleci.com/gh/react-navigation/react-navigation-web/tree/master.svg?style=shield)](https://circleci.com/gh/react-navigation/react-navigation-web/tree/master) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://reactnavigation.org/docs/contributing.html) | ||
|
||
## Docs | ||
|
||
Documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/* eslint-disable import/no-commonjs */ | ||
|
||
module.exports = require('./dist/navigators/createBrowserApp'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/* eslint-disable import/no-commonjs */ | ||
|
||
module.exports = require('./dist/handleServerRequest'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* eslint-env jest | ||
*/ | ||
|
||
// No setup | ||
|
||
import React from 'react'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{ | ||
"name": "@react-navigation/web", | ||
"version": "1.0.0-alpha.0", | ||
"description": "Tools for react-navigation on web browsers and servers", | ||
"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-web.git" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/react-navigation/react-navigation-web/issues" | ||
}, | ||
"homepage": "https://github.com/react-navigation/react-navigation-web#readme", | ||
"dependencies": { | ||
"@react-navigation/core": "^3.0.0-alpha.5", | ||
"history": "^4.7.2", | ||
"query-string": "^6.2.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.55.4", | ||
"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/core)" | ||
] | ||
}, | ||
"prettier": { | ||
"trailingComma": "es5", | ||
"singleQuote": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`SwitchNavigator works on web renders successfully 1`] = ` | ||
<div> | ||
Other Screen | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React, { Component } from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import { createSwitchNavigator } from '@react-navigation/core'; | ||
import createBrowserApp from '../createBrowserApp'; | ||
|
||
class HomeScreen extends Component { | ||
static navigationOptions = () => ({ | ||
title: 'Home', | ||
}); | ||
|
||
render() { | ||
return <div>Hello Home</div>; | ||
} | ||
} | ||
|
||
class OtherScreen extends Component { | ||
static navigationOptions = () => ({ | ||
title: 'Other', | ||
}); | ||
|
||
render() { | ||
return <div>Other Screen</div>; | ||
} | ||
} | ||
|
||
jest.mock('history', () => ({ | ||
createBrowserHistory: () => ({ | ||
push: () => {}, | ||
listen: () => {}, | ||
location: { | ||
pathname: '/OtherScreen', | ||
search: '?foo=bar', | ||
}, | ||
}), | ||
})); | ||
|
||
global.document = { | ||
title: 'Empty Title', | ||
}; | ||
|
||
describe('SwitchNavigator works on web', () => { | ||
test('renders successfully', () => { | ||
const AppNavigator = createSwitchNavigator({ | ||
HomeScreen, | ||
OtherScreen, | ||
}); | ||
const App = createBrowserApp(AppNavigator); | ||
const rendered = renderer.create(<App />).toJSON(); | ||
|
||
expect(rendered).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.