Compare commits

..

5 Commits

Author SHA1 Message Date
Eric Vicenti
0ea01673e5 transitioner2
Introducing a wild and hacky prototype of Transitioner 2!

- "transitionProps" concept is now identical to transitioner.state
- Far simpler state management than before
- Descriptors only, no "scenes"
- No more "position"

Also, StackView is seeing improvements:
- Easier to understand when "transition props" are just this.props

- StackView only renders the current sceen and the one before it

Currently broken:
- Interpolation configuration, beyond the first push
- Attempting to move away from getSceneIndicesForInterpolationInputRange because it works with position and it is confusing as hell, but haven't worked around it yet
- Gestures, although some "backProgress" code is in the works
- Interpolation is super buggy
- onTransitionStart/End
- Header, although a lot of code is moved over
2018-03-11 00:11:58 -08:00
Brent Vatne
71adb7cc4f Update DrawerView.js 2018-03-06 14:22:31 -08:00
Eric Vicenti
77343cb096 Merge branch 'master' into @ericvicenti/drawer-fix 2018-03-06 11:43:25 -08:00
Brent Vatne
accee76951 Merge branch 'master' into @ericvicenti/drawer-fix 2018-03-05 16:23:10 -08:00
Eric Vicenti
bbb8c4d8d3 Fix issue in drawer actions 2018-03-05 11:38:13 -08:00
280 changed files with 41219 additions and 16770 deletions

View File

@@ -1,11 +1,40 @@
version: 3
version: 2
jobs:
build:
docker:
- image: circleci/node:10
- image: reactcommunity/node-ci:8.4.0-0 # custom image -- includes ocaml, libelf1, Yarn
parallelism: 2
working_directory: ~/react-navigation
steps:
- checkout
- run: yarn install --frozen-lockfile
- run: ./scripts/test.sh
- restore_cache:
# cache by branch + package.json, by branch, and then master
keys:
- v3-react-navigation-{{ .Branch }}-{{ checksum "package.json" }}
- v3-react-navigation-{{ .Branch }}
- v3-react-navigation-master
- run: yarn # install root deps
- run: ./scripts/test.sh # run tests
- setup_remote_docker
- deploy:
command: |
set -x
VER="17.03.0-ce"
curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
mv /tmp/docker/* /usr/bin
yarn global add exp
set +x
exp login -u "$EXPO_USERNAME" -p "$EXPO_PASSWORD"
set -x
cd examples/NavigationPlayground && yarn && exp publish --release-channel "${CIRCLE_SHA1}"
- save_cache:
key: v3-react-navigation-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- ~/.cache/yarn
- ~/react-navigation/examples/NavigationPlayground/node_modules
- ~/react-navigation/examples/ReduxExample/node_modules
notify:
webhooks:
- url: https://react-navigation-ci.now.sh

View File

@@ -7,18 +7,18 @@
"prettier/react"
],
"parser": "babel-eslint",
"plugins": ["react", "prettier"],
"plugins": [
"react",
"prettier"
],
"env": {
"jasmine": true
},
"rules": {
"prettier/prettier": [
"error",
{
"trailingComma": "es5",
"singleQuote": true
}
],
"prettier/prettier": ["error", {
"trailingComma": "es5",
"singleQuote": true
}],
"no-underscore-dangle": "off",
"no-use-before-define": "off",
@@ -27,20 +27,24 @@
"no-plusplus": "off",
"no-class-assign": "off",
"no-duplicate-imports": "off",
"import/extensions": "off",
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off",
"react/jsx-filename-extension": ["off", { "extensions": [".js", ".jsx"] }],
"react/jsx-filename-extension": [
"off", { "extensions": [".js", ".jsx"] }
],
"react/sort-comp": "off",
"react/prefer-stateless-function": "off",
"react/no-deprecated": "off",
"react/forbid-prop-types": "warn",
"react/prop-types": "off",
"react/require-default-props": "off",
"react/no-unused-prop-types": "off"
"react/no-unused-prop-types": "off",
},
"settings": {
},
"parserOptions": {
"ecmaVersion": 6,

View File

@@ -25,7 +25,7 @@ Bugs with react-navigation must be reproducible *without any external libraries
### How to reproduce
- You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repository as that is outside of the scope of React Navigation.
- You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repoistory as that is outside of the scope of Rect Navigation.
- Either re-create the bug on [Snack](https://snack.expo.io) or link to a GitHub repository with code that reproduces the bug.
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.

View File

@@ -1,21 +1,17 @@
Please provide enough information so that others can review your pull request:
## Motivation
Explain the **motivation** for making this change. What existing problem does the pull request solve?
## Test plan
Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise split it.
Demonstrate the code is solid. Example: the exact commands you ran and their output, screenshots / videos if the pull request changes UI.
**Test plan (required)**
Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.
Make sure you test on both platforms if your change affects both platforms.
The code must pass tests.
## Code formatting
**Code formatting**
Look around. Match the style of the rest of the codebase. Run `yarn format` before committing.
## Changelog
Add an entry under the "Unreleased" heading in [CHANGELOG.md](https://github.com/react-navigation/react-navigation/blob/master/CHANGELOG.md#unreleased) which explains your change.
Look around. Match the style of the rest of the codebase.

View File

@@ -1,15 +0,0 @@
{
"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
}
}

View File

@@ -1,215 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [3.5.0] - [2019-03-19](https://github.com/react-navigation/react-navigation/releases/tag/3.5.0)
## Fixed
- Fixed types for `BottomTabBar`
- export `NavigationContext` type
## Changed
- Make 'react-native-gesture-handler' a peer dependency rather than a hard dependency
## [3.4.1] - [2019-03-16](https://github.com/react-navigation/react-navigation/releases/tag/3.4.1)
## Fixed
- Fix missing TypeScript definitions file in release package
## [3.4.0] - [2019-03-15](https://github.com/react-navigation/react-navigation/releases/tag/3.4.0)
## Added
- TypeScript type definition now included in the project.
- Better support for react-native-web in core and stack.
## Fixed
- Default key to null in stack reset action (https://github.com/react-navigation/react-navigation-core/commit/59238160d86284a3353d53af10688fcf3f36004f)
- Fix header back button label and title label scaling. Defaults to false. (https://github.com/react-navigation/react-navigation-stack/commit/c1f1dff465e9eebe274a08e274cf10570045fa23)
## Changed
- Remove react-lifecycles-compat from @react-navigation/core
- NavigationPlayground uses TypeScript
## [3.3.2] - [2019-02-25](https://github.com/react-navigation/react-navigation/releases/tag/3.3.2)
## Fixed
- Updated Flow types (https://github.com/react-navigation/react-navigation/commit/d3040e52b39bc8e91ffc1354d9c5f8c096baf597)
## [3.3.1] - [2019-02-25](https://github.com/react-navigation/react-navigation/releases/tag/3.3.1)
## Fixed
- SafeAreaView bottom inset on iPhone XR and XS fixed. (https://github.com/react-navigation/react-navigation/issues/5625)
## [3.3.0] - [2019-02-16](https://github.com/react-navigation/react-navigation/releases/tag/3.3.0)
## Added
- Pass through `drawerOpenProgress` to drawer content component (https://github.com/react-navigation/react-navigation-drawer/pull/40)
## [3.2.3] - [2019-02-09](https://github.com/react-navigation/react-navigation/releases/tag/3.2.3)
## Fixed
- `await` the result of `onTransitionStart` before starting the transition (https://github.com/react-navigation/react-navigation-stack/pull/79)
## [3.2.2]
- Oops, I skipped it. Nothing here.
## [3.2.1] - [2019-02-09](https://github.com/react-navigation/react-navigation/releases/tag/3.2.1)
## Fixed
- Remove accidental console.log
## [3.2.0] - [2019-02-08](https://github.com/react-navigation/react-navigation/releases/tag/3.2.0)
## Added
- Add support for `backBehavior: history'` and `backBehavior: 'order'` to any navigator based on SwitchRouter (eg: tab navigators). (https://github.com/react-navigation/react-navigation-core/pull/31)
## [3.1.5] - [2019-02-06](https://github.com/react-navigation/react-navigation/releases/tag/3.1.5)
## Fixed
- Revert "Transparent header measurement fix (https://github.com/react-navigation/react-navigation-stack/pull/71)"
## [3.1.4] - [2019-02-05](https://github.com/react-navigation/react-navigation/releases/tag/3.1.4)
## Fixed
- Fix references to onGestureFinish in StackViewLayout, should be onGestureEnd
## [3.1.3] - [2019-02-04](https://github.com/react-navigation/react-navigation/releases/tag/3.1.3)
## Fixed
- Stack navigator properly dismisses and restores keyboard when gesture starts and is cancelled
- Transparent header measurement fix (https://github.com/react-navigation/react-navigation-stack/pull/71)
## [3.1.2] - [2019-02-01](https://github.com/react-navigation/react-navigation/releases/tag/3.1.2)
## Fixed
- Update flow definition for `withNavigation` and `withNavigationFocus` to support `defaultProps`
- Prevent onRef callback be called twice on withNavigationFocus components (https://github.com/react-navigation/react-navigation-core/pull/30)
- Bump react-navigation-drawer version to improve performance - if you use Expo, you will need expo@^32.0.3 to update!
## [3.0.9] - [2018-12-19](https://github.com/react-navigation/react-navigation/releases/tag/3.0.9)
## Fixed
- Intermittent flicker when changing tabs while using react-native-screens fixed by not changing opacity (https://github.com/react-navigation/react-navigation-tabs/pull/80)
- Prevent fading the previous screen on push/pop on Android (https://github.com/react-navigation/react-navigation-stack/pull/73)
## [3.0.8] - [2018-12-08](https://github.com/react-navigation/react-navigation/releases/tag/3.0.8)
## Changed
- Lock create-react-context to 0.2.2
## [3.0.7] - [2018-12-08](https://github.com/react-navigation/react-navigation/releases/tag/3.0.7)
## Changed
- Optimize stack gesture to avoid a setState and reduce unnecessary Animated node creation (https://github.com/react-navigation/react-navigation-stack/pull/70)
## [3.0.6] - [2018-12-06](https://github.com/react-navigation/react-navigation/releases/tag/3.0.6)
## Fixes
- Fix drawer accessibility label when drawer label is not a string
## [3.0.5] - [2018-12-03](https://github.com/react-navigation/react-navigation/releases/tag/3.0.5)
## Fixes
- Fix crash in rare case where onNavigationStateChange on container leads to setState and container has screenProps (https://github.com/react-navigation/react-navigation/issues/5301)
- Expose underlaying ScrollView methods to NavigationAwareScrollable (https://github.com/react-navigation/react-navigation-native/pull/8)
## [3.0.4] - [2018-11-30](https://github.com/react-navigation/react-navigation/releases/tag/3.0.4)
## Changed
- Lock dependencies to exact versions
## Fixes
- Fix crash when screenInterpolator is null (https://github.com/react-navigation/react-navigation-stack/issues/64)
- Fix renderPager override (https://github.com/react-navigation/react-navigation-tabs/pull/70)
## Added
- Accessibility labels on drawer items (https://github.com/react-navigation/react-navigation-drawer/pull/30)
## [3.0.3] - [2018-11-30](https://github.com/react-navigation/react-navigation/releases/tag/3.0.3)
## Fixes
- Fix bug where if you navigate immediately when the navigator is first mounted the stack could get in an invalid state.
- Transparent stack card factors in header height now, even though you probably won't want to use this.
- Fix bug where shadow was still rendered on transparent stack
- Fix gestureResponseDistance custom values being ignored for modal stack
## [3.0.2] - [2018-11-27](https://github.com/react-navigation/react-navigation/releases/tag/3.0.2)
## Fixes
- Fix `drawerLockMode` on drawer navigator
- Fix RTL support in drawer navigator
## [3.0.1] - [2018-11-26](https://github.com/react-navigation/react-navigation/releases/tag/3.0.1)
## Fixes
- fix NavigationTestUtils.js deprecated file import.
- Update `getParam` flow typings to check `key` and `fallback` arguments, as well as return the correct type automatically.
- Fix regression in backgroundColor on cardStyle for stack navigator.
## [3.0.0] - [2018-11-17](https://github.com/react-navigation/react-navigation/releases/tag/3.0.0)
- Changes between the latest 2.x release and 3.0.0 are listed on the blog at https://reactnavigation.org/blog/2018/11/17/react-navigation-3.0.html
# [Previous major versions]
- [2.x](https://github.com/react-navigation/react-navigation/blob/2.x/CHANGELOG.md)
[Unreleased]: https://github.com/react-navigation/react-navigation/compare/3.5.0...HEAD
[3.5.0]: https://github.com/react-navigation/react-navigation/compare/3.4.1...3.5.0
[3.4.1]: https://github.com/react-navigation/react-navigation/compare/3.4.0...3.4.1
[3.4.0]: https://github.com/react-navigation/react-navigation/compare/3.3.2...3.4.0
[3.3.2]: https://github.com/react-navigation/react-navigation/compare/3.3.1...3.3.2
[3.3.1]: https://github.com/react-navigation/react-navigation/compare/3.3.0...3.3.1
[3.3.0]: https://github.com/react-navigation/react-navigation/compare/3.2.3...3.3.0
[3.2.3]: https://github.com/react-navigation/react-navigation/compare/3.2.1...3.2.3
[3.2.1]: https://github.com/react-navigation/react-navigation/compare/3.2.0...3.2.1
[3.2.0]: https://github.com/react-navigation/react-navigation/compare/3.1.5...3.2.0
[3.1.5]: https://github.com/react-navigation/react-navigation/compare/3.1.4...3.1.5
[3.1.4]: https://github.com/react-navigation/react-navigation/compare/3.1.3...3.1.4
[3.1.3]: https://github.com/react-navigation/react-navigation/compare/3.1.2...3.1.3
[3.1.2]: https://github.com/react-navigation/react-navigation/compare/3.0.9...3.1.2
[3.0.9]: https://github.com/react-navigation/react-navigation/compare/3.0.8...3.0.9
[3.0.8]: https://github.com/react-navigation/react-navigation/compare/3.0.7...3.0.8
[3.0.7]: https://github.com/react-navigation/react-navigation/compare/3.0.6...3.0.7
[3.0.6]: https://github.com/react-navigation/react-navigation/compare/3.0.5...3.0.6
[3.0.5]: https://github.com/react-navigation/react-navigation/compare/3.0.4...3.0.5
[3.0.4]: https://github.com/react-navigation/react-navigation/compare/3.0.3...3.0.4
[3.0.3]: https://github.com/react-navigation/react-navigation/compare/3.0.2...3.0.3
[3.0.2]: https://github.com/react-navigation/react-navigation/compare/3.0.1...3.0.2
[3.0.1]: https://github.com/react-navigation/react-navigation/compare/3.0.0...3.0.1
[3.0.0]: https://github.com/react-navigation/react-navigation/compare/2.x...3.0.0

View File

@@ -1,7 +0,0 @@
import { _TESTING_ONLY_reset_container_count } from '@react-navigation/native/src/createAppContainer';
export default {
resetInternalState: () => {
_TESTING_ONLY_reset_container_count();
},
};

View File

@@ -1,12 +1,22 @@
# React Navigation
[![npm version](https://badge.fury.io/js/react-navigation.svg)](https://badge.fury.io/js/react-navigation) [![CircleCI badge](https://circleci.com/gh/react-navigation/react-navigation/tree/master.svg?style=shield)](https://circleci.com/gh/react-navigation/react-navigation/tree/master) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://reactnavigation.org/docs/contributing.html)
[![npm version](https://badge.fury.io/js/react-navigation.svg)](https://badge.fury.io/js/react-navigation) [![codecov](https://codecov.io/gh/react-community/react-navigation/branch/master/graph/badge.svg)](https://codecov.io/gh/react-community/react-navigation) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://reactnavigation.org/docs/guides/contributors)
React Navigation is born from the React Native community's need for an extensible yet easy-to-use navigation solution based on Javascript.
## Installation
See: https://reactnavigation.org/docs/en/getting-started.html
Since the library is a JS-based solution, to install the latest version of react-navigation you only need to run:
```bash
yarn add react-navigation
```
or
```bash
npm install --save react-navigation
```
## Documentation
@@ -45,4 +55,4 @@ This library has adopted a Code of Conduct that we expect project participants t
## License
React Navigation is licensed under the [BSD 2-clause "Simplified" License](https://github.com/react-community/react-navigation/blob/master/LICENSE).
React-navigation is licensed under the [BSD 2-clause "Simplified" License](https://github.com/react-community/react-navigation/blob/master/LICENSE).

View File

@@ -1,12 +0,0 @@
/**
* This file is needed to hijack asset imports so that test files don't attempt
* to import them as JavaScript modules.
* See https://github.com/facebook/jest/issues/2663#issuecomment-317109798
*/
const path = require('path');
module.exports = {
process(src, filename, config, options) {
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
},
};

View File

@@ -1,3 +1,17 @@
{
"presets": ["module:metro-react-native-babel-preset"]
"presets": [
"babel-preset-expo"
],
"env": {
"development": {
"plugins": [
"transform-react-jsx-source"
],
},
"production": {
"plugins": [
"transform-remove-console"
]
}
}
}

View File

@@ -1,6 +0,0 @@
[android]
target = Google Inc.:Google APIs:23
[maven_repositories]
central = https://repo1.maven.org/maven2

View File

@@ -0,0 +1,83 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
; Ignore polyfills
.*/Libraries/polyfills/.*
.*/react-navigation/node_modules/.*
; Additional create-react-native-app ignores
; Ignore duplicate module providers
.*/node_modules/fbemitter/lib/*
; Ignore misbehaving dev-dependencies
.*/node_modules/xdl/build/*
.*/node_modules/reqwest/tests/*
; Ignore missing expo-sdk dependencies (temporarily)
; https://github.com/expo/expo/issues/162
.*/node_modules/expo/src/*
; Ignore react-native-fbads dependency of the expo sdk
.*/node_modules/react-native-fbads/*
.*/react-navigation/examples/ReduxExample/.*
.*/react-navigation/website/.*
; This package is required by Expo and causes Flow errors
.*/node_modules/react-native-gesture-handler/.*
.*/node_modules/metro/.*
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
node_modules/react-native/flow-github/
../../flow/
[options]
module.system=haste
emoji=true
experimental.strict_type_args=true
munge_underscores=true
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js
suppress_type=$FlowIgnore
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_comment=\\(.\\|\n\\)*\\$FlowIgnore\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=true
[version]
^0.61.0

View File

@@ -1 +0,0 @@
*.pbxproj -text

View File

@@ -1,60 +1,3 @@
# OSX
#
.DS_Store
# 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/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
# Visual Studio Code
#
.vscode/
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# BUCK
buck-out/
\.buckd/
*.keystore
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/
*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
# Bundle artifact
*.jsbundle
.expo/
npm-debug.*

View File

@@ -1 +1 @@
{}
{}

View File

@@ -0,0 +1,2 @@
import App from './js/App';
export default App;

View File

@@ -5,5 +5,5 @@ import renderer from 'react-test-renderer';
it('renders without crashing', () => {
const rendered = renderer.create(<App />).toJSON();
expect(rendered).toBeDefined();
expect(rendered).toBeTruthy();
});

View File

@@ -1,14 +1,9 @@
# Navigation Playground Example
The NavigationPlayground example app includes a variety of patterns and is used as a simple way for contributors to manually integration test changes.
A playground for experimenting with react-navigation in a pure-JS React Native app.
## Usage
```bash
yarn # in the react-navigation root directory
cd examples/NavigationPlayground
yarn
yarn start
```
Please see the [Contributors Guide](https://reactnavigation.org/docs/guides/contributors#Run-the-Example-App) for instructions on running these example apps.
You can view this example application directly on Android phones by visiting scanning the QR code on [this site](https://exp.host/@react-navigation/NavigationPlayground) with the [Expo app](https://play.google.com/store/apps/details?id=host.exp.exponent&hl=en).
You can view this example application directly on your phone by visiting [our expo demo](https://exp.host/@react-navigation/NavigationPlayground).

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>NavigationPlayground</name>
<comment>Project NavigationPlayground created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>

View File

@@ -1,2 +0,0 @@
connection.project.dir=
eclipse.preferences.version=1

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>app</name>
<comment>Project app created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>

View File

@@ -1,2 +0,0 @@
connection.project.dir=..
eclipse.preferences.version=1

View File

@@ -1,65 +0,0 @@
# To learn about Buck see [Docs](https://buckbuild.com/).
# To run your application with Buck:
# - install Buck
# - `npm start` - to start the packager
# - `cd android`
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
# - `buck install -r android/app` - compile, install and run application
#
lib_deps = []
for jarfile in glob(['libs/*.jar']):
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
lib_deps.append(':' + name)
prebuilt_jar(
name = name,
binary_jar = jarfile,
)
for aarfile in glob(['libs/*.aar']):
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
lib_deps.append(':' + name)
android_prebuilt_aar(
name = name,
aar = aarfile,
)
android_library(
name = "all-libs",
exported_deps = lib_deps,
)
android_library(
name = "app-code",
srcs = glob([
"src/main/java/**/*.java",
]),
deps = [
":all-libs",
":build_config",
":res",
],
)
android_build_config(
name = "build_config",
package = "com.navigationplayground",
)
android_resource(
name = "res",
package = "com.navigationplayground",
res = "src/main/res",
)
android_binary(
name = "app",
keystore = "//android/keystores:debug",
manifest = "src/main/AndroidManifest.xml",
package_type = "debug",
deps = [
":app-code",
],
)

View File

@@ -1,153 +0,0 @@
apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* entryFile: "index.android.js",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.navigationplayground"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-blur')
compile project(':react-native-vector-icons')
compile project(':react-native-gesture-handler')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

View File

@@ -1,17 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@@ -1,26 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.navigationplayground">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>

View File

@@ -1,28 +0,0 @@
package com.navigationplayground;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is
* used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "NavigationPlayground";
}
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
}

View File

@@ -1,51 +0,0 @@
package com.navigationplayground;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.cmcewen.blurview.BlurViewPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new BlurViewPackage(),
new VectorIconsPackage(),
new RNGestureHandlerPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,3 +0,0 @@
<resources>
<string name="app_name">NavigationPlayground</string>
</resources>

View File

@@ -1,8 +0,0 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>

View File

@@ -1,39 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}

View File

@@ -1,18 +0,0 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

View File

@@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

View File

@@ -1,172 +0,0 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

View File

@@ -1,84 +0,0 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -1,8 +0,0 @@
keystore(
name = "debug",
properties = "debug.keystore.properties",
store = "debug.keystore",
visibility = [
"PUBLIC",
],
)

View File

@@ -1,4 +0,0 @@
key.store=debug.keystore
key.alias=androiddebugkey
key.store.password=android
key.alias.password=android

View File

@@ -1,9 +0,0 @@
rootProject.name = 'NavigationPlayground'
include ':react-native-blur'
project(':react-native-blur').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-blur/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':app'

View File

@@ -1,4 +1,26 @@
{
"name": "NavigationPlayground",
"displayName": "NavigationPlayground"
"expo": {
"name": "NavigationPlayground",
"description": "Try out react-navigation now with this awesome playground",
"version": "1.0.0",
"slug": "NavigationPlayground",
"privacy": "public",
"orientation": "portrait",
"primaryColor": "#cccccc",
"icon": "./assets/icons/icon.png",
"splash": {
"image": "./assets/icons/splash.png"
},
"sdkVersion": "25.0.0",
"entryPoint": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"packagerOpts": {
"assetExts": [
"ttf",
"mp4"
]
},
"ios": {
"supportsTablet": true
}
}
}

View File

@@ -1,171 +0,0 @@
import React from 'react';
import {
LayoutAnimation,
StatusBar,
StyleSheet,
Text,
View,
} from 'react-native';
import Ionicons from 'react-native-vector-icons/Ionicons';
import {
createMaterialTopTabNavigator,
NavigationScreenProp,
NavigationState,
SafeAreaView,
} from 'react-navigation';
import { Button } from './commonComponents/ButtonWithMargin';
interface Props {
navigation: NavigationScreenProp<NavigationState>;
}
class MyHomeScreen extends React.Component<Props> {
static navigationOptions = {
tabBarLabel: 'Home',
tabBarIcon: ({
tintColor,
focused,
horizontal,
}: {
tintColor: string;
focused: boolean;
horizontal: boolean;
}) => (
<Ionicons
name={focused ? 'ios-home' : 'ios-home'}
size={horizontal ? 20 : 26}
style={{ color: tintColor }}
/>
),
};
render() {
const { navigation } = this.props;
return (
<SafeAreaView forceInset={{ horizontal: 'always', top: 'always' }}>
<Text>Home Screen</Text>
<Button
onPress={() => navigation.navigate('Home')}
title="Go to home tab"
/>
<Button onPress={() => navigation.goBack(null)} title="Go back" />
</SafeAreaView>
);
}
}
class RecommendedScreen extends React.Component<Props> {
static navigationOptions = {
tabBarLabel: 'Recommended',
tabBarIcon: ({
tintColor,
focused,
horizontal,
}: {
tintColor: string;
focused: boolean;
horizontal: boolean;
}) => (
<Ionicons
name={focused ? 'ios-people' : 'ios-people'}
size={horizontal ? 20 : 26}
style={{ color: tintColor }}
/>
),
};
render() {
const { navigation } = this.props;
return (
<SafeAreaView forceInset={{ horizontal: 'always', top: 'always' }}>
<Text>Recommended Screen</Text>
<Button
onPress={() => navigation.navigate('Home')}
title="Go to home tab"
/>
<Button onPress={() => navigation.goBack(null)} title="Go back" />
</SafeAreaView>
);
}
}
class FeaturedScreen extends React.Component<Props> {
static navigationOptions = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => ({
tabBarLabel: 'Featured',
tabBarIcon: ({
tintColor,
focused,
horizontal,
}: {
tintColor: string;
focused: boolean;
horizontal: boolean;
}) => (
<Ionicons
name={focused ? 'ios-star' : 'ios-star'}
size={horizontal ? 20 : 26}
style={{ color: tintColor }}
/>
),
});
render() {
const { navigation } = this.props;
return (
<SafeAreaView forceInset={{ horizontal: 'always', top: 'always' }}>
<Text>Featured Screen</Text>
<Button
onPress={() => navigation.navigate('Home')}
title="Go to home tab"
/>
<Button onPress={() => navigation.goBack(null)} title="Go back" />
</SafeAreaView>
);
}
}
const SimpleTabs = createMaterialTopTabNavigator({
Home: MyHomeScreen,
Recommended: RecommendedScreen,
Featured: FeaturedScreen,
});
class TabNavigator extends React.Component<Props> {
static router = SimpleTabs.router;
componentWillUpdate() {
LayoutAnimation.easeInEaseOut();
}
render() {
const { navigation } = this.props;
const { routes, index } = navigation.state;
const activeRoute = routes[index];
let bottom = null;
if (activeRoute.routeName !== 'Home') {
bottom = (
<View style={{ height: 50, borderTopWidth: StyleSheet.hairlineWidth }}>
<Button
title="Check out"
onPress={() => {
//
}}
/>
</View>
);
}
return (
<View style={{ flex: 1 }}>
<StatusBar barStyle="default" />
<SafeAreaView
style={{ flex: 1 }}
forceInset={{ horizontal: 'always', top: 'always' }}
>
<SimpleTabs navigation={navigation} />
</SafeAreaView>
{bottom}
</View>
);
}
}
export default TabNavigator;

View File

@@ -1,132 +0,0 @@
import React from 'react';
import { ScrollView, StatusBar, StyleSheet, Text } from 'react-native';
import { BorderlessButton } from 'react-native-gesture-handler';
import {
createNavigator,
NavigationState,
SafeAreaView,
TabRouter,
} from 'react-navigation';
import { createAppContainer } from 'react-navigation';
import { NavigationScreenProp } from 'react-navigation';
import { Button } from './commonComponents/ButtonWithMargin';
import SampleText from './SampleText';
const MyNavScreen = ({
navigation,
banner,
}: {
navigation: NavigationScreenProp<NavigationState>;
banner: string;
}) => (
<ScrollView>
<SafeAreaView forceInset={{ horizontal: 'always' }}>
<SampleText>{banner}</SampleText>
<Button
onPress={() => {
navigation.goBack(null);
}}
title="Go back"
/>
</SafeAreaView>
<StatusBar barStyle="default" />
</ScrollView>
);
const MyHomeScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => <MyNavScreen banner="Home Screen" navigation={navigation} />;
const MyNotificationsScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => <MyNavScreen banner="Notifications Screen" navigation={navigation} />;
const MySettingsScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => <MyNavScreen banner="Settings Screen" navigation={navigation} />;
const CustomTabBar = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => {
const { routes } = navigation.state;
return (
<SafeAreaView style={styles.tabContainer}>
{routes.map(route => (
<BorderlessButton
onPress={() => navigation.navigate(route.routeName)}
style={styles.tab}
key={route.routeName}
>
<Text>{route.routeName}</Text>
</BorderlessButton>
))}
</SafeAreaView>
);
};
// @todo - how does the type definition for a custom navigator work?
class CustomTabView extends React.Component<any> {
render() {
const { navigation, descriptors } = this.props;
const { routes, index } = navigation.state;
const descriptor = descriptors[routes[index].key];
const ActiveScreen = descriptor.getComponent();
return (
<SafeAreaView forceInset={{ top: 'always' }}>
<CustomTabBar navigation={navigation} />
<ActiveScreen navigation={descriptor.navigation} />
</SafeAreaView>
);
}
}
const CustomTabRouter = TabRouter(
{
Home: {
path: '',
screen: MyHomeScreen,
},
Notifications: {
path: 'notifications',
screen: MyNotificationsScreen,
},
Settings: {
path: 'settings',
screen: MySettingsScreen,
},
},
{
// Change this to start on a different tab
initialRouteName: 'Home',
}
);
const CustomTabs = createAppContainer(
createNavigator(CustomTabView, CustomTabRouter, {})
);
const styles = StyleSheet.create({
tab: {
alignItems: 'center',
borderColor: '#ddd',
borderRadius: 4,
borderWidth: 1,
flex: 1,
justifyContent: 'center',
margin: 4,
},
tabContainer: {
flexDirection: 'row',
height: 48,
},
});
export default CustomTabs;

View File

@@ -1,116 +0,0 @@
import React from 'react';
import { ScrollView, StatusBar, StyleProp, TextStyle } from 'react-native';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import {
createDrawerNavigator,
createStackNavigator,
SafeAreaView,
} from 'react-navigation';
import { NavigationScreenProp, NavigationState } from 'react-navigation';
import { Button } from './commonComponents/ButtonWithMargin';
import SampleText from './SampleText';
const MyNavScreen = ({
navigation,
banner,
}: {
navigation: NavigationScreenProp<NavigationState>;
banner: string;
}) => (
<ScrollView>
<SafeAreaView forceInset={{ top: 'always' }}>
<SampleText>{banner}</SampleText>
<Button onPress={() => navigation.openDrawer()} title="Open drawer" />
<Button
onPress={() => navigation.navigate('Email')}
title="Open other screen"
/>
<Button onPress={() => navigation.navigate('Index')} title="Go back" />
</SafeAreaView>
<StatusBar barStyle="default" />
</ScrollView>
);
const InboxScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => <MyNavScreen banner={'Inbox Screen'} navigation={navigation} />;
InboxScreen.navigationOptions = {
headerTitle: 'Inbox',
};
const EmailScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => <MyNavScreen banner={'Email Screen'} navigation={navigation} />;
const DraftsScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => <MyNavScreen banner={'Drafts Screen'} navigation={navigation} />;
DraftsScreen.navigationOptions = {
headerTitle: 'Drafts',
};
const InboxStack = createStackNavigator(
{
Email: { screen: EmailScreen },
Inbox: { screen: InboxScreen },
},
{
navigationOptions: {
drawerIcon: ({ tintColor }) => (
<MaterialIcons
name="move-to-inbox"
size={24}
style={{ color: tintColor } as StyleProp<TextStyle>}
/>
),
drawerLabel: 'Inbox',
},
}
);
const DraftsStack = createStackNavigator(
{
Drafts: { screen: DraftsScreen },
Email: { screen: EmailScreen },
},
{
navigationOptions: {
drawerIcon: ({ tintColor }) => (
<MaterialIcons
name="drafts"
size={24}
style={{ color: tintColor } as StyleProp<TextStyle>}
/>
),
drawerLabel: 'Drafts',
},
}
);
const DrawerExample = createDrawerNavigator(
{
Drafts: {
path: '/sent',
screen: DraftsStack,
},
Inbox: {
path: '/',
screen: InboxStack,
},
},
{
contentOptions: {
activeTintColor: '#e91e63',
},
initialRouteName: 'Drafts',
}
);
export default DrawerExample;

View File

@@ -1,249 +0,0 @@
// tslint:disable no-unused-expression
import * as React from 'react';
import { StatusBar } from 'react-native';
import {
createStackNavigator,
NavigationActions,
NavigationEventPayload,
NavigationEventSubscription,
NavigationScreenProp,
NavigationState,
NavigationStateRoute,
SafeAreaView,
StackActions,
withNavigation,
} from 'react-navigation';
import { Button } from './commonComponents/ButtonWithMargin';
import { HeaderButtons } from './commonComponents/HeaderButtons';
import SampleText from './SampleText';
const DEBUG = false;
interface MyNavScreenProps {
navigation: NavigationScreenProp<NavigationState>;
banner: React.ReactNode;
}
interface BackButtonProps {
navigation: NavigationScreenProp<NavigationStateRoute<any>>;
}
class MyBackButton extends React.Component<BackButtonProps, any> {
render() {
return (
<HeaderButtons>
<HeaderButtons.Item title="Back" onPress={this.navigateBack} />
</HeaderButtons>
);
}
navigateBack = () => {
this.props.navigation.goBack(null);
};
}
const MyBackButtonWithNavigation: any = withNavigation(MyBackButton);
class MyNavScreen extends React.Component<MyNavScreenProps> {
render() {
const { navigation, banner } = this.props;
const { push, replace, popToTop, pop, dismiss } = navigation;
return (
<SafeAreaView forceInset={{ top: 'never' }}>
<SampleText>{banner}</SampleText>
<Button
onPress={() => push('Profile', { name: 'Jane' })}
title="Push a profile screen"
/>
<Button
onPress={() =>
navigation.dispatch(
StackActions.reset({
actions: [
NavigationActions.navigate({
params: { name: 'Jane' },
routeName: 'Photos',
}),
],
index: 0,
})
)
}
title="Reset photos"
/>
<Button
onPress={() => navigation.navigate('Photos', { name: 'Jane' })}
title="Navigate to a photos screen"
/>
<Button
onPress={() => replace('Profile', { name: 'Lucy' })}
title="Replace with profile"
/>
<Button onPress={() => popToTop()} title="Pop to top" />
<Button onPress={() => pop()} title="Pop" />
<Button
onPress={() => {
if (navigation.goBack()) {
console.log('goBack handled');
} else {
console.log('goBack unhandled');
}
}}
title="Go back"
/>
<Button onPress={() => dismiss()} title="Dismiss" />
<StatusBar barStyle="default" />
</SafeAreaView>
);
}
}
interface MyHomeScreenProps {
navigation: NavigationScreenProp<NavigationState>;
}
class MyHomeScreen extends React.Component<MyHomeScreenProps> {
static navigationOptions = {
title: 'Welcome',
};
s0: NavigationEventSubscription | null = null;
s1: NavigationEventSubscription | null = null;
s2: NavigationEventSubscription | null = null;
s3: NavigationEventSubscription | null = null;
componentDidMount() {
this.s0 = this.props.navigation.addListener('willFocus', this.onWF);
this.s1 = this.props.navigation.addListener('didFocus', this.onDF);
this.s2 = this.props.navigation.addListener('willBlur', this.onWB);
this.s3 = this.props.navigation.addListener('didBlur', this.onDB);
}
componentWillUnmount() {
this.s0!.remove();
this.s1!.remove();
this.s2!.remove();
this.s3!.remove();
}
onWF = (a: NavigationEventPayload) => {
DEBUG && console.log('willFocus HomeScreen', a);
};
onDF = (a: NavigationEventPayload) => {
DEBUG && console.log('didFocus HomeScreen', a);
};
onWB = (a: NavigationEventPayload) => {
DEBUG && console.log('willBlur HomeScreen', a);
};
onDB = (a: NavigationEventPayload) => {
DEBUG && console.log('didBlur HomeScreen', a);
};
render() {
const { navigation } = this.props;
return <MyNavScreen banner="Home Screen" navigation={navigation} />;
}
}
interface MyPhotosScreenProps {
navigation: NavigationScreenProp<NavigationState>;
}
class MyPhotosScreen extends React.Component<MyPhotosScreenProps> {
static navigationOptions = {
headerLeft: <MyBackButtonWithNavigation />,
title: 'Photos',
};
s0: NavigationEventSubscription | null = null;
s1: NavigationEventSubscription | null = null;
s2: NavigationEventSubscription | null = null;
s3: NavigationEventSubscription | null = null;
componentDidMount() {
this.s0 = this.props.navigation.addListener('willFocus', this.onWF);
this.s1 = this.props.navigation.addListener('didFocus', this.onDF);
this.s2 = this.props.navigation.addListener('willBlur', this.onWB);
this.s3 = this.props.navigation.addListener('didBlur', this.onDB);
}
componentWillUnmount() {
this.s0!.remove();
this.s1!.remove();
this.s2!.remove();
this.s3!.remove();
}
onWF = (a: NavigationEventPayload) => {
DEBUG && console.log('willFocus PhotosScreen', a);
};
onDF = (a: NavigationEventPayload) => {
DEBUG && console.log('didFocus PhotosScreen', a);
};
onWB = (a: NavigationEventPayload) => {
DEBUG && console.log('willBlur PhotosScreen', a);
};
onDB = (a: NavigationEventPayload) => {
DEBUG && console.log('didBlur PhotosScreen', a);
};
render() {
const { navigation } = this.props;
return (
<MyNavScreen
banner={`${navigation.getParam('name')}'s Photos`}
navigation={navigation}
/>
);
}
}
const MyProfileScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => (
<MyNavScreen
banner={`${
navigation.getParam('mode') === 'edit' ? 'Now Editing ' : ''
}${navigation.getParam('name')}'s Profile`}
navigation={navigation}
/>
);
MyProfileScreen.navigationOptions = (props: MyHomeScreenProps) => {
const { navigation } = props;
const { state, setParams } = navigation;
const { params } = state;
return {
headerBackImage: params!.headerBackImage,
// Render a button on the right side of the header.
// When pressed switches the screen to edit mode.
headerRight: (
<HeaderButtons>
<HeaderButtons.Item
title={params!.mode === 'edit' ? 'Done' : 'Edit'}
onPress={() =>
setParams({ mode: params!.mode === 'edit' ? '' : 'edit' })
}
/>
</HeaderButtons>
),
headerTitle: `${params!.name}'s Profile!`,
};
};
const SimpleStack = createStackNavigator(
{
Home: {
screen: MyHomeScreen,
},
Photos: {
path: 'photos/:name',
screen: MyPhotosScreen,
},
Profile: {
path: 'people/:name',
screen: MyProfileScreen,
},
},
{
// headerLayoutPreset: 'center',
}
);
export default SimpleStack;

View File

@@ -1,273 +0,0 @@
import React from 'react';
import { Animated, Platform, StatusBar, Text, View } from 'react-native';
import Ionicons from 'react-native-vector-icons/Ionicons';
import {
createBottomTabNavigator,
FlatList,
NavigationEventSubscription,
NavigationScreenProp,
SafeAreaView,
ScrollView,
} from 'react-navigation';
import { NavigationEventPayload, NavigationState } from 'react-navigation';
import { Button } from './commonComponents/ButtonWithMargin';
import SampleText from './SampleText';
const TEXT = `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla a hendrerit dui, id consectetur nulla. Curabitur mattis sapien nunc, quis dignissim eros venenatis sit amet. Praesent rutrum dapibus diam quis eleifend. Donec vulputate quis purus sed vulputate. Fusce ipsum felis, cursus at congue vel, consectetur tincidunt purus. Pellentesque et fringilla lorem. In at augue malesuada, sollicitudin ex ut, convallis elit. Curabitur metus nibh, consequat vel libero sit amet, iaculis congue nisl. Maecenas eleifend sodales sapien, fringilla sagittis nisi ornare volutpat. Integer tellus enim, volutpat vitae nisl et, dignissim pharetra leo. Sed sit amet efficitur sapien, at tristique sapien. Aenean dignissim semper sagittis. Nullam sit amet volutpat mi.
Curabitur auctor orci et justo molestie iaculis. Integer elementum tortor ac ipsum egestas pharetra. Etiam ultrices elementum pharetra. Maecenas lobortis ultrices risus dignissim luctus. Nunc malesuada cursus posuere. Vestibulum tristique lectus pretium pellentesque pellentesque. Nunc ac nisi lacus. Duis ultrices dui ac viverra ullamcorper. Morbi placerat laoreet lacus sit amet ullamcorper.
Nulla convallis pulvinar hendrerit. Nulla mattis sem et aliquam ultrices. Nam egestas magna leo, nec luctus turpis sollicitudin ac. Sed id leo luctus, lobortis tortor ut, rhoncus ex. Aliquam gravida enim ac dapibus ultricies. Vestibulum at interdum est, et vehicula nibh. Phasellus dignissim iaculis rhoncus. Vestibulum tempus leo lectus, quis euismod metus ullamcorper quis. Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut id ipsum at enim eleifend porttitor id quis metus. Proin bibendum ornare iaculis. Duis elementum lacus vel cursus efficitur. Nunc eu tortor sed risus lacinia scelerisque.
Praesent lobortis elit sit amet mauris pulvinar, viverra condimentum massa pellentesque. Curabitur massa ex, dignissim eget neque at, fringilla consectetur justo. Cras sollicitudin vel ligula sed cursus. Aliquam porta sem hendrerit diam porta ultricies. Sed eu mi erat. Curabitur id justo vel tortor hendrerit vestibulum id eget est. Morbi eros magna, placerat id diam ut, varius sollicitudin mi. Curabitur pretium finibus accumsan.`;
const MyNavScreen = ({
navigation,
banner,
}: {
navigation: NavigationScreenProp<NavigationState>;
banner: string;
}) => (
<ScrollView style={{ flex: 1 }}>
<SafeAreaView forceInset={{ horizontal: 'always', top: 'always' }}>
<SampleText>{banner}</SampleText>
<Button
onPress={() => navigation.navigate('Home')}
title="Go to home tab"
/>
<Button
onPress={() => navigation.navigate('Settings')}
title="Go to settings tab"
/>
<Button onPress={() => navigation.goBack(null)} title="Go back" />
{TEXT.split('\n').map((p, n) => (
<Text key={n} style={{ marginVertical: 10, marginHorizontal: 8 }}>
{p}
</Text>
))}
<StatusBar barStyle="default" />
</SafeAreaView>
</ScrollView>
);
const MyListScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => (
<FlatList
data={TEXT.split('\n')}
style={{ paddingTop: 10 }}
keyExtractor={(item, index) => index.toString()}
renderItem={({ item }) => (
<Text style={{ fontSize: 16, marginVertical: 10, marginHorizontal: 8 }}>
{item}
</Text>
)}
/>
);
const MyHomeScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => <MyNavScreen banner="Home Tab" navigation={navigation} />;
MyHomeScreen.navigationOptions = {
tabBarIcon: ({
tintColor,
focused,
horizontal,
}: {
tintColor: string;
focused: boolean;
horizontal: boolean;
}) => (
<Ionicons
name={'ios-home'}
size={horizontal ? 20 : 26}
style={{ color: tintColor }}
/>
),
tabBarLabel: 'Home',
tabBarTestIDProps: {
accessibilityLabel: 'TEST_ID_HOME_ACLBL',
testID: 'TEST_ID_HOME',
},
};
MyListScreen.navigationOptions = MyHomeScreen.navigationOptions;
interface MyPeopleScreenProps {
navigation: NavigationScreenProp<NavigationState>;
}
class MyPeopleScreen extends React.Component<MyPeopleScreenProps> {
static navigationOptions = {
tabBarIcon: ({
tintColor,
focused,
horizontal,
}: {
tintColor: string;
focused: boolean;
horizontal: boolean;
}) => (
<Ionicons
name={'ios-people'}
size={horizontal ? 20 : 26}
style={{ color: tintColor }}
/>
),
tabBarLabel: 'People',
};
s0: NavigationEventSubscription | null = null;
s1: NavigationEventSubscription | null = null;
s2: NavigationEventSubscription | null = null;
s3: NavigationEventSubscription | null = null;
componentDidMount() {
// this.s0! = this.props.navigation.addListener('willFocus', this.onEvent);
// this.s1! = this.props.navigation.addListener('didFocus', this.onEvent);
// this.s2! = this.props.navigation.addListener('willBlur', this.onEvent);
// this.s3! = this.props.navigation.addListener('didBlur', this.onEvent);
}
componentWillUnmount() {
// this.s0!.remove();
// this.s1!.remove();
// this.s2!.remove();
// this.s3!.remove();
}
onEvent = (a: NavigationEventPayload) => {
console.log('EVENT ON PEOPLE TAB', a.type, a);
};
render() {
const { navigation } = this.props;
return <MyNavScreen banner="People Tab" navigation={navigation} />;
}
}
interface MyChatScreenProps {
navigation: NavigationScreenProp<NavigationState>;
}
class MyChatScreen extends React.Component<MyChatScreenProps> {
static navigationOptions = {
tabBarIcon: ({
tintColor,
focused,
horizontal,
}: {
tintColor: string;
focused: boolean;
horizontal: boolean;
}) => (
<Ionicons
name={'ios-chatboxes'}
size={horizontal ? 20 : 26}
style={{ color: tintColor }}
/>
),
tabBarLabel: 'Chat',
};
s0: NavigationEventSubscription | null = null;
s1: NavigationEventSubscription | null = null;
s2: NavigationEventSubscription | null = null;
s3: NavigationEventSubscription | null = null;
componentDidMount() {
// this.s0! = this.props.navigation.addListener('willFocus', this.onEvent);
// this.s1! = this.props.navigation.addListener('didFocus', this.onEvent);
// this.s2! = this.props.navigation.addListener('willBlur', this.onEvent);
// this.s3! = this.props.navigation.addListener('didBlur', this.onEvent);
}
componentWillUnmount() {
// this.s0!.remove();
// this.s1!.remove();
// this.s2!.remove();
// this.s3!.remove();
}
onEvent = (a: NavigationEventPayload) => {
console.log('EVENT ON CHAT TAB', a.type, a);
};
render() {
const { navigation } = this.props;
return <MyNavScreen banner="Chat Tab" navigation={navigation} />;
}
}
const MySettingsScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => <MyNavScreen banner="Settings Tab" navigation={navigation} />;
MySettingsScreen.navigationOptions = {
tabBarIcon: ({
tintColor,
focused,
horizontal,
}: {
tintColor: string;
focused: boolean;
horizontal: boolean;
}) => (
<Ionicons
name={'ios-settings'}
size={horizontal ? 20 : 26}
style={{ color: tintColor }}
/>
),
tabBarLabel: 'Settings',
};
const SimpleTabs = createBottomTabNavigator(
{
Chat: {
path: 'chat',
screen: MyChatScreen,
},
Home: {
path: '',
screen: MyListScreen,
},
People: {
path: 'cart',
screen: MyPeopleScreen,
},
Settings: {
path: 'settings',
screen: MySettingsScreen,
},
},
{
backBehavior: 'history',
tabBarOptions: {
activeTintColor: '#e91e63',
},
}
);
interface SimpleTabsContainerProps {
navigation: NavigationScreenProp<NavigationState>;
}
class SimpleTabsContainer extends React.Component<SimpleTabsContainerProps> {
static router = SimpleTabs.router;
s0: NavigationEventSubscription | null = null;
s1: NavigationEventSubscription | null = null;
s2: NavigationEventSubscription | null = null;
s3: NavigationEventSubscription | null = null;
componentDidMount() {
// this.s0! = this.props.navigation.addListener('willFocus', this.onAction);
// this.s1! = this.props.navigation.addListener('didFocus', this.onAction);
// this.s2! = this.props.navigation.addListener('willBlur', this.onAction);
// this.s3! = this.props.navigation.addListener('didBlur', this.onAction);
}
componentWillUnmount() {
// this.s0!.remove();
// this.s1!.remove();
// this.s2!.remove();
// this.s3!.remove();
}
onAction = (a: NavigationEventPayload) => {
console.log('TABS EVENT', a.type, a);
};
render() {
return <SimpleTabs navigation={this.props.navigation} />;
}
}
export default SimpleTabsContainer;

View File

@@ -1,148 +0,0 @@
import * as React from 'react';
import { Button, Image, StatusBar, StyleSheet } from 'react-native';
import {
createStackNavigator,
NavigationScreenProp,
NavigationState,
SafeAreaView,
} from 'react-navigation';
import SampleText from './SampleText';
interface MyNavScreenProps {
navigation: NavigationScreenProp<NavigationState>;
banner: React.ReactNode;
}
class MyCustomHeaderBackImage extends React.Component<any, any> {
render() {
const source = require('./assets/back.png');
return (
<Image
source={source}
style={[styles.myCustomHeaderBackImage, this.props.style]}
/>
);
}
}
class MyNavScreen extends React.Component<MyNavScreenProps> {
render() {
const { navigation, banner } = this.props;
return (
<SafeAreaView>
<SampleText>{banner}</SampleText>
<Button
onPress={() => navigation.navigate('Photos', { name: 'Jane' })}
title="Navigate to a photos screen"
/>
<Button onPress={() => navigation.goBack(null)} title="Go back" />
<StatusBar barStyle="default" />
</SafeAreaView>
);
}
}
interface MyHomeScreenProps {
navigation: NavigationScreenProp<NavigationState>;
}
class MyHomeScreen extends React.Component<MyHomeScreenProps> {
static navigationOptions = {
headerBackTitle: null,
title: 'Welcome',
};
render() {
const { navigation } = this.props;
return <MyNavScreen banner="Home Screen" navigation={navigation} />;
}
}
interface MyPhotosScreenProps {
navigation: NavigationScreenProp<NavigationState>;
}
class MyPhotosScreen extends React.Component<MyPhotosScreenProps> {
static navigationOptions = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => ({
headerBackTitle: null,
title: `${navigation.state.params!.name}'s photos`,
});
render() {
const { navigation } = this.props;
return (
<SafeAreaView>
<SampleText>{`${navigation.state.params!.name}'s Photos`}</SampleText>
<Button
onPress={() => navigation.navigate('Profile', { name: 'Jane' })}
title="Navigate to a profile screen"
/>
<Button onPress={() => navigation.goBack(null)} title="Go back" />
<StatusBar barStyle="default" />
</SafeAreaView>
);
}
}
interface MyProfileScreenProps {
navigation: NavigationScreenProp<NavigationState>;
}
class MyProfileScreen extends React.Component<MyProfileScreenProps> {
static navigationOptions = () => ({
headerBackImage: (
<MyCustomHeaderBackImage style={styles.myCustomHeaderBackImageAlt} />
),
title: 'Profile',
});
render() {
const { navigation } = this.props;
return (
<SafeAreaView>
<SampleText>{`${navigation.state.params!.name}'s Profile`}</SampleText>
<Button onPress={() => navigation.goBack(null)} title="Go back" />
<StatusBar barStyle="default" />
</SafeAreaView>
);
}
}
const StackWithCustomHeaderBackImage = createStackNavigator(
{
Home: {
screen: MyHomeScreen,
},
Photos: {
path: 'photos/:name',
screen: MyPhotosScreen,
},
Profile: {
path: 'profile/:name',
screen: MyProfileScreen,
},
},
{
defaultNavigationOptions: {
headerBackImage: MyCustomHeaderBackImage as any,
},
}
);
export default StackWithCustomHeaderBackImage;
const styles = StyleSheet.create({
myCustomHeaderBackImage: {
height: 14.5,
marginLeft: 9,
marginRight: 12,
marginVertical: 12,
resizeMode: 'contain',
width: 24,
},
myCustomHeaderBackImageAlt: {
tintColor: '#f00',
},
});

View File

@@ -1,118 +0,0 @@
import * as React from 'react';
import { StatusBar } from 'react-native';
import {
createStackNavigator,
NavigationScreenProp,
NavigationState,
SafeAreaView,
} from 'react-navigation';
import { Button } from './commonComponents/ButtonWithMargin';
interface NavScreenProps {
navigation: NavigationScreenProp<NavigationState>;
}
class HomeScreen extends React.Component<NavScreenProps> {
static navigationOptions = {
title: 'Welcome',
};
render() {
const { navigation } = this.props;
const { push } = navigation;
return (
<SafeAreaView style={{ paddingTop: 30 }}>
<Button onPress={() => push('Other')} title="Push another screen" />
<Button
onPress={() => push('ScreenWithNoHeader')}
title="Push screen with no header"
/>
<Button onPress={() => navigation.goBack(null)} title="Go Home" />
<StatusBar barStyle="default" />
</SafeAreaView>
);
}
}
class OtherScreen extends React.Component<NavScreenProps> {
static navigationOptions = {
title: 'Your title here',
};
render() {
const { navigation } = this.props;
const { push, pop } = navigation;
return (
<SafeAreaView style={{ paddingTop: 30 }}>
<Button
onPress={() => push('ScreenWithLongTitle')}
title="Push another screen"
/>
<Button
onPress={() => push('ScreenWithNoHeader')}
title="Push screen with no header"
/>
<Button onPress={() => pop()} title="Pop" />
<Button onPress={() => navigation.goBack(null)} title="Go back" />
<StatusBar barStyle="default" />
</SafeAreaView>
);
}
}
class ScreenWithLongTitle extends React.Component<NavScreenProps> {
static navigationOptions = {
title: "Another title that's kind of long",
};
render() {
const { navigation } = this.props;
const { pop } = navigation;
return (
<SafeAreaView style={{ paddingTop: 30 }}>
<Button onPress={() => pop()} title="Pop" />
<Button onPress={() => navigation.goBack(null)} title="Go back" />
<StatusBar barStyle="default" />
</SafeAreaView>
);
}
}
class ScreenWithNoHeader extends React.Component<NavScreenProps> {
static navigationOptions = {
header: null,
title: 'No Header',
};
render() {
const { navigation } = this.props;
const { push, pop } = navigation;
return (
<SafeAreaView style={{ paddingTop: 30 }}>
<Button onPress={() => push('Other')} title="Push another screen" />
<Button onPress={() => pop()} title="Pop" />
<Button onPress={() => navigation.goBack(null)} title="Go back" />
<StatusBar barStyle="default" />
</SafeAreaView>
);
}
}
const StackWithHeaderPreset = createStackNavigator(
{
Home: HomeScreen,
Other: OtherScreen,
ScreenWithLongTitle,
ScreenWithNoHeader,
},
{
headerTransitionPreset: 'uikit',
}
);
export default StackWithHeaderPreset;

View File

@@ -1,254 +0,0 @@
import * as React from 'react';
import {
Platform,
ScrollView,
StatusBar,
StyleSheet,
View,
} from 'react-native';
import { BlurView } from 'react-native-blur';
import { isIphoneX } from 'react-native-iphone-x-helper';
import {
createStackNavigator,
Header,
HeaderStyleInterpolator,
NavigationEventPayload,
NavigationEventSubscription,
NavigationScreenProp,
NavigationState,
TransitionConfig,
} from 'react-navigation';
import { Button } from './commonComponents/ButtonWithMargin';
import { HeaderButtons } from './commonComponents/HeaderButtons';
import SampleText from './SampleText';
interface MyNavScreenProps {
navigation: NavigationScreenProp<NavigationState>;
banner: React.ReactNode;
}
class MyNavScreen extends React.Component<MyNavScreenProps> {
render() {
const { navigation, banner } = this.props;
const { push, replace, popToTop, pop } = navigation;
return (
<ScrollView style={{ flex: 1 }} {...this.getHeaderInset()}>
<SampleText>{banner}</SampleText>
<Button
onPress={() => push('Profile', { name: 'Jane' })}
title="Push a profile screen"
/>
<Button
onPress={() => navigation.navigate('Photos', { name: 'Jane' })}
title="Navigate to a photos screen"
/>
<Button
onPress={() => replace('Profile', { name: 'Lucy' })}
title="Replace with profile"
/>
<Button onPress={() => popToTop()} title="Pop to top" />
<Button onPress={() => pop()} title="Pop" />
<Button onPress={() => navigation.goBack(null)} title="Go back" />
<StatusBar barStyle="default" />
</ScrollView>
);
}
// Inset to compensate for navigation bar being transparent.
// And improved abstraction for this will be built in to react-navigation
// at some point.
getHeaderInset(): any {
const NOTCH_HEIGHT = isIphoneX() ? 25 : 0;
// $FlowIgnore: we will remove the HEIGHT static soon enough
const BASE_HEADER_HEIGHT = Header.HEIGHT;
const HEADER_HEIGHT =
Platform.OS === 'ios'
? BASE_HEADER_HEIGHT + NOTCH_HEIGHT
: BASE_HEADER_HEIGHT + 20;
return Platform.select({
android: {
contentContainerStyle: {
paddingTop: HEADER_HEIGHT,
},
},
ios: {
contentInset: { top: HEADER_HEIGHT },
contentOffset: { y: -HEADER_HEIGHT },
},
});
}
}
interface MyHomeScreenProps {
navigation: NavigationScreenProp<NavigationState>;
}
class MyHomeScreen extends React.Component<MyHomeScreenProps> {
static navigationOptions = {
title: 'Welcome',
};
s0: NavigationEventSubscription | null = null;
s1: NavigationEventSubscription | null = null;
s2: NavigationEventSubscription | null = null;
s3: NavigationEventSubscription | null = null;
componentDidMount() {
this.s0 = this.props.navigation.addListener('willFocus', this.onWF);
this.s1 = this.props.navigation.addListener('didFocus', this.onDF);
this.s2 = this.props.navigation.addListener('willBlur', this.onWB);
this.s3 = this.props.navigation.addListener('didBlur', this.onDB);
}
componentWillUnmount() {
this.s0!.remove();
this.s1!.remove();
this.s2!.remove();
this.s3!.remove();
}
onWF = (a: NavigationEventPayload) => {
console.log('willFocus HomeScreen', a);
};
onDF = (a: NavigationEventPayload) => {
console.log('didFocus HomeScreen', a);
};
onWB = (a: NavigationEventPayload) => {
console.log('willBlur HomeScreen', a);
};
onDB = (a: NavigationEventPayload) => {
console.log('didBlur HomeScreen', a);
};
render() {
const { navigation } = this.props;
return <MyNavScreen banner="Home Screen" navigation={navigation} />;
}
}
interface MyPhotosScreenProps {
navigation: NavigationScreenProp<NavigationState>;
}
class MyPhotosScreen extends React.Component<MyPhotosScreenProps> {
static navigationOptions = {
title: 'Photos',
};
s0: NavigationEventSubscription | null = null;
s1: NavigationEventSubscription | null = null;
s2: NavigationEventSubscription | null = null;
s3: NavigationEventSubscription | null = null;
componentDidMount() {
this.s0 = this.props.navigation.addListener('willFocus', this.onWF);
this.s1 = this.props.navigation.addListener('didFocus', this.onDF);
this.s2 = this.props.navigation.addListener('willBlur', this.onWB);
this.s3 = this.props.navigation.addListener('didBlur', this.onDB);
}
componentWillUnmount() {
this.s0!.remove();
this.s1!.remove();
this.s2!.remove();
this.s3!.remove();
}
onWF = (a: NavigationEventPayload) => {
console.log('willFocus PhotosScreen', a);
};
onDF = (a: NavigationEventPayload) => {
console.log('didFocus PhotosScreen', a);
};
onWB = (a: NavigationEventPayload) => {
console.log('willBlur PhotosScreen', a);
};
onDB = (a: NavigationEventPayload) => {
console.log('didBlur PhotosScreen', a);
};
render() {
const { navigation } = this.props;
return (
<MyNavScreen
banner={`${navigation.state.params!.name}'s Photos`}
navigation={navigation}
/>
);
}
}
const MyProfileScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => (
<MyNavScreen
banner={`${navigation.state.params!.mode === 'edit' ? 'Now Editing ' : ''}${
navigation.state.params!.name
}'s Profile`}
navigation={navigation}
/>
);
MyProfileScreen.navigationOptions = (props: {
navigation: NavigationScreenProp<NavigationState>;
}) => {
const { navigation } = props;
const { state, setParams } = navigation;
const { params } = state;
return {
headerBackImage: params!.headerBackImage,
// Render a button on the right side of the header.
// When pressed switches the screen to edit mode.
headerRight: (
<HeaderButtons>
<HeaderButtons.Item
title={params!.mode === 'edit' ? 'Done' : 'Edit'}
onPress={() =>
setParams({ mode: params!.mode === 'edit' ? '' : 'edit' })
}
/>
</HeaderButtons>
),
headerTitle: `${params!.name}'s Profile!`,
};
};
const StackWithTranslucentHeader = createStackNavigator(
{
Home: {
screen: MyHomeScreen,
},
Photos: {
path: 'photos/:name',
screen: MyPhotosScreen,
},
Profile: {
path: 'people/:name',
screen: MyProfileScreen,
},
},
{
defaultNavigationOptions: {
headerBackground: Platform.select({
android: (
<View style={{ flex: 1, backgroundColor: 'rgba(255,255,255,0.7)' }} />
),
ios: <BlurView style={{ flex: 1 }} blurType="light" />,
}),
headerStyle: {
borderBottomColor: '#A7A7AA',
borderBottomWidth: StyleSheet.hairlineWidth,
},
headerTransparent: true,
},
headerTransitionPreset: 'uikit',
// You can leave this out if you don't want the card shadow to
// be visible through the header
transitionConfig: () =>
({
headerBackgroundInterpolator:
HeaderStyleInterpolator.forBackgroundWithTranslation,
} as TransitionConfig),
}
);
export default StackWithTranslucentHeader;

View File

@@ -1,163 +0,0 @@
import React from 'react';
import { StatusBar, Text } from 'react-native';
import {
createBottomTabNavigator,
createStackNavigator,
NavigationScreenProp,
NavigationState,
SafeAreaView,
ScrollView,
} from 'react-navigation';
import Ionicons from 'react-native-vector-icons/Ionicons';
import { Button } from './commonComponents/ButtonWithMargin';
import SampleText from './SampleText';
const TEXT = `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla a hendrerit dui, id consectetur nulla. Curabitur mattis sapien nunc, quis dignissim eros venenatis sit amet. Praesent rutrum dapibus diam quis eleifend. Donec vulputate quis purus sed vulputate. Fusce ipsum felis, cursus at congue vel, consectetur tincidunt purus. Pellentesque et fringilla lorem. In at augue malesuada, sollicitudin ex ut, convallis elit. Curabitur metus nibh, consequat vel libero sit amet, iaculis congue nisl. Maecenas eleifend sodales sapien, fringilla sagittis nisi ornare volutpat. Integer tellus enim, volutpat vitae nisl et, dignissim pharetra leo. Sed sit amet efficitur sapien, at tristique sapien. Aenean dignissim semper sagittis. Nullam sit amet volutpat mi.
Curabitur auctor orci et justo molestie iaculis. Integer elementum tortor ac ipsum egestas pharetra. Etiam ultrices elementum pharetra. Maecenas lobortis ultrices risus dignissim luctus. Nunc malesuada cursus posuere. Vestibulum tristique lectus pretium pellentesque pellentesque. Nunc ac nisi lacus. Duis ultrices dui ac viverra ullamcorper. Morbi placerat laoreet lacus sit amet ullamcorper.
Nulla convallis pulvinar hendrerit. Nulla mattis sem et aliquam ultrices. Nam egestas magna leo, nec luctus turpis sollicitudin ac. Sed id leo luctus, lobortis tortor ut, rhoncus ex. Aliquam gravida enim ac dapibus ultricies. Vestibulum at interdum est, et vehicula nibh. Phasellus dignissim iaculis rhoncus. Vestibulum tempus leo lectus, quis euismod metus ullamcorper quis. Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut id ipsum at enim eleifend porttitor id quis metus. Proin bibendum ornare iaculis. Duis elementum lacus vel cursus efficitur. Nunc eu tortor sed risus lacinia scelerisque.
Praesent lobortis elit sit amet mauris pulvinar, viverra condimentum massa pellentesque. Curabitur massa ex, dignissim eget neque at, fringilla consectetur justo. Cras sollicitudin vel ligula sed cursus. Aliquam porta sem hendrerit diam porta ultricies. Sed eu mi erat. Curabitur id justo vel tortor hendrerit vestibulum id eget est. Morbi eros magna, placerat id diam ut, varius sollicitudin mi. Curabitur pretium finibus accumsan.`;
interface Props {
navigation: NavigationScreenProp<NavigationState>;
banner: string;
}
class MyNavScreen extends React.Component<Props> {
render() {
const { navigation } = this.props;
const banner = navigation.getParam('banner');
return (
<ScrollView style={{ flex: 1 }}>
<SafeAreaView forceInset={{ horizontal: 'always' }}>
<SampleText>{banner}</SampleText>
<Button
onPress={() => navigation.navigate('Profile', { name: 'Jordan' })}
title="Open profile screen"
/>
<Button
onPress={() => navigation.navigate('NotifSettings')}
title="Open notifications screen"
/>
<Button
onPress={() => navigation.navigate('SettingsTab')}
title="Go to settings tab"
/>
<Button onPress={() => navigation.goBack(null)} title="Go back" />
{TEXT.split('\n').map((p, n) => (
<Text key={n} style={{ marginVertical: 10, marginHorizontal: 8 }}>
{p}
</Text>
))}
</SafeAreaView>
<StatusBar barStyle="default" />
</ScrollView>
);
}
}
const MyProfileScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => (
<MyNavScreen
banner={`${navigation.state.params!.name}s Profile`}
navigation={navigation}
/>
);
const MainTab = createStackNavigator({
Home: {
navigationOptions: {
title: 'Welcome',
},
params: { banner: 'Home Screen' },
path: '/',
screen: MyNavScreen,
},
Profile: {
navigationOptions: ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => ({
title: `${navigation.state.params!.name}'s Profile!`,
}),
path: '/people/:name',
screen: MyProfileScreen,
},
});
const SettingsTab = createStackNavigator({
NotifSettings: {
navigationOptions: {
title: 'Notifications',
},
params: { banner: 'Notifications Screen' },
screen: MyNavScreen,
},
Settings: {
navigationOptions: () => ({
title: 'Settings',
}),
params: { banner: 'Settings Screen' },
path: '/',
screen: MyNavScreen,
},
});
const StacksInTabs = createBottomTabNavigator(
{
MainTab: {
navigationOptions: {
tabBarIcon: ({
tintColor,
focused,
}: {
tintColor: string;
focused: boolean;
}) => (
<Ionicons
name={focused ? 'ios-home' : 'ios-home'}
size={26}
style={{ color: tintColor }}
/>
),
tabBarLabel: 'Home',
},
path: '/',
screen: MainTab,
},
SettingsTab: {
screen: SettingsTab,
path: '/settings',
navigationOptions: {
tabBarLabel: 'Settings',
tabBarIcon: ({
tintColor,
focused,
}: {
tintColor: string;
focused: boolean;
}) => (
<Ionicons
name={focused ? 'ios-settings' : 'ios-settings'}
size={26}
style={{ color: tintColor }}
/>
),
},
},
},
{
tabBarOptions: {
showLabel: false,
},
}
);
export default StacksInTabs;

View File

@@ -1,159 +0,0 @@
import React from 'react';
import { ScrollView, StatusBar } from 'react-native';
import Ionicons from 'react-native-vector-icons/Ionicons';
import {
createBottomTabNavigator,
createStackNavigator,
getActiveChildNavigationOptions,
NavigationScreenProp,
NavigationState,
SafeAreaView,
} from 'react-navigation';
import { Button } from './commonComponents/ButtonWithMargin';
import SampleText from './SampleText';
const MyNavScreen = ({
navigation,
banner,
}: {
navigation: NavigationScreenProp<NavigationState>;
banner: string;
}) => (
<ScrollView>
<SafeAreaView forceInset={{ horizontal: 'always', vertical: 'never' }}>
<SampleText>{banner}</SampleText>
<Button
onPress={() => navigation.navigate('Profile', { name: 'Jordan' })}
title="Open profile screen"
/>
<Button
onPress={() => navigation.navigate('NotifSettings')}
title="Open notifications screen"
/>
<Button
onPress={() => navigation.navigate('SettingsTab')}
title="Go to settings tab"
/>
<Button onPress={() => navigation.goBack(null)} title="Go back" />
</SafeAreaView>
<StatusBar barStyle="default" />
</ScrollView>
);
const MyHomeScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => <MyNavScreen banner="Home Screen" navigation={navigation} />;
const MyProfileScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => (
<MyNavScreen
banner={`${navigation.state.params!.name}s Profile`}
navigation={navigation}
/>
);
const MyNotificationsSettingsScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => <MyNavScreen banner="Notifications Screen" navigation={navigation} />;
const MySettingsScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => <MyNavScreen banner="Settings Screen" navigation={navigation} />;
const TabNav = createBottomTabNavigator(
{
MainTab: {
navigationOptions: {
tabBarIcon: ({
tintColor,
focused,
}: {
tintColor: string;
focused: boolean;
}) => (
<Ionicons
name={focused ? 'ios-home' : 'ios-home'}
size={26}
style={{ color: tintColor }}
/>
),
tabBarLabel: 'Home',
title: 'Welcome',
},
path: '/',
screen: MyHomeScreen,
},
SettingsTab: {
navigationOptions: {
tabBarIcon: ({
tintColor,
focused,
}: {
tintColor: string;
focused: boolean;
}) => (
<Ionicons
name={focused ? 'ios-settings' : 'ios-settings'}
size={26}
style={{ color: tintColor }}
/>
),
title: 'Settings',
},
path: '/settings',
screen: MySettingsScreen,
},
},
{
animationEnabled: false,
swipeEnabled: false,
tabBarPosition: 'bottom',
}
);
TabNav.navigationOptions = ({
navigation,
screenProps,
}: {
navigation: NavigationScreenProp<NavigationState>;
screenProps: { [key: string]: any };
}) => {
const childOptions = getActiveChildNavigationOptions(navigation, screenProps);
return {
title: childOptions.title,
};
};
const StacksOverTabs = createStackNavigator({
NotifSettings: {
navigationOptions: {
title: 'Notifications',
},
screen: MyNotificationsSettingsScreen,
},
Profile: {
navigationOptions: ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => ({
title: `${navigation.state.params!.name}'s Profile!`,
}),
path: '/people/:name',
screen: MyProfileScreen,
},
Root: {
screen: TabNav,
},
});
export default StacksOverTabs;

View File

@@ -1,176 +0,0 @@
import React from 'react';
import {
ScrollView,
StatusBar,
StatusBarStyle,
StyleSheet,
View,
} from 'react-native';
import {
createMaterialTopTabNavigator,
createStackNavigator,
NavigationScreenProp,
NavigationState,
SafeAreaView,
} from 'react-navigation';
import { MaterialTopTabBar } from 'react-navigation-tabs';
import { Button } from './commonComponents/ButtonWithMargin';
import SampleText from './SampleText';
const HEADER_HEIGHT = 64;
const MyNavScreen = ({
navigation,
banner,
statusBarStyle,
}: {
navigation: NavigationScreenProp<NavigationState>;
banner: string;
statusBarStyle?: StatusBarStyle;
}) => (
<ScrollView>
<SafeAreaView forceInset={{ horizontal: 'always' }}>
<SampleText>{banner}</SampleText>
<Button
onPress={() => navigation.navigate('Profile', { name: 'Jordan' })}
title="Open profile screen"
/>
<Button
onPress={() => navigation.navigate('NotifSettings')}
title="Open notifications screen"
/>
<Button
onPress={() => navigation.navigate('SettingsTab')}
title="Go to settings tab"
/>
<Button onPress={() => navigation.goBack(null)} title="Go back" />
</SafeAreaView>
<StatusBar barStyle={statusBarStyle || 'default'} />
</ScrollView>
);
const MyHomeScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => (
<MyNavScreen
banner="Home Screen"
navigation={navigation}
statusBarStyle="light-content"
/>
);
const MyProfileScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => (
<MyNavScreen
banner={`${navigation.state.params!.name}s Profile`}
navigation={navigation}
/>
);
const MyNotificationsSettingsScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => <MyNavScreen banner="Notifications Screen" navigation={navigation} />;
const MySettingsScreen = ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => (
<MyNavScreen
banner="Settings Screen"
navigation={navigation}
statusBarStyle="light-content"
/>
);
const styles = StyleSheet.create({
stackHeader: {
height: HEADER_HEIGHT,
},
tab: {
height: HEADER_HEIGHT,
},
});
function MaterialTopTabBarWithStatusBar(props: any) {
return (
<View
style={{
paddingTop: 20,
backgroundColor: '#2196f3',
}}
>
<MaterialTopTabBar
{...props}
jumpToIndex={() => {
//
}}
/>
</View>
);
}
const TabNavigator = createMaterialTopTabNavigator(
{
MainTab: {
screen: MyHomeScreen,
navigationOptions: {
title: 'Welcome',
},
},
SettingsTab: {
screen: MySettingsScreen,
navigationOptions: {
title: 'Settings',
},
},
},
{
tabBarComponent: MaterialTopTabBarWithStatusBar,
tabBarOptions: {
tabStyle: styles.tab,
},
}
);
const StackNavigator = createStackNavigator(
{
Root: {
screen: TabNavigator,
navigationOptions: {
header: null,
},
},
NotifSettings: {
screen: MyNotificationsSettingsScreen,
navigationOptions: {
title: 'Notifications',
},
},
Profile: {
screen: MyProfileScreen,
navigationOptions: ({
navigation,
}: {
navigation: NavigationScreenProp<NavigationState>;
}) => ({
title: `${navigation.state.params!.name}'s Profile!`,
}),
},
},
{
defaultNavigationOptions: {
headerStyle: styles.stackHeader,
},
}
);
export default StackNavigator;

View File

@@ -1,117 +0,0 @@
import React from 'react';
import {
ActivityIndicator,
AsyncStorage,
StatusBar,
StyleSheet,
View,
} from 'react-native';
import { createStackNavigator, createSwitchNavigator } from 'react-navigation';
import { Button } from './commonComponents/ButtonWithMargin';
class SignInScreen extends React.Component<any, any> {
static navigationOptions = {
title: 'Please sign in',
};
render() {
return (
<View style={styles.container}>
<Button title="Sign in!" onPress={this.signInAsync} />
<Button
title="Go back to other examples"
onPress={() => this.props.navigation.goBack(null)}
/>
<StatusBar barStyle="default" />
</View>
);
}
signInAsync = async () => {
await AsyncStorage.setItem('userToken', 'abc');
this.props.navigation.navigate('Home');
};
}
class HomeScreen extends React.Component<any, any> {
static navigationOptions = {
title: 'Welcome to the app!',
};
render() {
return (
<View style={styles.container}>
<Button title="Show me more of the app" onPress={this.showMoreApp} />
<Button title="Actually, sign me out :)" onPress={this.signOutAsync} />
<StatusBar barStyle="default" />
</View>
);
}
showMoreApp = () => {
this.props.navigation.navigate('Other');
};
signOutAsync = async () => {
await AsyncStorage.clear();
this.props.navigation.navigate('Auth');
};
}
class OtherScreen extends React.Component<any, any> {
static navigationOptions = {
title: 'Lots of features here',
};
render() {
return (
<View style={styles.container}>
<Button title="I'm done, sign me out" onPress={this.signOutAsync} />
<StatusBar barStyle="default" />
</View>
);
}
signOutAsync = async () => {
await AsyncStorage.clear();
this.props.navigation.navigate('Auth');
};
}
class LoadingScreen extends React.Component<any, any> {
componentDidMount() {
this.bootstrapAsync();
}
bootstrapAsync = async () => {
const userToken = await AsyncStorage.getItem('userToken');
const initialRouteName = userToken ? 'App' : 'Auth';
this.props.navigation.navigate(initialRouteName);
};
render() {
return (
<View style={styles.container}>
<ActivityIndicator />
<StatusBar barStyle="default" />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
alignItems: 'center',
flex: 1,
justifyContent: 'center',
},
});
const AppStack = createStackNavigator({ Home: HomeScreen, Other: OtherScreen });
const AuthStack = createStackNavigator({ SignIn: SignInScreen });
export default createSwitchNavigator({
App: AppStack,
Auth: AuthStack,
Loading: LoadingScreen,
});

View File

@@ -1,29 +0,0 @@
import React from 'react';
import { Platform, ScrollView } from 'react-native';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import { createDrawerNavigator } from 'react-navigation';
import SimpleTabs from './SimpleTabs';
import StacksOverTabs from './StacksOverTabs';
const TabsInDrawer = createDrawerNavigator({
SimpleTabs: {
navigationOptions: {
drawerIcon: ({ tintColor }: { tintColor: string }) => (
<MaterialIcons name="filter-1" size={24} style={{ color: tintColor }} />
),
drawerLabel: 'Simple tabs',
},
screen: SimpleTabs,
},
StacksOverTabs: {
navigationOptions: {
drawerIcon: ({ tintColor }: { tintColor: string }) => (
<MaterialIcons name="filter-2" size={24} style={{ color: tintColor }} />
),
drawerLabel: 'Stacks Over Tabs',
},
screen: StacksOverTabs,
},
});
export default TabsInDrawer;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -1,151 +0,0 @@
import React from 'react';
import { AccessibilityState, Platform, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
export interface ButtonProps {
/**
* Text to display inside the button
*/
title: string,
/**
* Handler to be called when the user taps the button
*/
onPress: (event?: any) => void,
/**
* Color of the text (iOS), or background color of the button (Android)
*/
color?: string,
/**
* TV preferred focus (see documentation for the View component).
*/
hasTVPreferredFocus?: boolean,
/**
* Text to display for blindness accessibility features
*/
accessibilityLabel?: string,
/**
* If true, disable all interactions for this component.
*/
disabled?: boolean,
/**
* Used to locate this view in end-to-end tests.
*/
testID?: string,
};
/**
* A basic button component that should render nicely on any platform. Supports
* a minimal level of customization.
*
* <center><img src="img/buttonExample.png"></img></center>
*
* This button is built using TouchableOpacity
*
* Example usage:
*
* ```
* import { Button } from 'react-native';
* ...
*
* <Button
* onPress={onPressLearnMore}
* title="Learn More"
* color="#841584"
* accessibilityLabel="Learn more about this purple button"
* />
* ```
*
*/
export default class Button extends React.Component<ButtonProps> {
render() {
const {
accessibilityLabel,
color,
onPress,
title,
disabled,
testID,
} = this.props;
const buttonStyles: any = [styles.button];
const textStyles: any = [styles.text];
if (color) {
if (Platform.OS === 'ios') {
textStyles.push({ color });
} else {
buttonStyles.push({ backgroundColor: color });
}
}
const accessibilityStates: AccessibilityState[] = [];
if (disabled) {
buttonStyles.push(styles.buttonDisabled);
textStyles.push(styles.textDisabled);
accessibilityStates.push('disabled');
}
const formattedTitle =
Platform.OS === 'android' ? title.toUpperCase() : title;
return (
<TouchableOpacity
accessibilityLabel={accessibilityLabel}
accessibilityRole="button"
accessibilityStates={accessibilityStates}
testID={testID}
disabled={disabled}
onPress={onPress}
>
<View style={buttonStyles}>
<Text style={textStyles}>
{formattedTitle}
</Text>
</View>
</TouchableOpacity>
);
}
}
const styles = StyleSheet.create({
button: Platform.select({
android: {
backgroundColor: '#2196F3',
borderRadius: 2,
elevation: 4,
// Material design blue from https://material.google.com/style/color.html#color-color-palette
},
ios: {},
}),
buttonDisabled: Platform.select({
android: {
backgroundColor: '#dfdfdf',
elevation: 0,
},
ios: {},
}),
text: {
padding: 8,
textAlign: 'center',
...Platform.select({
android: {
color: 'white',
fontWeight: '500',
},
ios: {
// iOS blue from https://developer.apple.com/ios/human-interface-guidelines/visual-design/color/
color: '#007AFF',
fontSize: 18,
},
}),
},
textDisabled: Platform.select({
android: {
color: '#a1a1a1',
},
ios: {
color: '#cdcdcd',
},
}),
});

View File

@@ -1,19 +0,0 @@
import React from 'react';
import { Platform, StyleSheet, View } from 'react-native';
import BaseButton, { ButtonProps } from './Button';
export const Button = (props: ButtonProps) => (
<View style={styles.margin}>
<BaseButton {...props} />
</View>
);
const styles = StyleSheet.create({
margin: {
...Platform.select({
android: {
margin: 10,
},
}),
},
});

View File

@@ -1,16 +0,0 @@
import DefaultHeaderButtons from 'react-navigation-header-buttons';
import * as React from 'react';
import { Platform } from 'react-native';
export class HeaderButtons extends React.PureComponent {
static Item = DefaultHeaderButtons.Item;
render() {
return (
<DefaultHeaderButtons
// color={Platform.OS === 'ios' ? '#037aff' : 'black'}
{...this.props}
/>
);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

View File

@@ -0,0 +1,32 @@
// flow-typed signature: ee7b4028012cfdcd83cc6541a39b2282
// flow-typed version: <<STUB>>/babel-jest_v^21.0.0/flow_v0.61.0
/**
* This is an autogenerated libdef stub for:
*
* 'babel-jest'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'babel-jest' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'babel-jest/build/index' {
declare module.exports: any;
}
// Filename aliases
declare module 'babel-jest/build/index.js' {
declare module.exports: $Exports<'babel-jest/build/index'>;
}

View File

@@ -0,0 +1,823 @@
// flow-typed signature: c1ecfe71fbb86c3602b7da3d7c141df1
// flow-typed version: <<STUB>>/expo_v^24.0.2/flow_v0.61.0
/**
* This is an autogenerated libdef stub for:
*
* 'expo'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'expo' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'expo/AppEntry' {
declare module.exports: any;
}
declare module 'expo/flow/metro-bundler' {
declare module.exports: any;
}
declare module 'expo/flow/react-native-gesture-handler' {
declare module.exports: any;
}
declare module 'expo/src/__mocks__/Constants-development' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/Amplitude-test' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/AuthSession-test' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/Constants-test' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/ErrorRecovery-test' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/Expo-test' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/Facebook-test' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/Font-test' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/Location-test' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/Notifications-test' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/SecureStore-test' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/Segment-test' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/WebBrowser-test' {
declare module.exports: any;
}
declare module 'expo/src/admob/RNAdMobBanner' {
declare module.exports: any;
}
declare module 'expo/src/admob/RNAdMobInterstitial' {
declare module.exports: any;
}
declare module 'expo/src/admob/RNAdMobRewarded' {
declare module.exports: any;
}
declare module 'expo/src/admob/RNPublisherBanner' {
declare module.exports: any;
}
declare module 'expo/src/Amplitude' {
declare module.exports: any;
}
declare module 'expo/src/apisAreAvailable' {
declare module.exports: any;
}
declare module 'expo/src/Asset' {
declare module.exports: any;
}
declare module 'expo/src/AuthSession' {
declare module.exports: any;
}
declare module 'expo/src/av/Audio' {
declare module.exports: any;
}
declare module 'expo/src/av/Audio/Recording' {
declare module.exports: any;
}
declare module 'expo/src/av/Audio/Sound' {
declare module.exports: any;
}
declare module 'expo/src/av/AV' {
declare module.exports: any;
}
declare module 'expo/src/av/Video' {
declare module.exports: any;
}
declare module 'expo/src/BarCodeScanner.android' {
declare module.exports: any;
}
declare module 'expo/src/BarCodeScanner.ios' {
declare module.exports: any;
}
declare module 'expo/src/Brightness' {
declare module.exports: any;
}
declare module 'expo/src/Camera' {
declare module.exports: any;
}
declare module 'expo/src/CameraBasedBarCodeScanner' {
declare module.exports: any;
}
declare module 'expo/src/Constants' {
declare module.exports: any;
}
declare module 'expo/src/Contacts' {
declare module.exports: any;
}
declare module 'expo/src/DangerZone' {
declare module.exports: any;
}
declare module 'expo/src/DocumentPicker' {
declare module.exports: any;
}
declare module 'expo/src/effects/BlurView.android' {
declare module.exports: any;
}
declare module 'expo/src/effects/BlurView.ios' {
declare module.exports: any;
}
declare module 'expo/src/effects/LinearGradient.android' {
declare module.exports: any;
}
declare module 'expo/src/effects/LinearGradient.ios' {
declare module.exports: any;
}
declare module 'expo/src/environment/__tests__/validate-test' {
declare module.exports: any;
}
declare module 'expo/src/environment/logging' {
declare module.exports: any;
}
declare module 'expo/src/environment/validate' {
declare module.exports: any;
}
declare module 'expo/src/ErrorRecovery' {
declare module.exports: any;
}
declare module 'expo/src/Expo' {
declare module.exports: any;
}
declare module 'expo/src/facebook-ads/AdSettings' {
declare module.exports: any;
}
declare module 'expo/src/facebook-ads/BannerViewManager' {
declare module.exports: any;
}
declare module 'expo/src/facebook-ads/index' {
declare module.exports: any;
}
declare module 'expo/src/facebook-ads/InterstitialAdManager' {
declare module.exports: any;
}
declare module 'expo/src/facebook-ads/NativeAdsManager' {
declare module.exports: any;
}
declare module 'expo/src/facebook-ads/withNativeAd' {
declare module.exports: any;
}
declare module 'expo/src/Facebook' {
declare module.exports: any;
}
declare module 'expo/src/FaceDetector' {
declare module.exports: any;
}
declare module 'expo/src/FileSystem' {
declare module.exports: any;
}
declare module 'expo/src/Fingerprint' {
declare module.exports: any;
}
declare module 'expo/src/Font' {
declare module.exports: any;
}
declare module 'expo/src/GLView' {
declare module.exports: any;
}
declare module 'expo/src/Google' {
declare module.exports: any;
}
declare module 'expo/src/Icon' {
declare module.exports: any;
}
declare module 'expo/src/ImageManipulator' {
declare module.exports: any;
}
declare module 'expo/src/ImagePicker' {
declare module.exports: any;
}
declare module 'expo/src/IntentLauncherAndroid' {
declare module.exports: any;
}
declare module 'expo/src/KeepAwake' {
declare module.exports: any;
}
declare module 'expo/src/launch/AppLoading' {
declare module.exports: any;
}
declare module 'expo/src/launch/AppLoadingNativeWrapper.android' {
declare module.exports: any;
}
declare module 'expo/src/launch/AppLoadingNativeWrapper.ios' {
declare module.exports: any;
}
declare module 'expo/src/launch/registerRootComponent' {
declare module.exports: any;
}
declare module 'expo/src/launch/RootErrorBoundary' {
declare module.exports: any;
}
declare module 'expo/src/lib/Queue' {
declare module.exports: any;
}
declare module 'expo/src/Location' {
declare module.exports: any;
}
declare module 'expo/src/logs/__tests__/Logs-test' {
declare module.exports: any;
}
declare module 'expo/src/logs/__tests__/LogSerialization-test' {
declare module.exports: any;
}
declare module 'expo/src/logs/__tests__/RemoteConsole-test' {
declare module.exports: any;
}
declare module 'expo/src/logs/__tests__/RemoteLogging-test' {
declare module.exports: any;
}
declare module 'expo/src/logs/__tests__/RemoteLogs-test' {
declare module.exports: any;
}
declare module 'expo/src/logs/Logs' {
declare module.exports: any;
}
declare module 'expo/src/logs/LogSerialization' {
declare module.exports: any;
}
declare module 'expo/src/logs/RemoteConsole' {
declare module.exports: any;
}
declare module 'expo/src/logs/RemoteLogging' {
declare module.exports: any;
}
declare module 'expo/src/modal/Modal' {
declare module.exports: any;
}
declare module 'expo/src/modal/ModalHost' {
declare module.exports: any;
}
declare module 'expo/src/modal/ModalImplementation' {
declare module.exports: any;
}
declare module 'expo/src/modal/PureContainer' {
declare module.exports: any;
}
declare module 'expo/src/Notifications' {
declare module.exports: any;
}
declare module 'expo/src/OldBarCodeScanner' {
declare module.exports: any;
}
declare module 'expo/src/Payments' {
declare module.exports: any;
}
declare module 'expo/src/Pedometer' {
declare module.exports: any;
}
declare module 'expo/src/Permissions' {
declare module.exports: any;
}
declare module 'expo/src/ScreenOrientation' {
declare module.exports: any;
}
declare module 'expo/src/SecureStore' {
declare module.exports: any;
}
declare module 'expo/src/Segment' {
declare module.exports: any;
}
declare module 'expo/src/sensor/__tests__/Accelerometer-test' {
declare module.exports: any;
}
declare module 'expo/src/sensor/__tests__/DeviceMotion-test' {
declare module.exports: any;
}
declare module 'expo/src/sensor/__tests__/DeviceSensor-test' {
declare module.exports: any;
}
declare module 'expo/src/sensor/__tests__/Gyroscope-test' {
declare module.exports: any;
}
declare module 'expo/src/sensor/__tests__/Magnetometer-test' {
declare module.exports: any;
}
declare module 'expo/src/sensor/Accelerometer' {
declare module.exports: any;
}
declare module 'expo/src/sensor/DeviceMotion' {
declare module.exports: any;
}
declare module 'expo/src/sensor/DeviceSensor' {
declare module.exports: any;
}
declare module 'expo/src/sensor/Gyroscope' {
declare module.exports: any;
}
declare module 'expo/src/sensor/Magnetometer' {
declare module.exports: any;
}
declare module 'expo/src/sensor/MagnetometerUncalibrated' {
declare module.exports: any;
}
declare module 'expo/src/sensor/ThreeAxisSensor' {
declare module.exports: any;
}
declare module 'expo/src/Speech' {
declare module.exports: any;
}
declare module 'expo/src/SQLite' {
declare module.exports: any;
}
declare module 'expo/src/Svg' {
declare module.exports: any;
}
declare module 'expo/src/takeSnapshotAsync' {
declare module.exports: any;
}
declare module 'expo/src/timer/polyfillNextTick' {
declare module.exports: any;
}
declare module 'expo/src/Util' {
declare module.exports: any;
}
declare module 'expo/src/WebBrowser' {
declare module.exports: any;
}
declare module 'expo/tools/hashAssetFiles' {
declare module.exports: any;
}
declare module 'expo/tools/LogReporter' {
declare module.exports: any;
}
// Filename aliases
declare module 'expo/AppEntry.js' {
declare module.exports: $Exports<'expo/AppEntry'>;
}
declare module 'expo/flow/metro-bundler.js' {
declare module.exports: $Exports<'expo/flow/metro-bundler'>;
}
declare module 'expo/flow/react-native-gesture-handler.js' {
declare module.exports: $Exports<'expo/flow/react-native-gesture-handler'>;
}
declare module 'expo/src/__mocks__/Constants-development.js' {
declare module.exports: $Exports<'expo/src/__mocks__/Constants-development'>;
}
declare module 'expo/src/__tests__/Amplitude-test.js' {
declare module.exports: $Exports<'expo/src/__tests__/Amplitude-test'>;
}
declare module 'expo/src/__tests__/AuthSession-test.js' {
declare module.exports: $Exports<'expo/src/__tests__/AuthSession-test'>;
}
declare module 'expo/src/__tests__/Constants-test.js' {
declare module.exports: $Exports<'expo/src/__tests__/Constants-test'>;
}
declare module 'expo/src/__tests__/ErrorRecovery-test.js' {
declare module.exports: $Exports<'expo/src/__tests__/ErrorRecovery-test'>;
}
declare module 'expo/src/__tests__/Expo-test.js' {
declare module.exports: $Exports<'expo/src/__tests__/Expo-test'>;
}
declare module 'expo/src/__tests__/Facebook-test.js' {
declare module.exports: $Exports<'expo/src/__tests__/Facebook-test'>;
}
declare module 'expo/src/__tests__/Font-test.js' {
declare module.exports: $Exports<'expo/src/__tests__/Font-test'>;
}
declare module 'expo/src/__tests__/Location-test.js' {
declare module.exports: $Exports<'expo/src/__tests__/Location-test'>;
}
declare module 'expo/src/__tests__/Notifications-test.js' {
declare module.exports: $Exports<'expo/src/__tests__/Notifications-test'>;
}
declare module 'expo/src/__tests__/SecureStore-test.js' {
declare module.exports: $Exports<'expo/src/__tests__/SecureStore-test'>;
}
declare module 'expo/src/__tests__/Segment-test.js' {
declare module.exports: $Exports<'expo/src/__tests__/Segment-test'>;
}
declare module 'expo/src/__tests__/WebBrowser-test.js' {
declare module.exports: $Exports<'expo/src/__tests__/WebBrowser-test'>;
}
declare module 'expo/src/admob/RNAdMobBanner.js' {
declare module.exports: $Exports<'expo/src/admob/RNAdMobBanner'>;
}
declare module 'expo/src/admob/RNAdMobInterstitial.js' {
declare module.exports: $Exports<'expo/src/admob/RNAdMobInterstitial'>;
}
declare module 'expo/src/admob/RNAdMobRewarded.js' {
declare module.exports: $Exports<'expo/src/admob/RNAdMobRewarded'>;
}
declare module 'expo/src/admob/RNPublisherBanner.js' {
declare module.exports: $Exports<'expo/src/admob/RNPublisherBanner'>;
}
declare module 'expo/src/Amplitude.js' {
declare module.exports: $Exports<'expo/src/Amplitude'>;
}
declare module 'expo/src/apisAreAvailable.js' {
declare module.exports: $Exports<'expo/src/apisAreAvailable'>;
}
declare module 'expo/src/Asset.js' {
declare module.exports: $Exports<'expo/src/Asset'>;
}
declare module 'expo/src/AuthSession.js' {
declare module.exports: $Exports<'expo/src/AuthSession'>;
}
declare module 'expo/src/av/Audio.js' {
declare module.exports: $Exports<'expo/src/av/Audio'>;
}
declare module 'expo/src/av/Audio/Recording.js' {
declare module.exports: $Exports<'expo/src/av/Audio/Recording'>;
}
declare module 'expo/src/av/Audio/Sound.js' {
declare module.exports: $Exports<'expo/src/av/Audio/Sound'>;
}
declare module 'expo/src/av/AV.js' {
declare module.exports: $Exports<'expo/src/av/AV'>;
}
declare module 'expo/src/av/Video.js' {
declare module.exports: $Exports<'expo/src/av/Video'>;
}
declare module 'expo/src/BarCodeScanner.android.js' {
declare module.exports: $Exports<'expo/src/BarCodeScanner.android'>;
}
declare module 'expo/src/BarCodeScanner.ios.js' {
declare module.exports: $Exports<'expo/src/BarCodeScanner.ios'>;
}
declare module 'expo/src/Brightness.js' {
declare module.exports: $Exports<'expo/src/Brightness'>;
}
declare module 'expo/src/Camera.js' {
declare module.exports: $Exports<'expo/src/Camera'>;
}
declare module 'expo/src/CameraBasedBarCodeScanner.js' {
declare module.exports: $Exports<'expo/src/CameraBasedBarCodeScanner'>;
}
declare module 'expo/src/Constants.js' {
declare module.exports: $Exports<'expo/src/Constants'>;
}
declare module 'expo/src/Contacts.js' {
declare module.exports: $Exports<'expo/src/Contacts'>;
}
declare module 'expo/src/DangerZone.js' {
declare module.exports: $Exports<'expo/src/DangerZone'>;
}
declare module 'expo/src/DocumentPicker.js' {
declare module.exports: $Exports<'expo/src/DocumentPicker'>;
}
declare module 'expo/src/effects/BlurView.android.js' {
declare module.exports: $Exports<'expo/src/effects/BlurView.android'>;
}
declare module 'expo/src/effects/BlurView.ios.js' {
declare module.exports: $Exports<'expo/src/effects/BlurView.ios'>;
}
declare module 'expo/src/effects/LinearGradient.android.js' {
declare module.exports: $Exports<'expo/src/effects/LinearGradient.android'>;
}
declare module 'expo/src/effects/LinearGradient.ios.js' {
declare module.exports: $Exports<'expo/src/effects/LinearGradient.ios'>;
}
declare module 'expo/src/environment/__tests__/validate-test.js' {
declare module.exports: $Exports<'expo/src/environment/__tests__/validate-test'>;
}
declare module 'expo/src/environment/logging.js' {
declare module.exports: $Exports<'expo/src/environment/logging'>;
}
declare module 'expo/src/environment/validate.js' {
declare module.exports: $Exports<'expo/src/environment/validate'>;
}
declare module 'expo/src/ErrorRecovery.js' {
declare module.exports: $Exports<'expo/src/ErrorRecovery'>;
}
declare module 'expo/src/Expo.js' {
declare module.exports: $Exports<'expo/src/Expo'>;
}
declare module 'expo/src/facebook-ads/AdSettings.js' {
declare module.exports: $Exports<'expo/src/facebook-ads/AdSettings'>;
}
declare module 'expo/src/facebook-ads/BannerViewManager.js' {
declare module.exports: $Exports<'expo/src/facebook-ads/BannerViewManager'>;
}
declare module 'expo/src/facebook-ads/index.js' {
declare module.exports: $Exports<'expo/src/facebook-ads/index'>;
}
declare module 'expo/src/facebook-ads/InterstitialAdManager.js' {
declare module.exports: $Exports<'expo/src/facebook-ads/InterstitialAdManager'>;
}
declare module 'expo/src/facebook-ads/NativeAdsManager.js' {
declare module.exports: $Exports<'expo/src/facebook-ads/NativeAdsManager'>;
}
declare module 'expo/src/facebook-ads/withNativeAd.js' {
declare module.exports: $Exports<'expo/src/facebook-ads/withNativeAd'>;
}
declare module 'expo/src/Facebook.js' {
declare module.exports: $Exports<'expo/src/Facebook'>;
}
declare module 'expo/src/FaceDetector.js' {
declare module.exports: $Exports<'expo/src/FaceDetector'>;
}
declare module 'expo/src/FileSystem.js' {
declare module.exports: $Exports<'expo/src/FileSystem'>;
}
declare module 'expo/src/Fingerprint.js' {
declare module.exports: $Exports<'expo/src/Fingerprint'>;
}
declare module 'expo/src/Font.js' {
declare module.exports: $Exports<'expo/src/Font'>;
}
declare module 'expo/src/GLView.js' {
declare module.exports: $Exports<'expo/src/GLView'>;
}
declare module 'expo/src/Google.js' {
declare module.exports: $Exports<'expo/src/Google'>;
}
declare module 'expo/src/Icon.js' {
declare module.exports: $Exports<'expo/src/Icon'>;
}
declare module 'expo/src/ImageManipulator.js' {
declare module.exports: $Exports<'expo/src/ImageManipulator'>;
}
declare module 'expo/src/ImagePicker.js' {
declare module.exports: $Exports<'expo/src/ImagePicker'>;
}
declare module 'expo/src/IntentLauncherAndroid.js' {
declare module.exports: $Exports<'expo/src/IntentLauncherAndroid'>;
}
declare module 'expo/src/KeepAwake.js' {
declare module.exports: $Exports<'expo/src/KeepAwake'>;
}
declare module 'expo/src/launch/AppLoading.js' {
declare module.exports: $Exports<'expo/src/launch/AppLoading'>;
}
declare module 'expo/src/launch/AppLoadingNativeWrapper.android.js' {
declare module.exports: $Exports<'expo/src/launch/AppLoadingNativeWrapper.android'>;
}
declare module 'expo/src/launch/AppLoadingNativeWrapper.ios.js' {
declare module.exports: $Exports<'expo/src/launch/AppLoadingNativeWrapper.ios'>;
}
declare module 'expo/src/launch/registerRootComponent.js' {
declare module.exports: $Exports<'expo/src/launch/registerRootComponent'>;
}
declare module 'expo/src/launch/RootErrorBoundary.js' {
declare module.exports: $Exports<'expo/src/launch/RootErrorBoundary'>;
}
declare module 'expo/src/lib/Queue.js' {
declare module.exports: $Exports<'expo/src/lib/Queue'>;
}
declare module 'expo/src/Location.js' {
declare module.exports: $Exports<'expo/src/Location'>;
}
declare module 'expo/src/logs/__tests__/Logs-test.js' {
declare module.exports: $Exports<'expo/src/logs/__tests__/Logs-test'>;
}
declare module 'expo/src/logs/__tests__/LogSerialization-test.js' {
declare module.exports: $Exports<'expo/src/logs/__tests__/LogSerialization-test'>;
}
declare module 'expo/src/logs/__tests__/RemoteConsole-test.js' {
declare module.exports: $Exports<'expo/src/logs/__tests__/RemoteConsole-test'>;
}
declare module 'expo/src/logs/__tests__/RemoteLogging-test.js' {
declare module.exports: $Exports<'expo/src/logs/__tests__/RemoteLogging-test'>;
}
declare module 'expo/src/logs/__tests__/RemoteLogs-test.js' {
declare module.exports: $Exports<'expo/src/logs/__tests__/RemoteLogs-test'>;
}
declare module 'expo/src/logs/Logs.js' {
declare module.exports: $Exports<'expo/src/logs/Logs'>;
}
declare module 'expo/src/logs/LogSerialization.js' {
declare module.exports: $Exports<'expo/src/logs/LogSerialization'>;
}
declare module 'expo/src/logs/RemoteConsole.js' {
declare module.exports: $Exports<'expo/src/logs/RemoteConsole'>;
}
declare module 'expo/src/logs/RemoteLogging.js' {
declare module.exports: $Exports<'expo/src/logs/RemoteLogging'>;
}
declare module 'expo/src/modal/Modal.js' {
declare module.exports: $Exports<'expo/src/modal/Modal'>;
}
declare module 'expo/src/modal/ModalHost.js' {
declare module.exports: $Exports<'expo/src/modal/ModalHost'>;
}
declare module 'expo/src/modal/ModalImplementation.js' {
declare module.exports: $Exports<'expo/src/modal/ModalImplementation'>;
}
declare module 'expo/src/modal/PureContainer.js' {
declare module.exports: $Exports<'expo/src/modal/PureContainer'>;
}
declare module 'expo/src/Notifications.js' {
declare module.exports: $Exports<'expo/src/Notifications'>;
}
declare module 'expo/src/OldBarCodeScanner.js' {
declare module.exports: $Exports<'expo/src/OldBarCodeScanner'>;
}
declare module 'expo/src/Payments.js' {
declare module.exports: $Exports<'expo/src/Payments'>;
}
declare module 'expo/src/Pedometer.js' {
declare module.exports: $Exports<'expo/src/Pedometer'>;
}
declare module 'expo/src/Permissions.js' {
declare module.exports: $Exports<'expo/src/Permissions'>;
}
declare module 'expo/src/ScreenOrientation.js' {
declare module.exports: $Exports<'expo/src/ScreenOrientation'>;
}
declare module 'expo/src/SecureStore.js' {
declare module.exports: $Exports<'expo/src/SecureStore'>;
}
declare module 'expo/src/Segment.js' {
declare module.exports: $Exports<'expo/src/Segment'>;
}
declare module 'expo/src/sensor/__tests__/Accelerometer-test.js' {
declare module.exports: $Exports<'expo/src/sensor/__tests__/Accelerometer-test'>;
}
declare module 'expo/src/sensor/__tests__/DeviceMotion-test.js' {
declare module.exports: $Exports<'expo/src/sensor/__tests__/DeviceMotion-test'>;
}
declare module 'expo/src/sensor/__tests__/DeviceSensor-test.js' {
declare module.exports: $Exports<'expo/src/sensor/__tests__/DeviceSensor-test'>;
}
declare module 'expo/src/sensor/__tests__/Gyroscope-test.js' {
declare module.exports: $Exports<'expo/src/sensor/__tests__/Gyroscope-test'>;
}
declare module 'expo/src/sensor/__tests__/Magnetometer-test.js' {
declare module.exports: $Exports<'expo/src/sensor/__tests__/Magnetometer-test'>;
}
declare module 'expo/src/sensor/Accelerometer.js' {
declare module.exports: $Exports<'expo/src/sensor/Accelerometer'>;
}
declare module 'expo/src/sensor/DeviceMotion.js' {
declare module.exports: $Exports<'expo/src/sensor/DeviceMotion'>;
}
declare module 'expo/src/sensor/DeviceSensor.js' {
declare module.exports: $Exports<'expo/src/sensor/DeviceSensor'>;
}
declare module 'expo/src/sensor/Gyroscope.js' {
declare module.exports: $Exports<'expo/src/sensor/Gyroscope'>;
}
declare module 'expo/src/sensor/Magnetometer.js' {
declare module.exports: $Exports<'expo/src/sensor/Magnetometer'>;
}
declare module 'expo/src/sensor/MagnetometerUncalibrated.js' {
declare module.exports: $Exports<'expo/src/sensor/MagnetometerUncalibrated'>;
}
declare module 'expo/src/sensor/ThreeAxisSensor.js' {
declare module.exports: $Exports<'expo/src/sensor/ThreeAxisSensor'>;
}
declare module 'expo/src/Speech.js' {
declare module.exports: $Exports<'expo/src/Speech'>;
}
declare module 'expo/src/SQLite.js' {
declare module.exports: $Exports<'expo/src/SQLite'>;
}
declare module 'expo/src/Svg.js' {
declare module.exports: $Exports<'expo/src/Svg'>;
}
declare module 'expo/src/takeSnapshotAsync.js' {
declare module.exports: $Exports<'expo/src/takeSnapshotAsync'>;
}
declare module 'expo/src/timer/polyfillNextTick.js' {
declare module.exports: $Exports<'expo/src/timer/polyfillNextTick'>;
}
declare module 'expo/src/Util.js' {
declare module.exports: $Exports<'expo/src/Util'>;
}
declare module 'expo/src/WebBrowser.js' {
declare module.exports: $Exports<'expo/src/WebBrowser'>;
}
declare module 'expo/tools/hashAssetFiles.js' {
declare module.exports: $Exports<'expo/tools/hashAssetFiles'>;
}
declare module 'expo/tools/LogReporter.js' {
declare module.exports: $Exports<'expo/tools/LogReporter'>;
}

View File

@@ -0,0 +1,6 @@
// flow-typed signature: 6a5610678d4b01e13bbfbbc62bdaf583
// flow-typed version: 3817bc6980/flow-bin_v0.x.x/flow_>=v0.25.x
declare module "flow-bin" {
declare module.exports: string;
}

View File

@@ -0,0 +1,46 @@
// flow-typed signature: b1e3826a494aecf4ff482336321b54bd
// flow-typed version: <<STUB>>/jest-expo_v^24.0.0/flow_v0.61.0
/**
* This is an autogenerated libdef stub for:
*
* 'jest-expo'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'jest-expo' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'jest-expo/src/createMockConstants' {
declare module.exports: any;
}
declare module 'jest-expo/src/expoModules' {
declare module.exports: any;
}
declare module 'jest-expo/src/setup' {
declare module.exports: any;
}
// Filename aliases
declare module 'jest-expo/src/createMockConstants.js' {
declare module.exports: $Exports<'jest-expo/src/createMockConstants'>;
}
declare module 'jest-expo/src/expoModules.js' {
declare module.exports: $Exports<'jest-expo/src/expoModules'>;
}
declare module 'jest-expo/src/setup.js' {
declare module.exports: $Exports<'jest-expo/src/setup'>;
}

View File

@@ -0,0 +1,584 @@
// flow-typed signature: 107cf7068b8835594e97f938e8848244
// flow-typed version: 8b4dd96654/jest_v21.x.x/flow_>=v0.39.x
type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
(...args: TArguments): TReturn,
/**
* An object for introspecting mock calls
*/
mock: {
/**
* An array that represents all calls that have been made into this mock
* function. Each call is represented by an array of arguments that were
* passed during the call.
*/
calls: Array<TArguments>,
/**
* An array that contains all the object instances that have been
* instantiated from this mock function.
*/
instances: Array<TReturn>
},
/**
* Resets all information stored in the mockFn.mock.calls and
* mockFn.mock.instances arrays. Often this is useful when you want to clean
* up a mock's usage data between two assertions.
*/
mockClear(): void,
/**
* Resets all information stored in the mock. This is useful when you want to
* completely restore a mock back to its initial state.
*/
mockReset(): void,
/**
* Removes the mock and restores the initial implementation. This is useful
* when you want to mock functions in certain test cases and restore the
* original implementation in others. Beware that mockFn.mockRestore only
* works when mock was created with jest.spyOn. Thus you have to take care of
* restoration yourself when manually assigning jest.fn().
*/
mockRestore(): void,
/**
* Accepts a function that should be used as the implementation of the mock.
* The mock itself will still record all calls that go into and instances
* that come from itself -- the only difference is that the implementation
* will also be executed when the mock is called.
*/
mockImplementation(
fn: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>,
/**
* Accepts a function that will be used as an implementation of the mock for
* one call to the mocked function. Can be chained so that multiple function
* calls produce different results.
*/
mockImplementationOnce(
fn: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>,
/**
* Just a simple sugar function for returning `this`
*/
mockReturnThis(): void,
/**
* Deprecated: use jest.fn(() => value) instead
*/
mockReturnValue(value: TReturn): JestMockFn<TArguments, TReturn>,
/**
* Sugar for only returning a value once inside your mock
*/
mockReturnValueOnce(value: TReturn): JestMockFn<TArguments, TReturn>
};
type JestAsymmetricEqualityType = {
/**
* A custom Jasmine equality tester
*/
asymmetricMatch(value: mixed): boolean
};
type JestCallsType = {
allArgs(): mixed,
all(): mixed,
any(): boolean,
count(): number,
first(): mixed,
mostRecent(): mixed,
reset(): void
};
type JestClockType = {
install(): void,
mockDate(date: Date): void,
tick(milliseconds?: number): void,
uninstall(): void
};
type JestMatcherResult = {
message?: string | (() => string),
pass: boolean
};
type JestMatcher = (actual: any, expected: any) => JestMatcherResult;
type JestPromiseType = {
/**
* Use rejects to unwrap the reason of a rejected promise so any other
* matcher can be chained. If the promise is fulfilled the assertion fails.
*/
rejects: JestExpectType,
/**
* Use resolves to unwrap the value of a fulfilled promise so any other
* matcher can be chained. If the promise is rejected the assertion fails.
*/
resolves: JestExpectType
};
/**
* Plugin: jest-enzyme
*/
type EnzymeMatchersType = {
toBeChecked(): void,
toBeDisabled(): void,
toBeEmpty(): void,
toBePresent(): void,
toContainReact(element: React$Element<any>): void,
toHaveClassName(className: string): void,
toHaveHTML(html: string): void,
toHaveProp(propKey: string, propValue?: any): void,
toHaveRef(refName: string): void,
toHaveState(stateKey: string, stateValue?: any): void,
toHaveStyle(styleKey: string, styleValue?: any): void,
toHaveTagName(tagName: string): void,
toHaveText(text: string): void,
toIncludeText(text: string): void,
toHaveValue(value: any): void,
toMatchElement(element: React$Element<any>): void,
toMatchSelector(selector: string): void
};
type JestExpectType = {
not: JestExpectType & EnzymeMatchersType,
/**
* If you have a mock function, you can use .lastCalledWith to test what
* arguments it was last called with.
*/
lastCalledWith(...args: Array<any>): void,
/**
* toBe just checks that a value is what you expect. It uses === to check
* strict equality.
*/
toBe(value: any): void,
/**
* Use .toHaveBeenCalled to ensure that a mock function got called.
*/
toBeCalled(): void,
/**
* Use .toBeCalledWith to ensure that a mock function was called with
* specific arguments.
*/
toBeCalledWith(...args: Array<any>): void,
/**
* Using exact equality with floating point numbers is a bad idea. Rounding
* means that intuitive things fail.
*/
toBeCloseTo(num: number, delta: any): void,
/**
* Use .toBeDefined to check that a variable is not undefined.
*/
toBeDefined(): void,
/**
* Use .toBeFalsy when you don't care what a value is, you just want to
* ensure a value is false in a boolean context.
*/
toBeFalsy(): void,
/**
* To compare floating point numbers, you can use toBeGreaterThan.
*/
toBeGreaterThan(number: number): void,
/**
* To compare floating point numbers, you can use toBeGreaterThanOrEqual.
*/
toBeGreaterThanOrEqual(number: number): void,
/**
* To compare floating point numbers, you can use toBeLessThan.
*/
toBeLessThan(number: number): void,
/**
* To compare floating point numbers, you can use toBeLessThanOrEqual.
*/
toBeLessThanOrEqual(number: number): void,
/**
* Use .toBeInstanceOf(Class) to check that an object is an instance of a
* class.
*/
toBeInstanceOf(cls: Class<*>): void,
/**
* .toBeNull() is the same as .toBe(null) but the error messages are a bit
* nicer.
*/
toBeNull(): void,
/**
* Use .toBeTruthy when you don't care what a value is, you just want to
* ensure a value is true in a boolean context.
*/
toBeTruthy(): void,
/**
* Use .toBeUndefined to check that a variable is undefined.
*/
toBeUndefined(): void,
/**
* Use .toContain when you want to check that an item is in a list. For
* testing the items in the list, this uses ===, a strict equality check.
*/
toContain(item: any): void,
/**
* Use .toContainEqual when you want to check that an item is in a list. For
* testing the items in the list, this matcher recursively checks the
* equality of all fields, rather than checking for object identity.
*/
toContainEqual(item: any): void,
/**
* Use .toEqual when you want to check that two objects have the same value.
* This matcher recursively checks the equality of all fields, rather than
* checking for object identity.
*/
toEqual(value: any): void,
/**
* Use .toHaveBeenCalled to ensure that a mock function got called.
*/
toHaveBeenCalled(): void,
/**
* Use .toHaveBeenCalledTimes to ensure that a mock function got called exact
* number of times.
*/
toHaveBeenCalledTimes(number: number): void,
/**
* Use .toHaveBeenCalledWith to ensure that a mock function was called with
* specific arguments.
*/
toHaveBeenCalledWith(...args: Array<any>): void,
/**
* Use .toHaveBeenLastCalledWith to ensure that a mock function was last called
* with specific arguments.
*/
toHaveBeenLastCalledWith(...args: Array<any>): void,
/**
* Check that an object has a .length property and it is set to a certain
* numeric value.
*/
toHaveLength(number: number): void,
/**
*
*/
toHaveProperty(propPath: string, value?: any): void,
/**
* Use .toMatch to check that a string matches a regular expression or string.
*/
toMatch(regexpOrString: RegExp | string): void,
/**
* Use .toMatchObject to check that a javascript object matches a subset of the properties of an object.
*/
toMatchObject(object: Object | Array<Object>): void,
/**
* This ensures that a React component matches the most recent snapshot.
*/
toMatchSnapshot(name?: string): void,
/**
* Use .toThrow to test that a function throws when it is called.
* If you want to test that a specific error gets thrown, you can provide an
* argument to toThrow. The argument can be a string for the error message,
* a class for the error, or a regex that should match the error.
*
* Alias: .toThrowError
*/
toThrow(message?: string | Error | Class<Error> | RegExp): void,
toThrowError(message?: string | Error | Class<Error> | RegExp): void,
/**
* Use .toThrowErrorMatchingSnapshot to test that a function throws a error
* matching the most recent snapshot when it is called.
*/
toThrowErrorMatchingSnapshot(): void
};
type JestObjectType = {
/**
* Disables automatic mocking in the module loader.
*
* After this method is called, all `require()`s will return the real
* versions of each module (rather than a mocked version).
*/
disableAutomock(): JestObjectType,
/**
* An un-hoisted version of disableAutomock
*/
autoMockOff(): JestObjectType,
/**
* Enables automatic mocking in the module loader.
*/
enableAutomock(): JestObjectType,
/**
* An un-hoisted version of enableAutomock
*/
autoMockOn(): JestObjectType,
/**
* Clears the mock.calls and mock.instances properties of all mocks.
* Equivalent to calling .mockClear() on every mocked function.
*/
clearAllMocks(): JestObjectType,
/**
* Resets the state of all mocks. Equivalent to calling .mockReset() on every
* mocked function.
*/
resetAllMocks(): JestObjectType,
/**
* Removes any pending timers from the timer system.
*/
clearAllTimers(): void,
/**
* The same as `mock` but not moved to the top of the expectation by
* babel-jest.
*/
doMock(moduleName: string, moduleFactory?: any): JestObjectType,
/**
* The same as `unmock` but not moved to the top of the expectation by
* babel-jest.
*/
dontMock(moduleName: string): JestObjectType,
/**
* Returns a new, unused mock function. Optionally takes a mock
* implementation.
*/
fn<TArguments: $ReadOnlyArray<*>, TReturn>(
implementation?: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>,
/**
* Determines if the given function is a mocked function.
*/
isMockFunction(fn: Function): boolean,
/**
* Given the name of a module, use the automatic mocking system to generate a
* mocked version of the module for you.
*/
genMockFromModule(moduleName: string): any,
/**
* Mocks a module with an auto-mocked version when it is being required.
*
* The second argument can be used to specify an explicit module factory that
* is being run instead of using Jest's automocking feature.
*
* The third argument can be used to create virtual mocks -- mocks of modules
* that don't exist anywhere in the system.
*/
mock(
moduleName: string,
moduleFactory?: any,
options?: Object
): JestObjectType,
/**
* Returns the actual module instead of a mock, bypassing all checks on
* whether the module should receive a mock implementation or not.
*/
requireActual(moduleName: string): any,
/**
* Returns a mock module instead of the actual module, bypassing all checks
* on whether the module should be required normally or not.
*/
requireMock(moduleName: string): any,
/**
* Resets the module registry - the cache of all required modules. This is
* useful to isolate modules where local state might conflict between tests.
*/
resetModules(): JestObjectType,
/**
* Exhausts the micro-task queue (usually interfaced in node via
* process.nextTick).
*/
runAllTicks(): void,
/**
* Exhausts the macro-task queue (i.e., all tasks queued by setTimeout(),
* setInterval(), and setImmediate()).
*/
runAllTimers(): void,
/**
* Exhausts all tasks queued by setImmediate().
*/
runAllImmediates(): void,
/**
* Executes only the macro task queue (i.e. all tasks queued by setTimeout()
* or setInterval() and setImmediate()).
*/
runTimersToTime(msToRun: number): void,
/**
* Executes only the macro-tasks that are currently pending (i.e., only the
* tasks that have been queued by setTimeout() or setInterval() up to this
* point)
*/
runOnlyPendingTimers(): void,
/**
* Explicitly supplies the mock object that the module system should return
* for the specified module. Note: It is recommended to use jest.mock()
* instead.
*/
setMock(moduleName: string, moduleExports: any): JestObjectType,
/**
* Indicates that the module system should never return a mocked version of
* the specified module from require() (e.g. that it should always return the
* real module).
*/
unmock(moduleName: string): JestObjectType,
/**
* Instructs Jest to use fake versions of the standard timer functions
* (setTimeout, setInterval, clearTimeout, clearInterval, nextTick,
* setImmediate and clearImmediate).
*/
useFakeTimers(): JestObjectType,
/**
* Instructs Jest to use the real versions of the standard timer functions.
*/
useRealTimers(): JestObjectType,
/**
* Creates a mock function similar to jest.fn but also tracks calls to
* object[methodName].
*/
spyOn(object: Object, methodName: string): JestMockFn<any, any>,
/**
* Set the default timeout interval for tests and before/after hooks in milliseconds.
* Note: The default timeout interval is 5 seconds if this method is not called.
*/
setTimeout(timeout: number): JestObjectType
};
type JestSpyType = {
calls: JestCallsType
};
/** Runs this function after every test inside this context */
declare function afterEach(
fn: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void;
/** Runs this function before every test inside this context */
declare function beforeEach(
fn: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void;
/** Runs this function after all tests have finished inside this context */
declare function afterAll(
fn: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void;
/** Runs this function before any tests have started inside this context */
declare function beforeAll(
fn: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void;
/** A context for grouping tests together */
declare var describe: {
/**
* Creates a block that groups together several related tests in one "test suite"
*/
(name: string, fn: () => void): void,
/**
* Only run this describe block
*/
only(name: string, fn: () => void): void,
/**
* Skip running this describe block
*/
skip(name: string, fn: () => void): void
};
/** An individual test unit */
declare var it: {
/**
* An individual test unit
*
* @param {string} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
(
name: string,
fn?: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void,
/**
* Only run this test
*
* @param {string} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
only(
name: string,
fn?: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void,
/**
* Skip running this test
*
* @param {string} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
skip(
name: string,
fn?: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void,
/**
* Run the test concurrently
*
* @param {string} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
concurrent(
name: string,
fn?: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void
};
declare function fit(
name: string,
fn: (done: () => void) => ?Promise<mixed>,
timeout?: number
): void;
/** An individual test unit */
declare var test: typeof it;
/** A disabled group of tests */
declare var xdescribe: typeof describe;
/** A focused group of tests */
declare var fdescribe: typeof describe;
/** A disabled individual test */
declare var xit: typeof it;
/** A disabled individual test */
declare var xtest: typeof it;
/** The expect function is used every time you want to test a value */
declare var expect: {
/** The object that you want to make assertions against */
(value: any): JestExpectType & JestPromiseType & EnzymeMatchersType,
/** Add additional Jasmine matchers to Jest's roster */
extend(matchers: { [name: string]: JestMatcher }): void,
/** Add a module that formats application-specific data structures. */
addSnapshotSerializer(serializer: (input: Object) => string): void,
assertions(expectedAssertions: number): void,
hasAssertions(): void,
any(value: mixed): JestAsymmetricEqualityType,
anything(): void,
arrayContaining(value: Array<mixed>): void,
objectContaining(value: Object): void,
/** Matches any received string that contains the exact expected string. */
stringContaining(value: string): void,
stringMatching(value: string | RegExp): void
};
// TODO handle return type
// http://jasmine.github.io/2.4/introduction.html#section-Spies
declare function spyOn(value: mixed, method: string): Object;
/** Holds all functions related to manipulating test runner */
declare var jest: JestObjectType;
/**
* The global Jasmine object, this is generally not exposed as the public API,
* using features inside here could break in later versions of Jest.
*/
declare var jasmine: {
DEFAULT_TIMEOUT_INTERVAL: number,
any(value: mixed): JestAsymmetricEqualityType,
anything(): void,
arrayContaining(value: Array<mixed>): void,
clock(): JestClockType,
createSpy(name: string): JestSpyType,
createSpyObj(
baseName: string,
methodNames: Array<string>
): { [methodName: string]: JestSpyType },
objectContaining(value: Object): void,
stringMatching(value: string): void
};

View File

@@ -0,0 +1,39 @@
// flow-typed signature: 3ba80f288ae054d394dca2d025d14dd9
// flow-typed version: <<STUB>>/jest_v^21.0.1/flow_v0.53.0
/**
* This is an autogenerated libdef stub for:
*
* 'jest'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'jest' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'jest/bin/jest' {
declare module.exports: any;
}
declare module 'jest/build/jest' {
declare module.exports: any;
}
// Filename aliases
declare module 'jest/bin/jest.js' {
declare module.exports: $Exports<'jest/bin/jest'>;
}
declare module 'jest/build/jest.js' {
declare module.exports: $Exports<'jest/build/jest'>;
}

View File

@@ -0,0 +1,33 @@
// flow-typed signature: fe3ce80849031f84c8c106122bef896a
// flow-typed version: <<STUB>>/react-addons-test-utils_v16.0.0-alpha.3/flow_v0.53.0
/**
* This is an autogenerated libdef stub for:
*
* 'react-addons-test-utils'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'react-addons-test-utils' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
// Filename aliases
declare module 'react-addons-test-utils/index' {
declare module.exports: $Exports<'react-addons-test-utils'>;
}
declare module 'react-addons-test-utils/index.js' {
declare module.exports: $Exports<'react-addons-test-utils'>;
}

View File

@@ -0,0 +1,123 @@
// flow-typed signature: 42d8cd2e84e894c09d28f891fef9f01d
// flow-typed version: <<STUB>>/react-native-scripts_v^1.5.0/flow_v0.61.0
/**
* This is an autogenerated libdef stub for:
*
* 'react-native-scripts'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'react-native-scripts' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'react-native-scripts/build/bin/crna-entry' {
declare module.exports: any;
}
declare module 'react-native-scripts/build/bin/react-native-scripts' {
declare module.exports: any;
}
declare module 'react-native-scripts/build/scripts/android' {
declare module.exports: any;
}
declare module 'react-native-scripts/build/scripts/eject' {
declare module.exports: any;
}
declare module 'react-native-scripts/build/scripts/init' {
declare module.exports: any;
}
declare module 'react-native-scripts/build/scripts/ios' {
declare module.exports: any;
}
declare module 'react-native-scripts/build/scripts/start' {
declare module.exports: any;
}
declare module 'react-native-scripts/build/util/clearConsole' {
declare module.exports: any;
}
declare module 'react-native-scripts/build/util/expo' {
declare module.exports: any;
}
declare module 'react-native-scripts/build/util/install' {
declare module.exports: any;
}
declare module 'react-native-scripts/build/util/log' {
declare module.exports: any;
}
declare module 'react-native-scripts/build/util/packager' {
declare module.exports: any;
}
declare module 'react-native-scripts/template/App' {
declare module.exports: any;
}
declare module 'react-native-scripts/template/App.test' {
declare module.exports: any;
}
// Filename aliases
declare module 'react-native-scripts/build/bin/crna-entry.js' {
declare module.exports: $Exports<'react-native-scripts/build/bin/crna-entry'>;
}
declare module 'react-native-scripts/build/bin/react-native-scripts.js' {
declare module.exports: $Exports<'react-native-scripts/build/bin/react-native-scripts'>;
}
declare module 'react-native-scripts/build/scripts/android.js' {
declare module.exports: $Exports<'react-native-scripts/build/scripts/android'>;
}
declare module 'react-native-scripts/build/scripts/eject.js' {
declare module.exports: $Exports<'react-native-scripts/build/scripts/eject'>;
}
declare module 'react-native-scripts/build/scripts/init.js' {
declare module.exports: $Exports<'react-native-scripts/build/scripts/init'>;
}
declare module 'react-native-scripts/build/scripts/ios.js' {
declare module.exports: $Exports<'react-native-scripts/build/scripts/ios'>;
}
declare module 'react-native-scripts/build/scripts/start.js' {
declare module.exports: $Exports<'react-native-scripts/build/scripts/start'>;
}
declare module 'react-native-scripts/build/util/clearConsole.js' {
declare module.exports: $Exports<'react-native-scripts/build/util/clearConsole'>;
}
declare module 'react-native-scripts/build/util/expo.js' {
declare module.exports: $Exports<'react-native-scripts/build/util/expo'>;
}
declare module 'react-native-scripts/build/util/install.js' {
declare module.exports: $Exports<'react-native-scripts/build/util/install'>;
}
declare module 'react-native-scripts/build/util/log.js' {
declare module.exports: $Exports<'react-native-scripts/build/util/log'>;
}
declare module 'react-native-scripts/build/util/packager.js' {
declare module.exports: $Exports<'react-native-scripts/build/util/packager'>;
}
declare module 'react-native-scripts/template/App.js' {
declare module.exports: $Exports<'react-native-scripts/template/App'>;
}
declare module 'react-native-scripts/template/App.test.js' {
declare module.exports: $Exports<'react-native-scripts/template/App.test'>;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,62 @@
// flow-typed signature: 2d946f2ec4aba5210b19d053c411a59d
// flow-typed version: 95b3e05165/react-test-renderer_v16.x.x/flow_>=v0.47.x
// Type definitions for react-test-renderer 16.x.x
// Ported from: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-test-renderer
type ReactTestRendererJSON = {
type: string,
props: { [propName: string]: any },
children: null | ReactTestRendererJSON[]
};
type ReactTestRendererTree = ReactTestRendererJSON & {
nodeType: "component" | "host",
instance: any,
rendered: null | ReactTestRendererTree
};
type ReactTestInstance = {
instance: any,
type: string,
props: { [propName: string]: any },
parent: null | ReactTestInstance,
children: Array<ReactTestInstance | string>,
find(predicate: (node: ReactTestInstance) => boolean): ReactTestInstance,
findByType(type: React$ElementType): ReactTestInstance,
findByProps(props: { [propName: string]: any }): ReactTestInstance,
findAll(
predicate: (node: ReactTestInstance) => boolean,
options?: { deep: boolean }
): ReactTestInstance[],
findAllByType(
type: React$ElementType,
options?: { deep: boolean }
): ReactTestInstance[],
findAllByProps(
props: { [propName: string]: any },
options?: { deep: boolean }
): ReactTestInstance[]
};
type ReactTestRenderer = {
toJSON(): null | ReactTestRendererJSON,
toTree(): null | ReactTestRendererTree,
unmount(nextElement?: React$Element<any>): void,
update(nextElement: React$Element<any>): void,
getInstance(): null | ReactTestInstance,
root: ReactTestInstance
};
type TestRendererOptions = {
createNodeMock(element: React$Element<any>): any
};
declare module "react-test-renderer" {
declare function create(
nextElement: React$Element<any>,
options?: TestRendererOptions
): ReactTestRenderer;
}

View File

@@ -0,0 +1,66 @@
// flow-typed signature: bc77d9125cee5869fd1f9ffe55231e21
// flow-typed version: <<STUB>>/react-test-renderer_v16.0.0-alpha.12/flow_v0.53.0
/**
* This is an autogenerated libdef stub for:
*
* 'react-test-renderer'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'react-test-renderer' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'react-test-renderer/cjs/react-test-renderer-shallow.development' {
declare module.exports: any;
}
declare module 'react-test-renderer/cjs/react-test-renderer-stack.development' {
declare module.exports: any;
}
declare module 'react-test-renderer/cjs/react-test-renderer.development' {
declare module.exports: any;
}
declare module 'react-test-renderer/shallow' {
declare module.exports: any;
}
declare module 'react-test-renderer/stack' {
declare module.exports: any;
}
// Filename aliases
declare module 'react-test-renderer/cjs/react-test-renderer-shallow.development.js' {
declare module.exports: $Exports<'react-test-renderer/cjs/react-test-renderer-shallow.development'>;
}
declare module 'react-test-renderer/cjs/react-test-renderer-stack.development.js' {
declare module.exports: $Exports<'react-test-renderer/cjs/react-test-renderer-stack.development'>;
}
declare module 'react-test-renderer/cjs/react-test-renderer.development.js' {
declare module.exports: $Exports<'react-test-renderer/cjs/react-test-renderer.development'>;
}
declare module 'react-test-renderer/index' {
declare module.exports: $Exports<'react-test-renderer'>;
}
declare module 'react-test-renderer/index.js' {
declare module.exports: $Exports<'react-test-renderer'>;
}
declare module 'react-test-renderer/shallow.js' {
declare module.exports: $Exports<'react-test-renderer/shallow'>;
}
declare module 'react-test-renderer/stack.js' {
declare module.exports: $Exports<'react-test-renderer/stack'>;
}

View File

@@ -1,7 +0,0 @@
/** @format */
import { AppRegistry } from 'react-native';
import App from './app/App';
import { name as appName } from './app.json';
AppRegistry.registerComponent(appName, () => App);

View File

@@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSAppTransportSecurity</key>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

Some files were not shown because too many files have changed in this diff Show More