This commit is contained in:
probeadd 2017-08-29 17:36:10 +07:00
commit d99f1fc07c
111 changed files with 14572 additions and 2205 deletions

View File

@ -18,7 +18,6 @@
"publish-rn": {
"presets": ["react-native-syntax"],
"plugins": [
"flow-react-proptypes",
"transform-flow-strip-types"
]
},
@ -26,7 +25,6 @@
"publish-web": {
"presets": ["es2015", "stage-1", "react"],
"plugins": [
"flow-react-proptypes",
"transform-flow-strip-types"
]
}

View File

@ -3,7 +3,7 @@ jobs:
build:
docker:
- image: reactcommunity/node-ci:7.10.0-1 # custom image -- includes ocaml, libelf1, Yarn
parallelism: 3
parallelism: 2
working_directory: ~/react-navigation
steps:
- checkout

View File

@ -1,5 +1,6 @@
coverage
flow-typed
flow
node_modules
lib*

View File

@ -54,7 +54,7 @@
2,
"boolean"
],
"flowtype/no-weak-types": 1,
"flowtype/no-weak-types": 0,
"flowtype/require-parameter-type": 2,
"flowtype/require-return-type": [
0,

View File

@ -21,12 +21,10 @@
; Ignore misc packages
.*/node_modules/eslint-.*
.*/node_modules/react-native-tab-view/.*
; 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
.*/node_modules/react-native/Libraries/react-native/React.js
.*/node_modules/react-native/Libraries/react-native/ReactNative.js
; Ignore react-native
.*/node_modules/react-native/.*
<PROJECT_ROOT>/lib
<PROJECT_ROOT>/lib-rn
@ -35,9 +33,6 @@
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
flow/
[options]
module.system=haste
@ -46,7 +41,11 @@ 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.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\)$' -> '<PROJECT_ROOT>/stubs/RelativeImageStub.js.flow'
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js
suppress_type=$FlowIssue
suppress_type=$FlowFixMe

View File

@ -1,18 +1,25 @@
<!---
BEFORE YOU SUBMIT please search open/closed issues since someone might have asked the same thing before!
-->
## Before You Start...
The issue list is reserved exclusively for bug reports and feature requests. That means we do not accept usage questions.
For usage questions, please use the following resources:
- [Read the docs](https://reactnavigation.org/)
- [Ask on the Reactiflux (#react-navigation)](https://discord.gg/reactiflux)
- [Look for / ask questions on StackOverflow](https://stackoverflow.com/questions/tagged/react-navigation)
- Also try to search for your issue - it may have already been answered or even fixed in the development branch. However, if you find that an old, closed issue still persists in the latest version, you should open a new issue.
---
### Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior.
Provide a screenshot when possible and full code sample -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
- _If describing a bug, tell us what happens. Provide a screenshot when possible and full code sample_
- _If suggesting a change/improvement, explain the difference from current behavior_
### Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->
- _If you're describing a bug, tell us what should happen_
- _If you're suggesting a change/improvement, tell us how it should work_
### Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
- _Include as many relevant details about the environment you experienced the bug in_
| software | version
| ---------------- | -------

View File

@ -116,7 +116,7 @@ You can easily override the default component used by `react-navigation`:
import { DrawerItems } from 'react-navigation';
const CustomDrawerContentComponent = (props) => (
<View style={style.container}>
<View style={styles.container}>
<DrawerItems {...props} />
</View>
);

View File

@ -61,6 +61,8 @@ const MyApp = TabNavigator({
screen: MyNotificationsScreen,
},
}, {
tabBarPosition: 'top',
animationEnabled: true,
tabBarOptions: {
activeTintColor: '#e91e63',
},

View File

@ -125,5 +125,5 @@ Object.assign(MyApp.router, {
}
return previousGetActionForPathAndParams(path, params);
},
};
});
```

View File

@ -8,9 +8,9 @@ Navigation views are controlled React components that can present the current na
- [CardStack](https://github.com/react-community/react-navigation/blob/master/src/views/CardStack.js) - Present a stack that looks suitable on any platform
+ [Card](https://github.com/react-community/react-navigation/blob/master/src/views/Card.js) - Present one card from the card stack, with gestures
+ [Header](https://github.com/react-community/react-navigation/blob/master/src/views/Header.js) - The header view for the card stack
- [Tabs](https://github.com/react-community/react-navigation/blob/master/src/views/TabView) - A configurable tab switcher / pager
- [Drawer](https://github.com/react-community/react-navigation/tree/master/src/views/Drawer) - A view with a drawer that slides from the left
+ [Header](https://github.com/react-community/react-navigation/blob/master/src/views/Header/Header.js) - The header view for the card stack
- [Tabs](https://github.com/react-community/react-navigation/blob/master/src/views/TabView/TabView.js) - A configurable tab switcher / pager
- [Drawer](https://github.com/react-community/react-navigation/blob/master/src/views/Drawer/DrawerView.js) - A view with a drawer that slides from the left
## [Transitioner](/docs/views/transitioner)

View File

@ -1,5 +1,13 @@
{
"presets": ["babel-preset-expo"],
"plugins": [
["module-resolver", {
"alias": {
"react-native": "./node_modules/react-native",
"react": "./node_modules/react"
}
}]
],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]

View File

@ -30,12 +30,24 @@
; Ignore react-native-fbads dependency of the expo sdk
.*/node_modules/react-native-fbads/*
.*/node_modules/react-native-tab-view/.*
; Ignore react-native
.*/node_modules/react-native/.*
.*/react-navigation/lib-rn/.*
.*/react-navigation/lib/.*
.*/react-navigation/src/.*
.*/react-navigation/node_modules/.*
.*/react-navigation/examples/ReduxExample/.*
.*/react-navigation/website/.*
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow
flow/
../../flow-typed/react-native.js
../../flow/react-navigation.js
[options]
module.system=haste
@ -58,6 +70,3 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=true
[version]
^0.40.0

View File

@ -12,8 +12,8 @@
"icon": "./assets/icons/react-navigation.png",
"hideExponentText": false
},
"sdkVersion": "16.0.0",
"entryPoint": "./examples/NavigationPlayground/node_modules/react-native-scripts/build/bin/crna-entry.js",
"sdkVersion": "18.0.0",
"entryPoint": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"packagerOpts": {
"projectRoots": "",
"assetExts": [

View File

@ -0,0 +1,32 @@
// flow-typed signature: 02359da7064195804e62c853de1fc44e
// flow-typed version: <<STUB>>/babel-jest_v^20.0.1/flow_v0.49.1
/**
* 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,403 @@
// flow-typed signature: 444bd87de0128136ea844018abc25fed
// flow-typed version: <<STUB>>/expo_v^18.0.0/flow_v0.49.1
/**
* 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/src/__tests__/helpers' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/Location-tests' {
declare module.exports: any;
}
declare module 'expo/src/__tests__/Notifications-tests' {
declare module.exports: any;
}
declare module 'expo/src/Accelerometer' {
declare module.exports: any;
}
declare module 'expo/src/apisAreAvailable' {
declare module.exports: any;
}
declare module 'expo/src/AppLoading.android' {
declare module.exports: any;
}
declare module 'expo/src/AppLoading.ios' {
declare module.exports: any;
}
declare module 'expo/src/Asset' {
declare module.exports: any;
}
declare module 'expo/src/Audio' {
declare module.exports: any;
}
declare module 'expo/src/AV' {
declare module.exports: any;
}
declare module 'expo/src/BarCodeScanner' {
declare module.exports: any;
}
declare module 'expo/src/BlurView.android' {
declare module.exports: any;
}
declare module 'expo/src/BlurView.ios' {
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/createTHREEViewClass' {
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/Expo' {
declare module.exports: any;
}
declare module 'expo/src/Facebook' {
declare module.exports: any;
}
declare module 'expo/src/FacebookAds/AdSettings' {
declare module.exports: any;
}
declare module 'expo/src/FacebookAds/BannerViewManager' {
declare module.exports: any;
}
declare module 'expo/src/FacebookAds/index' {
declare module.exports: any;
}
declare module 'expo/src/FacebookAds/InterstitialAdManager' {
declare module.exports: any;
}
declare module 'expo/src/FacebookAds/NativeAdsManager' {
declare module.exports: any;
}
declare module 'expo/src/FacebookAds/withNativeAd' {
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/Gyroscope' {
declare module.exports: any;
}
declare module 'expo/src/Icon' {
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/LegacyAsyncStorage.android' {
declare module.exports: any;
}
declare module 'expo/src/LegacyAsyncStorage.ios' {
declare module.exports: any;
}
declare module 'expo/src/lib/createSensorWrapper' {
declare module.exports: any;
}
declare module 'expo/src/lib/Queue' {
declare module.exports: any;
}
declare module 'expo/src/LinearGradient.android' {
declare module.exports: any;
}
declare module 'expo/src/LinearGradient.ios' {
declare module.exports: any;
}
declare module 'expo/src/Location' {
declare module.exports: any;
}
declare module 'expo/src/Logs' {
declare module.exports: any;
}
declare module 'expo/src/Notifications' {
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/registerRootComponent' {
declare module.exports: any;
}
declare module 'expo/src/ScreenOrientation' {
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/Video' {
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/src/__tests__/helpers.js' {
declare module.exports: $Exports<'expo/src/__tests__/helpers'>;
}
declare module 'expo/src/__tests__/Location-tests.js' {
declare module.exports: $Exports<'expo/src/__tests__/Location-tests'>;
}
declare module 'expo/src/__tests__/Notifications-tests.js' {
declare module.exports: $Exports<'expo/src/__tests__/Notifications-tests'>;
}
declare module 'expo/src/Accelerometer.js' {
declare module.exports: $Exports<'expo/src/Accelerometer'>;
}
declare module 'expo/src/apisAreAvailable.js' {
declare module.exports: $Exports<'expo/src/apisAreAvailable'>;
}
declare module 'expo/src/AppLoading.android.js' {
declare module.exports: $Exports<'expo/src/AppLoading.android'>;
}
declare module 'expo/src/AppLoading.ios.js' {
declare module.exports: $Exports<'expo/src/AppLoading.ios'>;
}
declare module 'expo/src/Asset.js' {
declare module.exports: $Exports<'expo/src/Asset'>;
}
declare module 'expo/src/Audio.js' {
declare module.exports: $Exports<'expo/src/Audio'>;
}
declare module 'expo/src/AV.js' {
declare module.exports: $Exports<'expo/src/AV'>;
}
declare module 'expo/src/BarCodeScanner.js' {
declare module.exports: $Exports<'expo/src/BarCodeScanner'>;
}
declare module 'expo/src/BlurView.android.js' {
declare module.exports: $Exports<'expo/src/BlurView.android'>;
}
declare module 'expo/src/BlurView.ios.js' {
declare module.exports: $Exports<'expo/src/BlurView.ios'>;
}
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/createTHREEViewClass.js' {
declare module.exports: $Exports<'expo/src/createTHREEViewClass'>;
}
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/Expo.js' {
declare module.exports: $Exports<'expo/src/Expo'>;
}
declare module 'expo/src/Facebook.js' {
declare module.exports: $Exports<'expo/src/Facebook'>;
}
declare module 'expo/src/FacebookAds/AdSettings.js' {
declare module.exports: $Exports<'expo/src/FacebookAds/AdSettings'>;
}
declare module 'expo/src/FacebookAds/BannerViewManager.js' {
declare module.exports: $Exports<'expo/src/FacebookAds/BannerViewManager'>;
}
declare module 'expo/src/FacebookAds/index.js' {
declare module.exports: $Exports<'expo/src/FacebookAds/index'>;
}
declare module 'expo/src/FacebookAds/InterstitialAdManager.js' {
declare module.exports: $Exports<'expo/src/FacebookAds/InterstitialAdManager'>;
}
declare module 'expo/src/FacebookAds/NativeAdsManager.js' {
declare module.exports: $Exports<'expo/src/FacebookAds/NativeAdsManager'>;
}
declare module 'expo/src/FacebookAds/withNativeAd.js' {
declare module.exports: $Exports<'expo/src/FacebookAds/withNativeAd'>;
}
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/Gyroscope.js' {
declare module.exports: $Exports<'expo/src/Gyroscope'>;
}
declare module 'expo/src/Icon.js' {
declare module.exports: $Exports<'expo/src/Icon'>;
}
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/LegacyAsyncStorage.android.js' {
declare module.exports: $Exports<'expo/src/LegacyAsyncStorage.android'>;
}
declare module 'expo/src/LegacyAsyncStorage.ios.js' {
declare module.exports: $Exports<'expo/src/LegacyAsyncStorage.ios'>;
}
declare module 'expo/src/lib/createSensorWrapper.js' {
declare module.exports: $Exports<'expo/src/lib/createSensorWrapper'>;
}
declare module 'expo/src/lib/Queue.js' {
declare module.exports: $Exports<'expo/src/lib/Queue'>;
}
declare module 'expo/src/LinearGradient.android.js' {
declare module.exports: $Exports<'expo/src/LinearGradient.android'>;
}
declare module 'expo/src/LinearGradient.ios.js' {
declare module.exports: $Exports<'expo/src/LinearGradient.ios'>;
}
declare module 'expo/src/Location.js' {
declare module.exports: $Exports<'expo/src/Location'>;
}
declare module 'expo/src/Logs.js' {
declare module.exports: $Exports<'expo/src/Logs'>;
}
declare module 'expo/src/Notifications.js' {
declare module.exports: $Exports<'expo/src/Notifications'>;
}
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/registerRootComponent.js' {
declare module.exports: $Exports<'expo/src/registerRootComponent'>;
}
declare module 'expo/src/ScreenOrientation.js' {
declare module.exports: $Exports<'expo/src/ScreenOrientation'>;
}
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/Video.js' {
declare module.exports: $Exports<'expo/src/Video'>;
}
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,53 @@
// flow-typed signature: 78cb3ace3a9f947db21eb0844455536c
// flow-typed version: <<STUB>>/jest-expo_v^0.4.0/flow_v0.49.1
/**
* 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/bridgeMock' {
declare module.exports: any;
}
declare module 'jest-expo/src/exponentModules' {
declare module.exports: any;
}
declare module 'jest-expo/src/index' {
declare module.exports: any;
}
declare module 'jest-expo/src/setup' {
declare module.exports: any;
}
// Filename aliases
declare module 'jest-expo/src/bridgeMock.js' {
declare module.exports: $Exports<'jest-expo/src/bridgeMock'>;
}
declare module 'jest-expo/src/exponentModules.js' {
declare module.exports: $Exports<'jest-expo/src/exponentModules'>;
}
declare module 'jest-expo/src/index.js' {
declare module.exports: $Exports<'jest-expo/src/index'>;
}
declare module 'jest-expo/src/setup.js' {
declare module.exports: $Exports<'jest-expo/src/setup'>;
}

View File

@ -1,5 +1,5 @@
// flow-typed signature: 269340ea4ca4555368bd144efc3753b4
// flow-typed version: 2b78d73874/jest_v17.x.x/flow_>=v0.33.x
// flow-typed signature: a0369c11661f437ec4ccdd805579ddcf
// flow-typed version: c4b9fea7c9/jest_v20.x.x/flow_>=v0.33.x
type JestMockFn = {
(...args: Array<any>): any,
@ -17,7 +17,7 @@ type JestMockFn = {
* An array that contains all the object instances that have been
* instantiated from this mock function.
*/
instances: mixed,
instances: mixed
},
/**
* Resets all information stored in the mockFn.mock.calls and
@ -30,6 +30,14 @@ type JestMockFn = {
* completely restore a mock back to its initial state.
*/
mockReset(): Function,
/**
* 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(): Function,
/**
* 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
@ -54,15 +62,15 @@ type JestMockFn = {
/**
* Sugar for only returning a value once inside your mock
*/
mockReturnValueOnce(value: any): JestMockFn,
}
mockReturnValueOnce(value: any): JestMockFn
};
type JestAsymmetricEqualityType = {
/**
* A custom Jasmine equality tester
*/
asymmetricMatch(value: mixed): boolean,
}
asymmetricMatch(value: mixed): boolean
};
type JestCallsType = {
allArgs(): mixed,
@ -71,25 +79,61 @@ type JestCallsType = {
count(): number,
first(): mixed,
mostRecent(): mixed,
reset(): void,
}
reset(): void
};
type JestClockType = {
install(): void,
mockDate(date: Date): void,
tick(): void,
uninstall(): void,
}
tick(milliseconds?: number): void,
uninstall(): void
};
type JestMatcherResult = {
message?: string | ()=>string,
pass: boolean,
}
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,
not: JestExpectType & EnzymeMatchersType,
/**
* If you have a mock function, you can use .lastCalledWith to test what
* arguments it was last called with.
@ -190,29 +234,47 @@ type JestExpectType = {
*/
toHaveBeenCalledWith(...args: Array<any>): void,
/**
* Use .toMatch to check that a string matches a regular expression.
* Use .toHaveBeenLastCalledWith to ensure that a mock function was last called
* with specific arguments.
*/
toMatch(regexp: RegExp): void,
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): void,
/**
* This ensures that a React component matches the most recent snapshot.
*/
toMatchSnapshot(): void,
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): void,
/**
* Use .toThrowError to test that a function throws a specific error when it
* is called. The argument can be a string for the error message, a class for
* the error, or a regex that should match the error.
*/
toThrow(message?: string | Error | RegExp): void,
toThrowError(message?: string | Error | RegExp): void,
/**
* Use .toThrowErrorMatchingSnapshot to test that a function throws a error
* matching the most recent snapshot when it is called.
*/
toThrowErrorMatchingSnapshot(): void,
}
toThrowErrorMatchingSnapshot(): void
};
type JestObjectType = {
/**
@ -234,6 +296,11 @@ type 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.
@ -276,7 +343,11 @@ type JestObjectType = {
* 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): JestObjectType,
mock(
moduleName: string,
moduleFactory?: any,
options?: Object
): JestObjectType,
/**
* Resets the module registry - the cache of all required modules. This is
* useful to isolate modules where local state might conflict between tests.
@ -329,11 +400,16 @@ type 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
};
type JestSpyType = {
calls: JestCallsType,
}
calls: JestCallsType
};
/** Runs this function after every test inside this context */
declare function afterEach(fn: Function): void;
@ -343,8 +419,25 @@ declare function beforeEach(fn: Function): void;
declare function afterAll(fn: Function): void;
/** Runs this function before any tests have started inside this context */
declare function beforeAll(fn: Function): void;
/** A context for grouping tests together */
declare function describe(name: string, fn: Function): void;
declare var describe: {
/**
* Creates a block that groups together several related tests in one "test suite"
*/
(name: string, fn: Function): void,
/**
* Only run this describe block
*/
only(name: string, fn: Function): void,
/**
* Skip running this describe block
*/
skip(name: string, fn: Function): void,
};
/** An individual test unit */
declare var it: {
@ -369,6 +462,13 @@ declare var it: {
* @param {Function} Test
*/
skip(name: string, fn?: Function): ?Promise<void>,
/**
* Run the test concurrently
*
* @param {string} Name of Test
* @param {Function} Test
*/
concurrent(name: string, fn?: Function): ?Promise<void>
};
declare function fit(name: string, fn: Function): ?Promise<void>;
/** An individual test unit */
@ -385,9 +485,20 @@ 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,
(value: any): JestExpectType & JestPromiseType & EnzymeMatchersType,
/** Add additional Jasmine matchers to Jest's roster */
extend(matchers: {[name:string]: JestMatcher}): void,
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
@ -395,7 +506,7 @@ declare var expect: {
declare function spyOn(value: mixed, method: string): Object;
/** Holds all functions related to manipulating test runner */
declare var jest: JestObjectType
declare var jest: JestObjectType;
/**
* The global Jamine object, this is generally not exposed as the public API,
@ -408,6 +519,10 @@ declare var jasmine: {
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,
}
stringMatching(value: string): void
};

View File

@ -0,0 +1,109 @@
// flow-typed signature: b977a47341d5daaaaf60fbb3a052a329
// flow-typed version: <<STUB>>/react-native-scripts_v^0.0.40/flow_v0.49.1
/**
* 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/expo' {
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/expo.js' {
declare module.exports: $Exports<'react-native-scripts/build/util/expo'>;
}
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

@ -63,7 +63,7 @@ const CustomTabBar = ({ navigation }) => {
const CustomTabView = ({ router, navigation }) => {
const { routes, index } = navigation.state;
const ActiveScreen = router.getComponentForState(navigation.state);
const ActiveScreen = router.getComponentForRouteName(routes[index].routeName);
return (
<View style={styles.container}>
<CustomTabBar navigation={navigation} />

View File

@ -2,14 +2,7 @@
"name": "NavigationPlayground",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-jest": "^20.0.1",
"jest": "^20.0.1",
"jest-expo": "^0.4.0",
"react-navigation": "file:../..",
"react-test-renderer": "15.5.4"
},
"main": "./examples/node_modules/react-native-scripts/build/bin/crna-entry.js",
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
@ -18,18 +11,35 @@
"test": "node node_modules/jest/bin/jest.js"
},
"dependencies": {
"expo": "^16.0.0",
"react": "16.0.0-alpha.6",
"react-native": "^0.43.4"
"expo": "^18.0.9",
"flow-bin": "^0.49.1",
"react": "16.0.0-alpha.12",
"react-native": "^0.45.1",
"react-navigation": "*"
},
"devDependencies": {
"babel-jest": "^20.0.1",
"jest": "^20.0.1",
"jest-expo": "^18.0.0",
"react-addons-test-utils": "16.0.0-alpha.3",
"react-native-scripts": "^0.0.50",
"react-test-renderer": "16.0.0-alpha.13"
},
"jest": {
"preset": "jest-expo",
"moduleFileExtensions": [
"web.js",
"js",
"json",
"jsx",
"node"
],
"modulePathIgnorePatterns": [
"/node_modules\/.*\/react-native/",
"/node_modules\/.*\/react/"
"/node_modules/.*/react-native/",
"/node_modules/.*/react/"
],
"transformIgnorePatterns": [
"/node_modules\/(?!react-native|react-navigation)/"
"/node_modules/(?!react-native|react-navigation)/"
]
}
}

View File

@ -8,41 +8,34 @@
const fs = require('fs');
const path = require('path');
const blacklist = require('react-native/packager/blacklist');
const config = require('react-native/packager/rn-cli.config');
const CURRENT_EXAMPLE = 'NavigationPlayground';
const examples = getDirectories(path.join(__dirname, '..'));
const CURRENT_EXAMPLE = 'NavigationPlayground';
const getBlacklistForExample = (example) => [
...examples.filter(x => x !== example).map(exampleName => new RegExp(`${path.resolve(__dirname, '..')}/${exampleName}/(.*)`))
];
const config = {};
config.getBlacklist = () => [
new RegExp(
`${path.resolve(__dirname, '../..')}/node_modules/react-native/(.*)`
),
new RegExp(`${path.resolve(__dirname, '../..')}/node_modules/react/(.*)`),
new RegExp(`${path.resolve(__dirname, '../..')}/lib-rn/(.*)`),
new RegExp(`${path.resolve(__dirname, '../..')}/lib/(.*)`),
...getBlacklistForExample(CURRENT_EXAMPLE)
];
config.getBlacklistRE = () => blacklist(config.getBlacklist());
config.getTransformModulePath = () =>
path.resolve(__dirname, 'transformer.js');
config.getTransformOptions = () => ({
reactNativePath: path.resolve(__dirname, 'node_modules/react-native/'),
reactPath: path.resolve(__dirname, 'node_modules/react/'),
});
config.getProjectRoots = () => getRoots();
config.getAssetRoots = () => getRoots();
function getRoots() {
return [path.join(__dirname, '..', '..')];
return [path.join(__dirname)];
}
function getDirectories (srcpath) {
function getDirectories(srcpath) {
return fs.readdirSync(srcpath)
.filter(file => fs.lstatSync(path.join(srcpath, file)).isDirectory())
}

View File

@ -1,127 +0,0 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* Note: This is a fork of the fb-specific transform.js
* Specifically, it uses 'babel-plugin-module-resolver' to rewrite requires for
* 'react-native' and 'react' to point to the passed in paths from the transformer
* options, and also utilizes babel-preset-expo for other Exponent specific transforms.
*/
const path = require('path');
const babel = require('babel-core');
const reactTransformPlugin = require('babel-plugin-react-transform').default;
const hmrTransform = 'react-transform-hmr/lib/index.js';
const transformPath = require.resolve(hmrTransform);
const makeHMRConfig = function(options, filename) {
const transform = filename
? './' + path.relative(path.dirname(filename), transformPath) // packager can't handle absolute paths
: hmrTransform;
return {
plugins: [
[
reactTransformPlugin,
{
transforms: [
{
transform,
imports: ['react-native'],
locals: ['module'],
},
],
},
],
],
};
};
const buildAliasPreset = (reactNativePath, reactPath) => ({
plugins: [
[
require('babel-plugin-module-resolver').default,
{
alias: Object.assign(
{},
{
'react-native': path.resolve(
`${reactNativePath || './node_modules/react-native'}`
),
react: path.resolve(`${reactPath || './node_modules/react'}`),
},
require('babel-preset-expo').plugins[0][1].alias
),
cwd: path.resolve(__dirname, '..'),
},
],
],
});
/**
* Given a filename and options, build a Babel
* config object with the appropriate plugins.
*/
function buildBabelConfig(filename, options) {
const exponentBabelPreset = require('babel-preset-expo');
const babelConfig = {
presets: [
...exponentBabelPreset.presets,
buildAliasPreset(options.reactNativePath, options.reactPath),
],
plugins: [],
};
const extraConfig = {
filename,
sourceFileName: filename,
babelrc: false,
};
let config = Object.assign({}, babelConfig, extraConfig);
let extraPresets = [];
if (options.hot) {
const hmrConfig = makeHMRConfig(options, filename);
extraPresets.push(hmrConfig);
}
config.presets = [...config.presets, ...extraPresets];
return Object.assign({}, babelConfig, config);
}
function transform(src, filename, options) {
options = options || {};
const babelConfig = buildBabelConfig(filename, options);
const result = babel.transform(src, babelConfig);
return {
ast: result.ast,
code: result.code,
map: result.map,
filename,
};
}
module.exports = function(data, callback) {
let result;
try {
result = transform(data.sourceCode, data.filename, data.options);
} catch (e) {
callback(e);
return;
}
callback(null, result);
};
// export for use in jest
module.exports.transform = transform;

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
// flow-typed signature: b1c74048f05b9f11f9179ceca00117e2
// flow-typed version: <<STUB>>/babel-cli_v^6.18.0/flow_v0.37.0
// flow-typed signature: 50cccc4d25daa131ce5273d84f010572
// flow-typed version: <<STUB>>/babel-cli_v^6.24.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:

View File

@ -1,5 +1,5 @@
// flow-typed signature: b0378db1d784937726ae12c16aa220bf
// flow-typed version: <<STUB>>/babel-core_v^6.18.2/flow_v0.37.0
// flow-typed signature: b44c78d7279f78b485d76b15c08cd683
// flow-typed version: <<STUB>>/babel-core_v^6.24.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
@ -30,6 +30,14 @@ declare module 'babel-core/lib/api/node' {
declare module.exports: any;
}
declare module 'babel-core/lib/helpers/get-possible-plugin-names' {
declare module.exports: any;
}
declare module 'babel-core/lib/helpers/get-possible-preset-names' {
declare module.exports: any;
}
declare module 'babel-core/lib/helpers/merge' {
declare module.exports: any;
}
@ -38,6 +46,18 @@ declare module 'babel-core/lib/helpers/normalize-ast' {
declare module.exports: any;
}
declare module 'babel-core/lib/helpers/resolve-from-possible-names' {
declare module.exports: any;
}
declare module 'babel-core/lib/helpers/resolve-plugin' {
declare module.exports: any;
}
declare module 'babel-core/lib/helpers/resolve-preset' {
declare module.exports: any;
}
declare module 'babel-core/lib/helpers/resolve' {
declare module.exports: any;
}
@ -127,12 +147,27 @@ declare module 'babel-core/lib/api/browser.js' {
declare module 'babel-core/lib/api/node.js' {
declare module.exports: $Exports<'babel-core/lib/api/node'>;
}
declare module 'babel-core/lib/helpers/get-possible-plugin-names.js' {
declare module.exports: $Exports<'babel-core/lib/helpers/get-possible-plugin-names'>;
}
declare module 'babel-core/lib/helpers/get-possible-preset-names.js' {
declare module.exports: $Exports<'babel-core/lib/helpers/get-possible-preset-names'>;
}
declare module 'babel-core/lib/helpers/merge.js' {
declare module.exports: $Exports<'babel-core/lib/helpers/merge'>;
}
declare module 'babel-core/lib/helpers/normalize-ast.js' {
declare module.exports: $Exports<'babel-core/lib/helpers/normalize-ast'>;
}
declare module 'babel-core/lib/helpers/resolve-from-possible-names.js' {
declare module.exports: $Exports<'babel-core/lib/helpers/resolve-from-possible-names'>;
}
declare module 'babel-core/lib/helpers/resolve-plugin.js' {
declare module.exports: $Exports<'babel-core/lib/helpers/resolve-plugin'>;
}
declare module 'babel-core/lib/helpers/resolve-preset.js' {
declare module.exports: $Exports<'babel-core/lib/helpers/resolve-preset'>;
}
declare module 'babel-core/lib/helpers/resolve.js' {
declare module.exports: $Exports<'babel-core/lib/helpers/resolve'>;
}

View File

@ -1,5 +1,5 @@
// flow-typed signature: 1c9bec8ce6fd389e61c1c246d35bb7c5
// flow-typed version: <<STUB>>/babel-eslint_v^7.0.0/flow_v0.37.0
// flow-typed signature: 1bf74b25fb82cd002e8b966a31086e1a
// flow-typed version: <<STUB>>/babel-eslint_v^7.2.3/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
@ -26,6 +26,10 @@ declare module 'babel-eslint/babylon-to-espree/attachComments' {
declare module.exports: any;
}
declare module 'babel-eslint/babylon-to-espree/convertComments' {
declare module.exports: any;
}
declare module 'babel-eslint/babylon-to-espree/convertTemplateType' {
declare module.exports: any;
}
@ -50,6 +54,9 @@ declare module 'babel-eslint/babylon-to-espree/toTokens' {
declare module 'babel-eslint/babylon-to-espree/attachComments.js' {
declare module.exports: $Exports<'babel-eslint/babylon-to-espree/attachComments'>;
}
declare module 'babel-eslint/babylon-to-espree/convertComments.js' {
declare module.exports: $Exports<'babel-eslint/babylon-to-espree/convertComments'>;
}
declare module 'babel-eslint/babylon-to-espree/convertTemplateType.js' {
declare module.exports: $Exports<'babel-eslint/babylon-to-espree/convertTemplateType'>;
}

View File

@ -1,5 +1,5 @@
// flow-typed signature: 857bbea11904991ace904e4eb98bb2af
// flow-typed version: <<STUB>>/babel-jest_v^17.0.2/flow_v0.37.0
// flow-typed signature: 02359da7064195804e62c853de1fc44e
// flow-typed version: <<STUB>>/babel-jest_v^20.0.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:

View File

@ -0,0 +1,53 @@
// flow-typed signature: c062ec7795b0fd3de749c140ded3d740
// flow-typed version: <<STUB>>/babel-plugin-flow-react-proptypes_v^2.2.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
*
* 'babel-plugin-flow-react-proptypes'
*
* 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-plugin-flow-react-proptypes' {
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-plugin-flow-react-proptypes/lib/convertToPropTypes' {
declare module.exports: any;
}
declare module 'babel-plugin-flow-react-proptypes/lib/index' {
declare module.exports: any;
}
declare module 'babel-plugin-flow-react-proptypes/lib/makePropTypesAst' {
declare module.exports: any;
}
declare module 'babel-plugin-flow-react-proptypes/lib/util' {
declare module.exports: any;
}
// Filename aliases
declare module 'babel-plugin-flow-react-proptypes/lib/convertToPropTypes.js' {
declare module.exports: $Exports<'babel-plugin-flow-react-proptypes/lib/convertToPropTypes'>;
}
declare module 'babel-plugin-flow-react-proptypes/lib/index.js' {
declare module.exports: $Exports<'babel-plugin-flow-react-proptypes/lib/index'>;
}
declare module 'babel-plugin-flow-react-proptypes/lib/makePropTypesAst.js' {
declare module.exports: $Exports<'babel-plugin-flow-react-proptypes/lib/makePropTypesAst'>;
}
declare module 'babel-plugin-flow-react-proptypes/lib/util.js' {
declare module.exports: $Exports<'babel-plugin-flow-react-proptypes/lib/util'>;
}

View File

@ -1,5 +1,5 @@
// flow-typed signature: 6bc70afacfe0b49915c0557886b866c0
// flow-typed version: <<STUB>>/babel-preset-es2015_v^6.18.0/flow_v0.37.0
// flow-typed signature: 245300d27bbcd9eed2c688a7d1073392
// flow-typed version: <<STUB>>/babel-preset-es2015_v^6.24.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:

View File

@ -0,0 +1,38 @@
// flow-typed signature: 85f35727e0cc7a372bd958ff80f08110
// flow-typed version: <<STUB>>/babel-preset-react-native-stage-0_v^1.0.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
*
* 'babel-preset-react-native-stage-0'
*
* 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-preset-react-native-stage-0' {
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-preset-react-native-stage-0/decorator-support' {
declare module.exports: any;
}
// Filename aliases
declare module 'babel-preset-react-native-stage-0/decorator-support.js' {
declare module.exports: $Exports<'babel-preset-react-native-stage-0/decorator-support'>;
}
declare module 'babel-preset-react-native-stage-0/index' {
declare module.exports: $Exports<'babel-preset-react-native-stage-0'>;
}
declare module 'babel-preset-react-native-stage-0/index.js' {
declare module.exports: $Exports<'babel-preset-react-native-stage-0'>;
}

View File

@ -1,5 +1,5 @@
// flow-typed signature: f81837494149f0b7e37e2dea1e774496
// flow-typed version: <<STUB>>/babel-preset-react-native-syntax_v^1.0.0/flow_v0.37.0
// flow-typed signature: ad52b8fa9995651201720389a0746966
// flow-typed version: <<STUB>>/babel-preset-react-native-syntax_v^1.0.0/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:

View File

@ -1,5 +1,5 @@
// flow-typed signature: 2ac38a3f71516b7f69ed258dc00ec7d6
// flow-typed version: <<STUB>>/babel-preset-react-native_v^1.9.0/flow_v0.37.0
// flow-typed signature: b132a45b70b401796d625d8180574c91
// flow-typed version: <<STUB>>/babel-preset-react-native_v^1.9.2/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:

View File

@ -1,5 +1,5 @@
// flow-typed signature: dea3aea052d70d190e83a8fd2ceac38e
// flow-typed version: <<STUB>>/babel-preset-react_v^6.16.0/flow_v0.37.0
// flow-typed signature: 56127a0e27b24bbabb45b01aa4c6768a
// flow-typed version: <<STUB>>/babel-preset-react_v^6.24.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:

View File

@ -1,5 +1,5 @@
// flow-typed signature: 5af7dc07b1c2948498099def76a10fce
// flow-typed version: <<STUB>>/babel-preset-stage-1_v^6.16.0/flow_v0.37.0
// flow-typed signature: 76ca3ede38f503bec8f3b45f45389773
// flow-typed version: <<STUB>>/babel-preset-stage-1_v^6.24.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:

View File

@ -1,5 +1,5 @@
// flow-typed signature: 618cc1f52320db6c303091d22222169b
// flow-typed version: <<STUB>>/clamp_v^1.0.1/flow_v0.37.0
// flow-typed signature: 8133090576c61cecf16348212e5ebd02
// flow-typed version: <<STUB>>/clamp_v^1.0.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:

276
flow-typed/npm/codecov_vx.x.x.js vendored Normal file
View File

@ -0,0 +1,276 @@
// flow-typed signature: ad1840bbbf16a47effbbfa3f63f45a8d
// flow-typed version: <<STUB>>/codecov_v^2.2.0/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
*
* 'codecov'
*
* 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 'codecov' {
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 'codecov/lib/codecov' {
declare module.exports: any;
}
declare module 'codecov/lib/detect' {
declare module.exports: any;
}
declare module 'codecov/lib/git' {
declare module.exports: any;
}
declare module 'codecov/lib/offline' {
declare module.exports: any;
}
declare module 'codecov/lib/services/appveyor' {
declare module.exports: any;
}
declare module 'codecov/lib/services/buildkite' {
declare module.exports: any;
}
declare module 'codecov/lib/services/circle' {
declare module.exports: any;
}
declare module 'codecov/lib/services/codeship' {
declare module.exports: any;
}
declare module 'codecov/lib/services/drone' {
declare module.exports: any;
}
declare module 'codecov/lib/services/gitlab' {
declare module.exports: any;
}
declare module 'codecov/lib/services/jenkins' {
declare module.exports: any;
}
declare module 'codecov/lib/services/localGit' {
declare module.exports: any;
}
declare module 'codecov/lib/services/semaphore' {
declare module.exports: any;
}
declare module 'codecov/lib/services/shippable' {
declare module.exports: any;
}
declare module 'codecov/lib/services/snap' {
declare module.exports: any;
}
declare module 'codecov/lib/services/travis' {
declare module.exports: any;
}
declare module 'codecov/lib/services/wercker' {
declare module.exports: any;
}
declare module 'codecov/test/detect' {
declare module.exports: any;
}
declare module 'codecov/test/git' {
declare module.exports: any;
}
declare module 'codecov/test/index' {
declare module.exports: any;
}
declare module 'codecov/test/services/appveyor' {
declare module.exports: any;
}
declare module 'codecov/test/services/buildkite' {
declare module.exports: any;
}
declare module 'codecov/test/services/circle' {
declare module.exports: any;
}
declare module 'codecov/test/services/codeship' {
declare module.exports: any;
}
declare module 'codecov/test/services/drone' {
declare module.exports: any;
}
declare module 'codecov/test/services/gitlab' {
declare module.exports: any;
}
declare module 'codecov/test/services/jenkins' {
declare module.exports: any;
}
declare module 'codecov/test/services/localGit' {
declare module.exports: any;
}
declare module 'codecov/test/services/semaphore' {
declare module.exports: any;
}
declare module 'codecov/test/services/shippable' {
declare module.exports: any;
}
declare module 'codecov/test/services/snap' {
declare module.exports: any;
}
declare module 'codecov/test/services/travis' {
declare module.exports: any;
}
declare module 'codecov/test/services/wercker' {
declare module.exports: any;
}
declare module 'codecov/test/upload' {
declare module.exports: any;
}
declare module 'codecov/testinit' {
declare module.exports: any;
}
// Filename aliases
declare module 'codecov/index' {
declare module.exports: $Exports<'codecov'>;
}
declare module 'codecov/index.js' {
declare module.exports: $Exports<'codecov'>;
}
declare module 'codecov/lib/codecov.js' {
declare module.exports: $Exports<'codecov/lib/codecov'>;
}
declare module 'codecov/lib/detect.js' {
declare module.exports: $Exports<'codecov/lib/detect'>;
}
declare module 'codecov/lib/git.js' {
declare module.exports: $Exports<'codecov/lib/git'>;
}
declare module 'codecov/lib/offline.js' {
declare module.exports: $Exports<'codecov/lib/offline'>;
}
declare module 'codecov/lib/services/appveyor.js' {
declare module.exports: $Exports<'codecov/lib/services/appveyor'>;
}
declare module 'codecov/lib/services/buildkite.js' {
declare module.exports: $Exports<'codecov/lib/services/buildkite'>;
}
declare module 'codecov/lib/services/circle.js' {
declare module.exports: $Exports<'codecov/lib/services/circle'>;
}
declare module 'codecov/lib/services/codeship.js' {
declare module.exports: $Exports<'codecov/lib/services/codeship'>;
}
declare module 'codecov/lib/services/drone.js' {
declare module.exports: $Exports<'codecov/lib/services/drone'>;
}
declare module 'codecov/lib/services/gitlab.js' {
declare module.exports: $Exports<'codecov/lib/services/gitlab'>;
}
declare module 'codecov/lib/services/jenkins.js' {
declare module.exports: $Exports<'codecov/lib/services/jenkins'>;
}
declare module 'codecov/lib/services/localGit.js' {
declare module.exports: $Exports<'codecov/lib/services/localGit'>;
}
declare module 'codecov/lib/services/semaphore.js' {
declare module.exports: $Exports<'codecov/lib/services/semaphore'>;
}
declare module 'codecov/lib/services/shippable.js' {
declare module.exports: $Exports<'codecov/lib/services/shippable'>;
}
declare module 'codecov/lib/services/snap.js' {
declare module.exports: $Exports<'codecov/lib/services/snap'>;
}
declare module 'codecov/lib/services/travis.js' {
declare module.exports: $Exports<'codecov/lib/services/travis'>;
}
declare module 'codecov/lib/services/wercker.js' {
declare module.exports: $Exports<'codecov/lib/services/wercker'>;
}
declare module 'codecov/test/detect.js' {
declare module.exports: $Exports<'codecov/test/detect'>;
}
declare module 'codecov/test/git.js' {
declare module.exports: $Exports<'codecov/test/git'>;
}
declare module 'codecov/test/index.js' {
declare module.exports: $Exports<'codecov/test/index'>;
}
declare module 'codecov/test/services/appveyor.js' {
declare module.exports: $Exports<'codecov/test/services/appveyor'>;
}
declare module 'codecov/test/services/buildkite.js' {
declare module.exports: $Exports<'codecov/test/services/buildkite'>;
}
declare module 'codecov/test/services/circle.js' {
declare module.exports: $Exports<'codecov/test/services/circle'>;
}
declare module 'codecov/test/services/codeship.js' {
declare module.exports: $Exports<'codecov/test/services/codeship'>;
}
declare module 'codecov/test/services/drone.js' {
declare module.exports: $Exports<'codecov/test/services/drone'>;
}
declare module 'codecov/test/services/gitlab.js' {
declare module.exports: $Exports<'codecov/test/services/gitlab'>;
}
declare module 'codecov/test/services/jenkins.js' {
declare module.exports: $Exports<'codecov/test/services/jenkins'>;
}
declare module 'codecov/test/services/localGit.js' {
declare module.exports: $Exports<'codecov/test/services/localGit'>;
}
declare module 'codecov/test/services/semaphore.js' {
declare module.exports: $Exports<'codecov/test/services/semaphore'>;
}
declare module 'codecov/test/services/shippable.js' {
declare module.exports: $Exports<'codecov/test/services/shippable'>;
}
declare module 'codecov/test/services/snap.js' {
declare module.exports: $Exports<'codecov/test/services/snap'>;
}
declare module 'codecov/test/services/travis.js' {
declare module.exports: $Exports<'codecov/test/services/travis'>;
}
declare module 'codecov/test/services/wercker.js' {
declare module.exports: $Exports<'codecov/test/services/wercker'>;
}
declare module 'codecov/test/upload.js' {
declare module.exports: $Exports<'codecov/test/upload'>;
}
declare module 'codecov/testinit.js' {
declare module.exports: $Exports<'codecov/testinit'>;
}

View File

@ -0,0 +1,59 @@
// flow-typed signature: 044aa455e3cc503e87e65ea25f1bcdb3
// flow-typed version: <<STUB>>/eslint-config-prettier_v^2.1.0/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
*
* 'eslint-config-prettier'
*
* 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 'eslint-config-prettier' {
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 'eslint-config-prettier/bin/cli' {
declare module.exports: any;
}
declare module 'eslint-config-prettier/bin/validators' {
declare module.exports: any;
}
declare module 'eslint-config-prettier/flowtype' {
declare module.exports: any;
}
declare module 'eslint-config-prettier/react' {
declare module.exports: any;
}
// Filename aliases
declare module 'eslint-config-prettier/bin/cli.js' {
declare module.exports: $Exports<'eslint-config-prettier/bin/cli'>;
}
declare module 'eslint-config-prettier/bin/validators.js' {
declare module.exports: $Exports<'eslint-config-prettier/bin/validators'>;
}
declare module 'eslint-config-prettier/flowtype.js' {
declare module.exports: $Exports<'eslint-config-prettier/flowtype'>;
}
declare module 'eslint-config-prettier/index' {
declare module.exports: $Exports<'eslint-config-prettier'>;
}
declare module 'eslint-config-prettier/index.js' {
declare module.exports: $Exports<'eslint-config-prettier'>;
}
declare module 'eslint-config-prettier/react.js' {
declare module.exports: $Exports<'eslint-config-prettier/react'>;
}

View File

@ -1,5 +1,5 @@
// flow-typed signature: 4914ad491df1933b4a85389d0c85d168
// flow-typed version: <<STUB>>/eslint-plugin-flowtype_v^2.19.0/flow_v0.37.0
// flow-typed signature: 90f17f28057c2d62823bc86eb02fdca6
// flow-typed version: <<STUB>>/eslint-plugin-flowtype_v^2.33.0/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
@ -54,6 +54,10 @@ declare module 'eslint-plugin-flowtype/dist/rules/noPrimitiveConstructorTypes' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/noTypesMissingFileAnnotation' {
declare module.exports: any;
}
declare module 'eslint-plugin-flowtype/dist/rules/noWeakTypes' {
declare module.exports: any;
}
@ -215,6 +219,9 @@ declare module 'eslint-plugin-flowtype/dist/rules/noDupeKeys.js' {
declare module 'eslint-plugin-flowtype/dist/rules/noPrimitiveConstructorTypes.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noPrimitiveConstructorTypes'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/noTypesMissingFileAnnotation.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noTypesMissingFileAnnotation'>;
}
declare module 'eslint-plugin-flowtype/dist/rules/noWeakTypes.js' {
declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noWeakTypes'>;
}

View File

@ -1,5 +1,5 @@
// flow-typed signature: 42a734ddd100a0e4a16c21c2fd5ebfc8
// flow-typed version: <<STUB>>/eslint-plugin-import_v^1.16.0/flow_v0.37.0
// flow-typed signature: 648dd21b73dc794cbba83495010df3a7
// flow-typed version: <<STUB>>/eslint-plugin-import_v^2.2.0/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
@ -38,6 +38,10 @@ declare module 'eslint-plugin-import/config/react' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/config/recommended' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/config/stage-0' {
declare module.exports: any;
}
@ -46,42 +50,18 @@ declare module 'eslint-plugin-import/config/warnings' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/core/declaredScope' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/core/getExports' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/core/hash' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/core/ignore' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/core/importType' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/core/module-require' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/core/parse' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/core/resolve' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/core/staticRequire' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/ExportMap' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/importDeclaration' {
declare module.exports: any;
}
@ -102,6 +82,10 @@ declare module 'eslint-plugin-import/lib/rules/extensions' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/rules/first' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/rules/imports-first' {
declare module.exports: any;
}
@ -166,6 +150,10 @@ declare module 'eslint-plugin-import/lib/rules/no-named-as-default' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/rules/no-named-default' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/rules/no-namespace' {
declare module.exports: any;
}
@ -178,10 +166,18 @@ declare module 'eslint-plugin-import/lib/rules/no-restricted-paths' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/rules/no-unassigned-import' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/rules/no-unresolved' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/rules/no-webpack-loader-syntax' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/rules/order' {
declare module.exports: any;
}
@ -190,6 +186,10 @@ declare module 'eslint-plugin-import/lib/rules/prefer-default-export' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/lib/rules/unambiguous' {
declare module.exports: any;
}
declare module 'eslint-plugin-import/memo-parser/index' {
declare module.exports: any;
}
@ -207,39 +207,24 @@ declare module 'eslint-plugin-import/config/react-native.js' {
declare module 'eslint-plugin-import/config/react.js' {
declare module.exports: $Exports<'eslint-plugin-import/config/react'>;
}
declare module 'eslint-plugin-import/config/recommended.js' {
declare module.exports: $Exports<'eslint-plugin-import/config/recommended'>;
}
declare module 'eslint-plugin-import/config/stage-0.js' {
declare module.exports: $Exports<'eslint-plugin-import/config/stage-0'>;
}
declare module 'eslint-plugin-import/config/warnings.js' {
declare module.exports: $Exports<'eslint-plugin-import/config/warnings'>;
}
declare module 'eslint-plugin-import/lib/core/declaredScope.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/core/declaredScope'>;
}
declare module 'eslint-plugin-import/lib/core/getExports.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/core/getExports'>;
}
declare module 'eslint-plugin-import/lib/core/hash.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/core/hash'>;
}
declare module 'eslint-plugin-import/lib/core/ignore.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/core/ignore'>;
}
declare module 'eslint-plugin-import/lib/core/importType.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/core/importType'>;
}
declare module 'eslint-plugin-import/lib/core/module-require.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/core/module-require'>;
}
declare module 'eslint-plugin-import/lib/core/parse.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/core/parse'>;
}
declare module 'eslint-plugin-import/lib/core/resolve.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/core/resolve'>;
}
declare module 'eslint-plugin-import/lib/core/staticRequire.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/core/staticRequire'>;
}
declare module 'eslint-plugin-import/lib/ExportMap.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/ExportMap'>;
}
declare module 'eslint-plugin-import/lib/importDeclaration.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/importDeclaration'>;
}
@ -255,6 +240,9 @@ declare module 'eslint-plugin-import/lib/rules/export.js' {
declare module 'eslint-plugin-import/lib/rules/extensions.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/rules/extensions'>;
}
declare module 'eslint-plugin-import/lib/rules/first.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/rules/first'>;
}
declare module 'eslint-plugin-import/lib/rules/imports-first.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/rules/imports-first'>;
}
@ -303,6 +291,9 @@ declare module 'eslint-plugin-import/lib/rules/no-named-as-default-member.js' {
declare module 'eslint-plugin-import/lib/rules/no-named-as-default.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-named-as-default'>;
}
declare module 'eslint-plugin-import/lib/rules/no-named-default.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-named-default'>;
}
declare module 'eslint-plugin-import/lib/rules/no-namespace.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-namespace'>;
}
@ -312,15 +303,24 @@ declare module 'eslint-plugin-import/lib/rules/no-nodejs-modules.js' {
declare module 'eslint-plugin-import/lib/rules/no-restricted-paths.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-restricted-paths'>;
}
declare module 'eslint-plugin-import/lib/rules/no-unassigned-import.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-unassigned-import'>;
}
declare module 'eslint-plugin-import/lib/rules/no-unresolved.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-unresolved'>;
}
declare module 'eslint-plugin-import/lib/rules/no-webpack-loader-syntax.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-webpack-loader-syntax'>;
}
declare module 'eslint-plugin-import/lib/rules/order.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/rules/order'>;
}
declare module 'eslint-plugin-import/lib/rules/prefer-default-export.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/rules/prefer-default-export'>;
}
declare module 'eslint-plugin-import/lib/rules/unambiguous.js' {
declare module.exports: $Exports<'eslint-plugin-import/lib/rules/unambiguous'>;
}
declare module 'eslint-plugin-import/memo-parser/index.js' {
declare module.exports: $Exports<'eslint-plugin-import/memo-parser/index'>;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
// flow-typed signature: 7705993c316ac97ed14e3e50dcf0b057
// flow-typed version: <<STUB>>/eslint-plugin-prettier_v^2.0.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
*
* 'eslint-plugin-prettier'
*
* 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 'eslint-plugin-prettier' {
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 'eslint-plugin-prettier/lib/index' {
declare module.exports: any;
}
declare module 'eslint-plugin-prettier/lib/rules/prettier' {
declare module.exports: any;
}
declare module 'eslint-plugin-prettier/tests/lib/rules/prettier' {
declare module.exports: any;
}
// Filename aliases
declare module 'eslint-plugin-prettier/lib/index.js' {
declare module.exports: $Exports<'eslint-plugin-prettier/lib/index'>;
}
declare module 'eslint-plugin-prettier/lib/rules/prettier.js' {
declare module.exports: $Exports<'eslint-plugin-prettier/lib/rules/prettier'>;
}
declare module 'eslint-plugin-prettier/tests/lib/rules/prettier.js' {
declare module.exports: $Exports<'eslint-plugin-prettier/tests/lib/rules/prettier'>;
}

View File

@ -1,5 +1,5 @@
// flow-typed signature: 3feb59aa7c12a2f4969babcbd49f5e47
// flow-typed version: <<STUB>>/eslint-plugin-react_v^6.3.0/flow_v0.37.0
// flow-typed signature: 9cc99825da1604cebf5b62c3c3282021
// flow-typed version: <<STUB>>/eslint-plugin-react_v^7.0.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
@ -30,6 +30,14 @@ declare module 'eslint-plugin-react/lib/rules/forbid-component-props' {
declare module.exports: any;
}
declare module 'eslint-plugin-react/lib/rules/forbid-elements' {
declare module.exports: any;
}
declare module 'eslint-plugin-react/lib/rules/forbid-foreign-prop-types' {
declare module.exports: any;
}
declare module 'eslint-plugin-react/lib/rules/forbid-prop-types' {
declare module.exports: any;
}
@ -138,10 +146,6 @@ declare module 'eslint-plugin-react/lib/rules/no-children-prop' {
declare module.exports: any;
}
declare module 'eslint-plugin-react/lib/rules/no-comment-textnodes' {
declare module.exports: any;
}
declare module 'eslint-plugin-react/lib/rules/no-danger-with-children' {
declare module.exports: any;
}
@ -202,6 +206,10 @@ declare module 'eslint-plugin-react/lib/rules/no-unused-prop-types' {
declare module.exports: any;
}
declare module 'eslint-plugin-react/lib/rules/no-will-update-set-state' {
declare module.exports: any;
}
declare module 'eslint-plugin-react/lib/rules/prefer-es6-class' {
declare module.exports: any;
}
@ -222,10 +230,6 @@ declare module 'eslint-plugin-react/lib/rules/require-default-props' {
declare module.exports: any;
}
declare module 'eslint-plugin-react/lib/rules/require-extension' {
declare module.exports: any;
}
declare module 'eslint-plugin-react/lib/rules/require-optimization' {
declare module.exports: any;
}
@ -250,7 +254,7 @@ declare module 'eslint-plugin-react/lib/rules/style-prop-object' {
declare module.exports: any;
}
declare module 'eslint-plugin-react/lib/rules/wrap-multilines' {
declare module 'eslint-plugin-react/lib/rules/void-dom-elements-no-children' {
declare module.exports: any;
}
@ -266,6 +270,10 @@ declare module 'eslint-plugin-react/lib/util/getTokenBeforeClosingBracket' {
declare module.exports: any;
}
declare module 'eslint-plugin-react/lib/util/makeNoMethodSetStateRule' {
declare module.exports: any;
}
declare module 'eslint-plugin-react/lib/util/pragma' {
declare module.exports: any;
}
@ -291,6 +299,12 @@ declare module 'eslint-plugin-react/lib/rules/display-name.js' {
declare module 'eslint-plugin-react/lib/rules/forbid-component-props.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/forbid-component-props'>;
}
declare module 'eslint-plugin-react/lib/rules/forbid-elements.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/forbid-elements'>;
}
declare module 'eslint-plugin-react/lib/rules/forbid-foreign-prop-types.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/forbid-foreign-prop-types'>;
}
declare module 'eslint-plugin-react/lib/rules/forbid-prop-types.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/forbid-prop-types'>;
}
@ -372,9 +386,6 @@ declare module 'eslint-plugin-react/lib/rules/no-array-index-key.js' {
declare module 'eslint-plugin-react/lib/rules/no-children-prop.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-children-prop'>;
}
declare module 'eslint-plugin-react/lib/rules/no-comment-textnodes.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-comment-textnodes'>;
}
declare module 'eslint-plugin-react/lib/rules/no-danger-with-children.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-danger-with-children'>;
}
@ -420,6 +431,9 @@ declare module 'eslint-plugin-react/lib/rules/no-unknown-property.js' {
declare module 'eslint-plugin-react/lib/rules/no-unused-prop-types.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-unused-prop-types'>;
}
declare module 'eslint-plugin-react/lib/rules/no-will-update-set-state.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-will-update-set-state'>;
}
declare module 'eslint-plugin-react/lib/rules/prefer-es6-class.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/prefer-es6-class'>;
}
@ -435,9 +449,6 @@ declare module 'eslint-plugin-react/lib/rules/react-in-jsx-scope.js' {
declare module 'eslint-plugin-react/lib/rules/require-default-props.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/require-default-props'>;
}
declare module 'eslint-plugin-react/lib/rules/require-extension.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/require-extension'>;
}
declare module 'eslint-plugin-react/lib/rules/require-optimization.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/require-optimization'>;
}
@ -456,8 +467,8 @@ declare module 'eslint-plugin-react/lib/rules/sort-prop-types.js' {
declare module 'eslint-plugin-react/lib/rules/style-prop-object.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/style-prop-object'>;
}
declare module 'eslint-plugin-react/lib/rules/wrap-multilines.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/wrap-multilines'>;
declare module 'eslint-plugin-react/lib/rules/void-dom-elements-no-children.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/void-dom-elements-no-children'>;
}
declare module 'eslint-plugin-react/lib/util/annotations.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/util/annotations'>;
@ -468,6 +479,9 @@ declare module 'eslint-plugin-react/lib/util/Components.js' {
declare module 'eslint-plugin-react/lib/util/getTokenBeforeClosingBracket.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/util/getTokenBeforeClosingBracket'>;
}
declare module 'eslint-plugin-react/lib/util/makeNoMethodSetStateRule.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/util/makeNoMethodSetStateRule'>;
}
declare module 'eslint-plugin-react/lib/util/pragma.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/util/pragma'>;
}

View File

@ -1,5 +1,5 @@
// flow-typed signature: 101e1d32df6b776dc2ded281251bd36e
// flow-typed version: <<STUB>>/eslint_v^3.9.1/flow_v0.37.0
// flow-typed signature: dd3494d8356296df35d657fd358968c5
// flow-typed version: <<STUB>>/eslint_v^3.19.0/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
@ -38,6 +38,10 @@ declare module 'eslint/conf/eslint-all' {
declare module.exports: any;
}
declare module 'eslint/conf/eslint-recommended' {
declare module.exports: any;
}
declare module 'eslint/lib/api' {
declare module.exports: any;
}
@ -478,6 +482,10 @@ declare module 'eslint/lib/rules/no-class-assign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-compare-neg-zero' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-cond-assign' {
declare module.exports: any;
}
@ -682,6 +690,10 @@ declare module 'eslint/lib/rules/no-mixed-spaces-and-tabs' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-multi-assign' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/no-multi-spaces' {
declare module.exports: any;
}
@ -974,6 +986,10 @@ declare module 'eslint/lib/rules/no-with' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/nonblock-statement-body-position' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/object-curly-newline' {
declare module.exports: any;
}
@ -1018,10 +1034,18 @@ declare module 'eslint/lib/rules/prefer-const' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-destructuring' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-numeric-literals' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-promise-reject-errors' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/prefer-reflect' {
declare module.exports: any;
}
@ -1122,6 +1146,10 @@ declare module 'eslint/lib/rules/template-curly-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/template-tag-spacing' {
declare module.exports: any;
}
declare module 'eslint/lib/rules/unicode-bom' {
declare module.exports: any;
}
@ -1170,7 +1198,55 @@ declare module 'eslint/lib/timing' {
declare module.exports: any;
}
declare module 'eslint/lib/token-store' {
declare module 'eslint/lib/token-store/backward-token-comment-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/token-store/backward-token-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/token-store/cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/token-store/cursors' {
declare module.exports: any;
}
declare module 'eslint/lib/token-store/decorative-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/token-store/filter-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/token-store/forward-token-comment-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/token-store/forward-token-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/token-store/index' {
declare module.exports: any;
}
declare module 'eslint/lib/token-store/limit-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/token-store/padded-token-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/token-store/skip-cursor' {
declare module.exports: any;
}
declare module 'eslint/lib/token-store/utils' {
declare module.exports: any;
}
@ -1178,6 +1254,10 @@ declare module 'eslint/lib/util/comment-event-generator' {
declare module.exports: any;
}
declare module 'eslint/lib/util/fix-tracker' {
declare module.exports: any;
}
declare module 'eslint/lib/util/glob-util' {
declare module.exports: any;
}
@ -1251,6 +1331,9 @@ declare module 'eslint/conf/environments.js' {
declare module 'eslint/conf/eslint-all.js' {
declare module.exports: $Exports<'eslint/conf/eslint-all'>;
}
declare module 'eslint/conf/eslint-recommended.js' {
declare module.exports: $Exports<'eslint/conf/eslint-recommended'>;
}
declare module 'eslint/lib/api.js' {
declare module.exports: $Exports<'eslint/lib/api'>;
}
@ -1581,6 +1664,9 @@ declare module 'eslint/lib/rules/no-catch-shadow.js' {
declare module 'eslint/lib/rules/no-class-assign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-class-assign'>;
}
declare module 'eslint/lib/rules/no-compare-neg-zero.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-compare-neg-zero'>;
}
declare module 'eslint/lib/rules/no-cond-assign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-cond-assign'>;
}
@ -1734,6 +1820,9 @@ declare module 'eslint/lib/rules/no-mixed-requires.js' {
declare module 'eslint/lib/rules/no-mixed-spaces-and-tabs.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-mixed-spaces-and-tabs'>;
}
declare module 'eslint/lib/rules/no-multi-assign.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-multi-assign'>;
}
declare module 'eslint/lib/rules/no-multi-spaces.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-multi-spaces'>;
}
@ -1953,6 +2042,9 @@ declare module 'eslint/lib/rules/no-whitespace-before-property.js' {
declare module 'eslint/lib/rules/no-with.js' {
declare module.exports: $Exports<'eslint/lib/rules/no-with'>;
}
declare module 'eslint/lib/rules/nonblock-statement-body-position.js' {
declare module.exports: $Exports<'eslint/lib/rules/nonblock-statement-body-position'>;
}
declare module 'eslint/lib/rules/object-curly-newline.js' {
declare module.exports: $Exports<'eslint/lib/rules/object-curly-newline'>;
}
@ -1986,9 +2078,15 @@ declare module 'eslint/lib/rules/prefer-arrow-callback.js' {
declare module 'eslint/lib/rules/prefer-const.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-const'>;
}
declare module 'eslint/lib/rules/prefer-destructuring.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-destructuring'>;
}
declare module 'eslint/lib/rules/prefer-numeric-literals.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-numeric-literals'>;
}
declare module 'eslint/lib/rules/prefer-promise-reject-errors.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-promise-reject-errors'>;
}
declare module 'eslint/lib/rules/prefer-reflect.js' {
declare module.exports: $Exports<'eslint/lib/rules/prefer-reflect'>;
}
@ -2064,6 +2162,9 @@ declare module 'eslint/lib/rules/symbol-description.js' {
declare module 'eslint/lib/rules/template-curly-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/template-curly-spacing'>;
}
declare module 'eslint/lib/rules/template-tag-spacing.js' {
declare module.exports: $Exports<'eslint/lib/rules/template-tag-spacing'>;
}
declare module 'eslint/lib/rules/unicode-bom.js' {
declare module.exports: $Exports<'eslint/lib/rules/unicode-bom'>;
}
@ -2100,12 +2201,51 @@ declare module 'eslint/lib/testers/rule-tester.js' {
declare module 'eslint/lib/timing.js' {
declare module.exports: $Exports<'eslint/lib/timing'>;
}
declare module 'eslint/lib/token-store.js' {
declare module.exports: $Exports<'eslint/lib/token-store'>;
declare module 'eslint/lib/token-store/backward-token-comment-cursor.js' {
declare module.exports: $Exports<'eslint/lib/token-store/backward-token-comment-cursor'>;
}
declare module 'eslint/lib/token-store/backward-token-cursor.js' {
declare module.exports: $Exports<'eslint/lib/token-store/backward-token-cursor'>;
}
declare module 'eslint/lib/token-store/cursor.js' {
declare module.exports: $Exports<'eslint/lib/token-store/cursor'>;
}
declare module 'eslint/lib/token-store/cursors.js' {
declare module.exports: $Exports<'eslint/lib/token-store/cursors'>;
}
declare module 'eslint/lib/token-store/decorative-cursor.js' {
declare module.exports: $Exports<'eslint/lib/token-store/decorative-cursor'>;
}
declare module 'eslint/lib/token-store/filter-cursor.js' {
declare module.exports: $Exports<'eslint/lib/token-store/filter-cursor'>;
}
declare module 'eslint/lib/token-store/forward-token-comment-cursor.js' {
declare module.exports: $Exports<'eslint/lib/token-store/forward-token-comment-cursor'>;
}
declare module 'eslint/lib/token-store/forward-token-cursor.js' {
declare module.exports: $Exports<'eslint/lib/token-store/forward-token-cursor'>;
}
declare module 'eslint/lib/token-store/index.js' {
declare module.exports: $Exports<'eslint/lib/token-store/index'>;
}
declare module 'eslint/lib/token-store/limit-cursor.js' {
declare module.exports: $Exports<'eslint/lib/token-store/limit-cursor'>;
}
declare module 'eslint/lib/token-store/padded-token-cursor.js' {
declare module.exports: $Exports<'eslint/lib/token-store/padded-token-cursor'>;
}
declare module 'eslint/lib/token-store/skip-cursor.js' {
declare module.exports: $Exports<'eslint/lib/token-store/skip-cursor'>;
}
declare module 'eslint/lib/token-store/utils.js' {
declare module.exports: $Exports<'eslint/lib/token-store/utils'>;
}
declare module 'eslint/lib/util/comment-event-generator.js' {
declare module.exports: $Exports<'eslint/lib/util/comment-event-generator'>;
}
declare module 'eslint/lib/util/fix-tracker.js' {
declare module.exports: $Exports<'eslint/lib/util/fix-tracker'>;
}
declare module 'eslint/lib/util/glob-util.js' {
declare module.exports: $Exports<'eslint/lib/util/glob-util'>;
}

View File

@ -0,0 +1,33 @@
// flow-typed signature: b6d0f1f7d2b72d32bb73490f48fef0f0
// flow-typed version: <<STUB>>/hoist-non-react-statics_v^1.2.0/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
*
* 'hoist-non-react-statics'
*
* 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 'hoist-non-react-statics' {
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 'hoist-non-react-statics/index' {
declare module.exports: $Exports<'hoist-non-react-statics'>;
}
declare module 'hoist-non-react-statics/index.js' {
declare module.exports: $Exports<'hoist-non-react-statics'>;
}

528
flow-typed/npm/jest_v20.x.x.js vendored Normal file
View File

@ -0,0 +1,528 @@
// flow-typed signature: a0369c11661f437ec4ccdd805579ddcf
// flow-typed version: c4b9fea7c9/jest_v20.x.x/flow_>=v0.33.x
type JestMockFn = {
(...args: Array<any>): any,
/**
* 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<Array<any>>,
/**
* An array that contains all the object instances that have been
* instantiated from this mock function.
*/
instances: mixed
},
/**
* 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(): Function,
/**
* Resets all information stored in the mock. This is useful when you want to
* completely restore a mock back to its initial state.
*/
mockReset(): Function,
/**
* 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(): Function,
/**
* 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: Function): JestMockFn,
/**
* 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: Function): JestMockFn,
/**
* Just a simple sugar function for returning `this`
*/
mockReturnThis(): void,
/**
* Deprecated: use jest.fn(() => value) instead
*/
mockReturnValue(value: any): JestMockFn,
/**
* Sugar for only returning a value once inside your mock
*/
mockReturnValueOnce(value: any): JestMockFn
};
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): 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 | RegExp): void,
toThrowError(message?: string | 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(implementation?: Function): JestMockFn,
/**
* 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,
/**
* 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
};
type JestSpyType = {
calls: JestCallsType
};
/** Runs this function after every test inside this context */
declare function afterEach(fn: Function): void;
/** Runs this function before every test inside this context */
declare function beforeEach(fn: Function): void;
/** Runs this function after all tests have finished inside this context */
declare function afterAll(fn: Function): void;
/** Runs this function before any tests have started inside this context */
declare function beforeAll(fn: Function): 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: Function): void,
/**
* Only run this describe block
*/
only(name: string, fn: Function): void,
/**
* Skip running this describe block
*/
skip(name: string, fn: Function): void,
};
/** An individual test unit */
declare var it: {
/**
* An individual test unit
*
* @param {string} Name of Test
* @param {Function} Test
*/
(name: string, fn?: Function): ?Promise<void>,
/**
* Only run this test
*
* @param {string} Name of Test
* @param {Function} Test
*/
only(name: string, fn?: Function): ?Promise<void>,
/**
* Skip running this test
*
* @param {string} Name of Test
* @param {Function} Test
*/
skip(name: string, fn?: Function): ?Promise<void>,
/**
* Run the test concurrently
*
* @param {string} Name of Test
* @param {Function} Test
*/
concurrent(name: string, fn?: Function): ?Promise<void>
};
declare function fit(name: string, fn: Function): ?Promise<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 Jamine 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
};

33
flow-typed/npm/path-to-regexp_vx.x.x.js vendored Normal file
View File

@ -0,0 +1,33 @@
// flow-typed signature: 0ca9b6466bef8d8a1065047d9b2377ed
// flow-typed version: <<STUB>>/path-to-regexp_v^1.7.0/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
*
* 'path-to-regexp'
*
* 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 'path-to-regexp' {
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 'path-to-regexp/index' {
declare module.exports: $Exports<'path-to-regexp'>;
}
declare module 'path-to-regexp/index.js' {
declare module.exports: $Exports<'path-to-regexp'>;
}

View File

@ -0,0 +1,39 @@
// flow-typed signature: 6ad6e1964ca9ba7f00adea8639590b31
// flow-typed version: <<STUB>>/prettier-eslint_v^6.2.2/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
*
* 'prettier-eslint'
*
* 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 'prettier-eslint' {
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 'prettier-eslint/dist/index' {
declare module.exports: any;
}
declare module 'prettier-eslint/dist/utils' {
declare module.exports: any;
}
// Filename aliases
declare module 'prettier-eslint/dist/index.js' {
declare module.exports: $Exports<'prettier-eslint/dist/index'>;
}
declare module 'prettier-eslint/dist/utils.js' {
declare module.exports: $Exports<'prettier-eslint/dist/utils'>;
}

157
flow-typed/npm/prettier_vx.x.x.js vendored Normal file
View File

@ -0,0 +1,157 @@
// flow-typed signature: dcfbb1bce70b2357d74f7cab0391981c
// flow-typed version: <<STUB>>/prettier_v^1.3.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
*
* 'prettier'
*
* 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 'prettier' {
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 'prettier/bin/prettier' {
declare module.exports: any;
}
declare module 'prettier/docs/prettier.min' {
declare module.exports: any;
}
declare module 'prettier/docs/rollup.config' {
declare module.exports: any;
}
declare module 'prettier/scripts/sync-flow-tests' {
declare module.exports: any;
}
declare module 'prettier/src/ast-types' {
declare module.exports: any;
}
declare module 'prettier/src/comments' {
declare module.exports: any;
}
declare module 'prettier/src/deprecated' {
declare module.exports: any;
}
declare module 'prettier/src/doc-builders' {
declare module.exports: any;
}
declare module 'prettier/src/doc-debug' {
declare module.exports: any;
}
declare module 'prettier/src/doc-printer' {
declare module.exports: any;
}
declare module 'prettier/src/doc-utils' {
declare module.exports: any;
}
declare module 'prettier/src/fast-path' {
declare module.exports: any;
}
declare module 'prettier/src/options' {
declare module.exports: any;
}
declare module 'prettier/src/parser' {
declare module.exports: any;
}
declare module 'prettier/src/printer' {
declare module.exports: any;
}
declare module 'prettier/src/typescript-ast-nodes' {
declare module.exports: any;
}
declare module 'prettier/src/util' {
declare module.exports: any;
}
declare module 'prettier/test' {
declare module.exports: any;
}
// Filename aliases
declare module 'prettier/bin/prettier.js' {
declare module.exports: $Exports<'prettier/bin/prettier'>;
}
declare module 'prettier/docs/prettier.min.js' {
declare module.exports: $Exports<'prettier/docs/prettier.min'>;
}
declare module 'prettier/docs/rollup.config.js' {
declare module.exports: $Exports<'prettier/docs/rollup.config'>;
}
declare module 'prettier/index' {
declare module.exports: $Exports<'prettier'>;
}
declare module 'prettier/index.js' {
declare module.exports: $Exports<'prettier'>;
}
declare module 'prettier/scripts/sync-flow-tests.js' {
declare module.exports: $Exports<'prettier/scripts/sync-flow-tests'>;
}
declare module 'prettier/src/ast-types.js' {
declare module.exports: $Exports<'prettier/src/ast-types'>;
}
declare module 'prettier/src/comments.js' {
declare module.exports: $Exports<'prettier/src/comments'>;
}
declare module 'prettier/src/deprecated.js' {
declare module.exports: $Exports<'prettier/src/deprecated'>;
}
declare module 'prettier/src/doc-builders.js' {
declare module.exports: $Exports<'prettier/src/doc-builders'>;
}
declare module 'prettier/src/doc-debug.js' {
declare module.exports: $Exports<'prettier/src/doc-debug'>;
}
declare module 'prettier/src/doc-printer.js' {
declare module.exports: $Exports<'prettier/src/doc-printer'>;
}
declare module 'prettier/src/doc-utils.js' {
declare module.exports: $Exports<'prettier/src/doc-utils'>;
}
declare module 'prettier/src/fast-path.js' {
declare module.exports: $Exports<'prettier/src/fast-path'>;
}
declare module 'prettier/src/options.js' {
declare module.exports: $Exports<'prettier/src/options'>;
}
declare module 'prettier/src/parser.js' {
declare module.exports: $Exports<'prettier/src/parser'>;
}
declare module 'prettier/src/printer.js' {
declare module.exports: $Exports<'prettier/src/printer'>;
}
declare module 'prettier/src/typescript-ast-nodes.js' {
declare module.exports: $Exports<'prettier/src/typescript-ast-nodes'>;
}
declare module 'prettier/src/util.js' {
declare module.exports: $Exports<'prettier/src/util'>;
}
declare module 'prettier/test.js' {
declare module.exports: $Exports<'prettier/test'>;
}

34
flow-typed/npm/prop-types_v15.x.x.js vendored Normal file
View File

@ -0,0 +1,34 @@
// flow-typed signature: 3eaa1f24c7397b78a7481992d2cddcb2
// flow-typed version: a1a20d4928/prop-types_v15.x.x/flow_>=v0.41.x
type $npm$propTypes$ReactPropsCheckType = (
props: any,
propName: string,
componentName: string,
href?: string) => ?Error;
declare module 'prop-types' {
declare var array: React$PropType$Primitive<Array<any>>;
declare var bool: React$PropType$Primitive<boolean>;
declare var func: React$PropType$Primitive<Function>;
declare var number: React$PropType$Primitive<number>;
declare var object: React$PropType$Primitive<Object>;
declare var string: React$PropType$Primitive<string>;
declare var any: React$PropType$Primitive<any>;
declare var arrayOf: React$PropType$ArrayOf;
declare var element: React$PropType$Primitive<any>; /* TODO */
declare var instanceOf: React$PropType$InstanceOf;
declare var node: React$PropType$Primitive<any>; /* TODO */
declare var objectOf: React$PropType$ObjectOf;
declare var oneOf: React$PropType$OneOf;
declare var oneOfType: React$PropType$OneOfType;
declare var shape: React$PropType$Shape;
declare function checkPropTypes<V>(
propTypes: $Subtype<{[_: $Keys<V>]: $npm$propTypes$ReactPropsCheckType}>,
values: V,
location: string,
componentName: string,
getStack: ?(() => ?string)
) : void;
}

View File

@ -0,0 +1,39 @@
// flow-typed signature: 3b2ac23940c896d7c1cfe61602fdb75d
// flow-typed version: <<STUB>>/react-native-drawer-layout-polyfill_v^1.3.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
*
* 'react-native-drawer-layout-polyfill'
*
* 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-drawer-layout-polyfill' {
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-drawer-layout-polyfill/dist/index.android' {
declare module.exports: any;
}
declare module 'react-native-drawer-layout-polyfill/dist/index' {
declare module.exports: any;
}
// Filename aliases
declare module 'react-native-drawer-layout-polyfill/dist/index.android.js' {
declare module.exports: $Exports<'react-native-drawer-layout-polyfill/dist/index.android'>;
}
declare module 'react-native-drawer-layout-polyfill/dist/index.js' {
declare module.exports: $Exports<'react-native-drawer-layout-polyfill/dist/index'>;
}

View File

@ -0,0 +1,95 @@
// flow-typed signature: 2b6973f23a98d68b4e4cb18e5d8dd470
// flow-typed version: <<STUB>>/react-native-tab-view_v^0.0.66/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
*
* 'react-native-tab-view'
*
* 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-tab-view' {
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-tab-view/src/index' {
declare module.exports: any;
}
declare module 'react-native-tab-view/src/SceneMap' {
declare module.exports: any;
}
declare module 'react-native-tab-view/src/TabBar' {
declare module.exports: any;
}
declare module 'react-native-tab-view/src/TabViewAnimated' {
declare module.exports: any;
}
declare module 'react-native-tab-view/src/TabViewPagerAndroid' {
declare module.exports: any;
}
declare module 'react-native-tab-view/src/TabViewPagerPan' {
declare module.exports: any;
}
declare module 'react-native-tab-view/src/TabViewPagerScroll' {
declare module.exports: any;
}
declare module 'react-native-tab-view/src/TabViewPropTypes' {
declare module.exports: any;
}
declare module 'react-native-tab-view/src/TabViewTypeDefinitions' {
declare module.exports: any;
}
declare module 'react-native-tab-view/src/TouchableItem' {
declare module.exports: any;
}
// Filename aliases
declare module 'react-native-tab-view/src/index.js' {
declare module.exports: $Exports<'react-native-tab-view/src/index'>;
}
declare module 'react-native-tab-view/src/SceneMap.js' {
declare module.exports: $Exports<'react-native-tab-view/src/SceneMap'>;
}
declare module 'react-native-tab-view/src/TabBar.js' {
declare module.exports: $Exports<'react-native-tab-view/src/TabBar'>;
}
declare module 'react-native-tab-view/src/TabViewAnimated.js' {
declare module.exports: $Exports<'react-native-tab-view/src/TabViewAnimated'>;
}
declare module 'react-native-tab-view/src/TabViewPagerAndroid.js' {
declare module.exports: $Exports<'react-native-tab-view/src/TabViewPagerAndroid'>;
}
declare module 'react-native-tab-view/src/TabViewPagerPan.js' {
declare module.exports: $Exports<'react-native-tab-view/src/TabViewPagerPan'>;
}
declare module 'react-native-tab-view/src/TabViewPagerScroll.js' {
declare module.exports: $Exports<'react-native-tab-view/src/TabViewPagerScroll'>;
}
declare module 'react-native-tab-view/src/TabViewPropTypes.js' {
declare module.exports: $Exports<'react-native-tab-view/src/TabViewPropTypes'>;
}
declare module 'react-native-tab-view/src/TabViewTypeDefinitions.js' {
declare module.exports: $Exports<'react-native-tab-view/src/TabViewTypeDefinitions'>;
}
declare module 'react-native-tab-view/src/TouchableItem.js' {
declare module.exports: $Exports<'react-native-tab-view/src/TouchableItem'>;
}

View File

@ -0,0 +1,185 @@
// flow-typed signature: c0ba677d8ab5e8dd20aca1fa1514abe7
// flow-typed version: <<STUB>>/react-native-vector-icons_v^4.1.1/flow_v0.49.1
/**
* This is an autogenerated libdef stub for:
*
* 'react-native-vector-icons'
*
* 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-vector-icons' {
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-vector-icons/Entypo' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/EvilIcons' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/FontAwesome' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/Foundation' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/generate-icon' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/generate-material-icons' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/Ionicons' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/lib/create-icon-set-from-fontello' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/lib/create-icon-set-from-icomoon' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/lib/create-icon-set' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/lib/generate-icon-set-from-css' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/lib/icon-button' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/lib/react-native' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/lib/react-native.osx' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/lib/tab-bar-item-ios' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/lib/toolbar-android' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/MaterialCommunityIcons' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/MaterialIcons' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/Octicons' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/RNIMigration' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/SimpleLineIcons' {
declare module.exports: any;
}
declare module 'react-native-vector-icons/Zocial' {
declare module.exports: any;
}
// Filename aliases
declare module 'react-native-vector-icons/Entypo.js' {
declare module.exports: $Exports<'react-native-vector-icons/Entypo'>;
}
declare module 'react-native-vector-icons/EvilIcons.js' {
declare module.exports: $Exports<'react-native-vector-icons/EvilIcons'>;
}
declare module 'react-native-vector-icons/FontAwesome.js' {
declare module.exports: $Exports<'react-native-vector-icons/FontAwesome'>;
}
declare module 'react-native-vector-icons/Foundation.js' {
declare module.exports: $Exports<'react-native-vector-icons/Foundation'>;
}
declare module 'react-native-vector-icons/generate-icon.js' {
declare module.exports: $Exports<'react-native-vector-icons/generate-icon'>;
}
declare module 'react-native-vector-icons/generate-material-icons.js' {
declare module.exports: $Exports<'react-native-vector-icons/generate-material-icons'>;
}
declare module 'react-native-vector-icons/index' {
declare module.exports: $Exports<'react-native-vector-icons'>;
}
declare module 'react-native-vector-icons/index.js' {
declare module.exports: $Exports<'react-native-vector-icons'>;
}
declare module 'react-native-vector-icons/Ionicons.js' {
declare module.exports: $Exports<'react-native-vector-icons/Ionicons'>;
}
declare module 'react-native-vector-icons/lib/create-icon-set-from-fontello.js' {
declare module.exports: $Exports<'react-native-vector-icons/lib/create-icon-set-from-fontello'>;
}
declare module 'react-native-vector-icons/lib/create-icon-set-from-icomoon.js' {
declare module.exports: $Exports<'react-native-vector-icons/lib/create-icon-set-from-icomoon'>;
}
declare module 'react-native-vector-icons/lib/create-icon-set.js' {
declare module.exports: $Exports<'react-native-vector-icons/lib/create-icon-set'>;
}
declare module 'react-native-vector-icons/lib/generate-icon-set-from-css.js' {
declare module.exports: $Exports<'react-native-vector-icons/lib/generate-icon-set-from-css'>;
}
declare module 'react-native-vector-icons/lib/icon-button.js' {
declare module.exports: $Exports<'react-native-vector-icons/lib/icon-button'>;
}
declare module 'react-native-vector-icons/lib/react-native.js' {
declare module.exports: $Exports<'react-native-vector-icons/lib/react-native'>;
}
declare module 'react-native-vector-icons/lib/react-native.osx.js' {
declare module.exports: $Exports<'react-native-vector-icons/lib/react-native.osx'>;
}
declare module 'react-native-vector-icons/lib/tab-bar-item-ios.js' {
declare module.exports: $Exports<'react-native-vector-icons/lib/tab-bar-item-ios'>;
}
declare module 'react-native-vector-icons/lib/toolbar-android.js' {
declare module.exports: $Exports<'react-native-vector-icons/lib/toolbar-android'>;
}
declare module 'react-native-vector-icons/MaterialCommunityIcons.js' {
declare module.exports: $Exports<'react-native-vector-icons/MaterialCommunityIcons'>;
}
declare module 'react-native-vector-icons/MaterialIcons.js' {
declare module.exports: $Exports<'react-native-vector-icons/MaterialIcons'>;
}
declare module 'react-native-vector-icons/Octicons.js' {
declare module.exports: $Exports<'react-native-vector-icons/Octicons'>;
}
declare module 'react-native-vector-icons/RNIMigration.js' {
declare module.exports: $Exports<'react-native-vector-icons/RNIMigration'>;
}
declare module 'react-native-vector-icons/SimpleLineIcons.js' {
declare module.exports: $Exports<'react-native-vector-icons/SimpleLineIcons'>;
}
declare module 'react-native-vector-icons/Zocial.js' {
declare module.exports: $Exports<'react-native-vector-icons/Zocial'>;
}

File diff suppressed because it is too large Load Diff

4463
flow-typed/react-native.js vendored Normal file

File diff suppressed because it is too large Load Diff

39
flow/react-navigation.js vendored Normal file
View File

@ -0,0 +1,39 @@
/**
* React Navigation Flow library defintion
*/
declare module 'react-navigation' {
declare var createNavigationContainer: any;
declare var StateUtils: any;
declare var addNavigationHelpers: any;
declare var NavigationActions: any;
declare var createNavigator: any;
declare var StackNavigator: any;
declare var TabNavigator: any;
declare var DrawerNavigator: any;
declare var StackRouter: any;
declare var TabRouter: any;
declare var Transitioner: any;
declare var CardStackTransitioner: any;
declare var CardStack: any;
declare var Card: any;
declare var Header: any;
declare var HeaderTitle: any;
declare var HeaderBackButton: any;
declare var DrawerView: any;
declare var DrawerItems: any;
declare var TabView: any;
declare var TabBarTop: any;
declare var TabBarBottom: any;
declare var withNavigation: any;
}

View File

@ -1,6 +1,6 @@
{
"name": "react-navigation",
"version": "1.0.0-beta.11",
"version": "1.0.0-beta.12",
"description": "React Navigation",
"main": "src/react-navigation.js",
"sources": {
@ -41,46 +41,45 @@
"lib-rn",
"src"
],
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.24.1",
"babel-eslint": "^7.2.3",
"babel-jest": "^20.0.1",
"babel-plugin-flow-react-proptypes": "^2.2.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-react-native": "^1.9.2",
"babel-preset-react-native-stage-0": "^1.0.1",
"babel-preset-react-native-syntax": "^1.0.0",
"babel-preset-stage-1": "^6.24.1",
"codecov": "^2.2.0",
"eslint": "^3.19.0",
"eslint-config-prettier": "^2.1.0",
"eslint-plugin-flowtype": "^2.33.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^5.0.1",
"eslint-plugin-prettier": "^2.0.1",
"eslint-plugin-react": "^7.0.1",
"flow-bin": "0.42.0",
"jest": "^20.0.1",
"prettier": "^1.3.1",
"prettier-eslint": "^6.2.2",
"react": "16.0.0-alpha.6",
"react-native": "^0.44.0",
"react-native-vector-icons": "^4.1.1",
"react-test-renderer": "^15.4.2"
},
"peerDependencies": {
"react": "*",
"react-native": "*"
},
"dependencies": {
"clamp": "^1.0.1",
"hoist-non-react-statics": "^1.2.0",
"hoist-non-react-statics": "^2.2.0",
"path-to-regexp": "^1.7.0",
"prop-types": "^15.5.10",
"react-native-drawer-layout-polyfill": "^1.3.1",
"react-native-tab-view": "^0.0.66"
"react-native-drawer-layout-polyfill": "^1.3.2",
"react-native-tab-view": "^0.0.67"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
"babel-jest": "^20.0.3",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-react-native": "^2.1.0",
"babel-preset-react-native-stage-0": "^1.0.1",
"babel-preset-react-native-syntax": "^1.0.0",
"babel-preset-stage-1": "^6.24.1",
"codecov": "^2.2.0",
"eslint": "^4.2.0",
"eslint-config-prettier": "^2.3.0",
"eslint-plugin-flowtype": "^2.35.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-prettier": "^2.1.2",
"eslint-plugin-react": "^7.1.0",
"flow-bin": "^0.49.1",
"jest": "^20.0.4",
"prettier": "^1.5.3",
"prettier-eslint": "^6.4.2",
"react": "16.0.0-alpha.12",
"react-native": "^0.45.1",
"react-native-vector-icons": "^4.2.0",
"react-test-renderer": "^15.6.1"
},
"jest": {
"notify": true,

View File

@ -5,5 +5,5 @@ set -eo pipefail
case $CIRCLE_NODE_INDEX in
0) yarn test && yarn codecov ;;
1) yarn link && cd examples/NavigationPlayground && yarn && yarn link react-navigation && yarn test ;;
2) cd examples/ReduxExample && yarn && yarn test ;;
#2) cd examples/ReduxExample && yarn && yarn test ;;
esac

View File

@ -2,10 +2,10 @@
import {
BackAndroid as DeprecatedBackAndroid,
BackHandler,
BackHandler as ModernBackHandler,
Linking,
} from 'react-native';
const BackAndroid = BackHandler || DeprecatedBackAndroid;
const BackHandler = ModernBackHandler || DeprecatedBackAndroid;
export { BackAndroid, Linking };
export { BackHandler, Linking };

View File

@ -6,6 +6,6 @@ export const Linking = {
getInitialURL: () => Promise.reject('Unsupported platform'),
};
export const BackAndroid = {
export const BackHandler = {
addEventListener: () => {},
};

View File

@ -2,171 +2,28 @@
import React from 'react';
// @todo when we split types into common, native and web,
// we can properly change Animated.Value to its real value
type AnimatedValue = *;
import {
Animated,
type ViewProps,
type TextProps,
type StyleDefinition,
type AnimatedViewStylePropTypes,
} from 'react-native';
export type HeaderMode = 'float' | 'screen' | 'none';
export type HeaderProps = NavigationSceneRendererProps & {
mode: HeaderMode,
router: NavigationRouter<
NavigationState,
NavigationAction,
NavigationStackScreenOptions
>,
getScreenDetails: NavigationScene => NavigationScreenDetails<
NavigationStackScreenOptions
>,
style: Style,
};
export type ViewStyleProp = $PropertyType<ViewProps, 'style'>;
export type TextStyleProp = $PropertyType<TextProps, 'style'>;
export type AnimatedViewStyleProp = $PropertyType<
$PropertyType<Animated.View, 'props'>,
'style'
>;
export type AnimatedTextStyleProp = $PropertyType<
$PropertyType<Animated.Text, 'props'>,
'style'
>;
/**
* NavigationState is a tree of routes for a single navigator, where each child
* route may either be a NavigationScreenRoute or a NavigationRouterRoute.
* NavigationScreenRoute represents a leaf screen, while the
* NavigationRouterRoute represents the state of a child navigator.
*
* NOTE: NavigationState is a state tree local to a single navigator and
* its child navigators (via the routes field).
* If we're in navigator nested deep inside the app, the state will only be the
* state for that navigator.
* The state for the root navigator of our app represents the whole navigation
* state for the whole app.
* Navigation State + Action
*/
export type NavigationState = {
/**
* Index refers to the active child route in the routes array.
*/
index: number,
routes: Array<NavigationRoute>,
};
export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute;
export type NavigationLeafRoute = {
/**
* React's key used by some navigators. No need to specify these manually,
* they will be defined by the router.
*/
key: string,
/**
* For example 'Home'.
* This is used as a key in a route config when creating a navigator.
*/
routeName: string,
/**
* Path is an advanced feature used for deep linking and on the web.
*/
path?: string,
/**
* Params passed to this route when navigating to it,
* e.g. `{ car_id: 123 }` in a route that displays a car.
*/
params?: NavigationParams,
};
export type NavigationStateRoute = NavigationLeafRoute & {
index: number,
routes: Array<NavigationRoute>,
};
export type NavigationScreenOptionsGetter<Options, Action> = (
navigation: NavigationScreenProp<NavigationRoute, Action>,
screenProps?: {}
) => Options;
export type NavigationRouter<State, Action, Options> = {
/**
* The reducer that outputs the new navigation state for a given action, with
* an optional previous state. When the action is considered handled but the
* state is unchanged, the output state is null.
*/
getStateForAction: (action: Action, lastState: ?State) => ?State,
/**
* Maps a URI-like string to an action. This can be mapped to a state
* using `getStateForAction`.
*/
getActionForPathAndParams: (
path: string,
params?: NavigationParams
) => ?Action,
getPathAndParamsForState: (
state: State
) => {
path: string,
params?: NavigationParams,
},
getComponentForRouteName: (routeName: string) => NavigationComponent,
getComponentForState: (state: State) => NavigationComponent,
/**
* Gets the screen navigation options for a given screen.
*
* For example, we could get the config for the 'Foo' screen when the
* `navigation.state` is:
*
* {routeName: 'Foo', key: '123'}
*/
getScreenOptions: NavigationScreenOptionsGetter<Options, Action>,
};
export type NavigationScreenOption<T> =
| T
| ((
navigation: NavigationScreenProp<NavigationRoute, NavigationAction>,
config: T
) => T);
export type Style =
| { [key: string]: any }
| number
| false
| null
| void
| Array<Style>;
export type NavigationScreenDetails<T> = {
options: T,
state: NavigationRoute,
navigation: NavigationScreenProp<NavigationRoute, NavigationAction>,
};
export type NavigationScreenOptions = {
title?: string,
};
export type NavigationScreenConfigProps = {
navigation: NavigationScreenProp<NavigationRoute, NavigationAction>,
screenProps: Object,
};
export type NavigationScreenConfig<Options> =
| Options
| (NavigationScreenConfigProps &
(({
navigationOptions: NavigationScreenProp<
NavigationRoute,
NavigationAction
>,
}) => Options));
export type NavigationComponent =
| NavigationScreenComponent<*, *>
| NavigationNavigator<*, *, *, *>;
export type NavigationScreenComponent<T, Options> = ReactClass<T> & {
navigationOptions?: NavigationScreenConfig<Options>,
};
export type NavigationNavigator<T, State, Action, Options> = ReactClass<T> & {
router?: NavigationRouter<State, Action, Options>,
navigationOptions?: NavigationScreenConfig<Options>,
};
export type NavigationParams = {
[key: string]: mixed,
@ -213,37 +70,6 @@ export type NavigationUriAction = {
uri: string,
};
export type NavigationStackViewConfig = {
mode?: 'card' | 'modal',
headerMode?: HeaderMode,
cardStyle?: Style,
transitionConfig?: () => TransitionConfig,
onTransitionStart?: () => void,
onTransitionEnd?: () => void,
};
export type NavigationStackScreenOptions = NavigationScreenOptions & {
header?: ?(React.Element<*> | (HeaderProps => React.Element<*>)),
headerTitle?: string | React.Element<*>,
headerTitleStyle?: Style,
headerTintColor?: string,
headerLeft?: React.Element<*>,
headerBackTitle?: string,
headerTruncatedBackTitle?: string,
headerBackTitleStyle?: Style,
headerPressColorAndroid?: string,
headerRight?: React.Element<*>,
headerStyle?: Style,
gesturesEnabled?: boolean,
};
export type NavigationStackRouterConfig = {
initialRouteName?: string,
initialRouteParams?: NavigationParams,
paths?: NavigationPathsConfig,
navigationOptions?: NavigationScreenConfig<NavigationStackScreenOptions>,
};
export type NavigationStackAction =
| NavigationInitAction
| NavigationNavigateAction
@ -261,7 +87,145 @@ export type NavigationAction =
| NavigationStackAction
| NavigationTabAction;
export type NavigationRouteConfig<T> = T & {
/**
* NavigationState is a tree of routes for a single navigator, where each child
* route may either be a NavigationScreenRoute or a NavigationRouterRoute.
* NavigationScreenRoute represents a leaf screen, while the
* NavigationRouterRoute represents the state of a child navigator.
*
* NOTE: NavigationState is a state tree local to a single navigator and
* its child navigators (via the routes field).
* If we're in navigator nested deep inside the app, the state will only be the
* state for that navigator.
* The state for the root navigator of our app represents the whole navigation
* state for the whole app.
*/
export type NavigationState = {
/**
* Index refers to the active child route in the routes array.
*/
index: number,
routes: Array<NavigationRoute>,
};
export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute;
export type NavigationLeafRoute = {
/**
* React's key used by some navigators. No need to specify these manually,
* they will be defined by the router.
*/
key: string,
/**
* For example 'Home'.
* This is used as a key in a route config when creating a navigator.
*/
routeName: string,
/**
* Path is an advanced feature used for deep linking and on the web.
*/
path?: string,
/**
* Params passed to this route when navigating to it,
* e.g. `{ car_id: 123 }` in a route that displays a car.
*/
params?: NavigationParams,
};
export type NavigationStateRoute = {
...$Exact<NavigationLeafRoute>,
index: number,
routes: Array<NavigationRoute>,
};
/**
* Router
*/
export type NavigationScreenOptionsGetter<Options, Action> = (
navigation: NavigationScreenProp<NavigationRoute, Action>,
screenProps?: {}
) => Options;
export type NavigationRouter<State, Action, Options> = {
/**
* The reducer that outputs the new navigation state for a given action, with
* an optional previous state. When the action is considered handled but the
* state is unchanged, the output state is null.
*/
getStateForAction: (action: Action, lastState: ?State) => ?State,
/**
* Maps a URI-like string to an action. This can be mapped to a state
* using `getStateForAction`.
*/
getActionForPathAndParams: (
path: string,
params?: NavigationParams
) => ?Action,
getPathAndParamsForState: (
state: State
) => {
path: string,
params?: NavigationParams,
},
getComponentForRouteName: (routeName: string) => NavigationComponent,
getComponentForState: (state: State) => NavigationComponent,
/**
* Gets the screen navigation options for a given screen.
*
* For example, we could get the config for the 'Foo' screen when the
* `navigation.state` is:
*
* {routeName: 'Foo', key: '123'}
*/
getScreenOptions: NavigationScreenOptionsGetter<Options, Action>,
};
export type NavigationScreenDetails<T> = {
options: T,
state: NavigationRoute,
navigation: NavigationScreenProp<NavigationRoute, NavigationAction>,
};
export type NavigationScreenOptions = {
title?: string,
};
export type NavigationScreenConfigProps = {
navigation: NavigationScreenProp<NavigationRoute, NavigationAction>,
screenProps: {},
};
export type NavigationScreenConfig<Options> =
| Options
| (({
...$Exact<NavigationScreenConfigProps>,
navigationOptions: NavigationScreenProp<
NavigationRoute,
NavigationAction
>,
}) => Options);
export type NavigationComponent =
| NavigationScreenComponent<*, *>
| NavigationNavigator<*, *, *, *>;
export type NavigationScreenComponent<T, Options> = ReactClass<T> & {
navigationOptions?: NavigationScreenConfig<Options>,
};
export type NavigationNavigator<T, State, Action, Options> = ReactClass<T> & {
router?: NavigationRouter<State, Action, Options>,
navigationOptions?: NavigationScreenConfig<Options>,
};
export type NavigationRouteConfig<T: {}> = {
...$Exact<T>,
navigationOptions?: NavigationScreenConfig<*>,
path?: string,
};
@ -278,6 +242,75 @@ export type NavigationPathsConfig = {
[routeName: string]: string,
};
export type NavigationRouteConfigMap = {
[routeName: string]: NavigationRouteConfig<*>,
};
/**
* Header
*/
export type HeaderMode = 'float' | 'screen' | 'none';
export type HeaderProps = {
...$Exact<NavigationSceneRendererProps>,
mode: HeaderMode,
router: NavigationRouter<
NavigationState,
NavigationAction,
NavigationStackScreenOptions
>,
getScreenDetails: NavigationScene => NavigationScreenDetails<
NavigationStackScreenOptions
>,
style: ViewStyleProp,
};
/**
* Stack Navigator
*/
export type NavigationStackScreenOptions = {
...$Exact<NavigationScreenOptions>,
header?: ?(React.Element<*> | (HeaderProps => React.Element<*>)),
headerTitle?: string | React.Element<*>,
headerTitleStyle?: AnimatedTextStyleProp,
headerTintColor?: string,
headerLeft?: React.Element<*>,
headerBackTitle?: string,
headerTruncatedBackTitle?: string,
headerBackTitleStyle?: TextStyleProp,
headerPressColorAndroid?: string,
headerRight?: React.Element<*>,
headerStyle?: ViewStyleProp,
gesturesEnabled?: boolean,
};
export type NavigationStackRouterConfig = {
initialRouteName?: string,
initialRouteParams?: NavigationParams,
paths?: NavigationPathsConfig,
navigationOptions?: NavigationScreenConfig<NavigationStackScreenOptions>,
};
export type NavigationStackViewConfig = {
mode?: 'card' | 'modal',
headerMode?: HeaderMode,
cardStyle?: ViewStyleProp,
transitionConfig?: () => TransitionConfig,
onTransitionStart?: () => void,
onTransitionEnd?: () => void,
};
export type StackNavigatorConfig = {
...$Exact<NavigationStackViewConfig>,
...$Exact<NavigationStackRouterConfig>,
};
/**
* Tab Navigator
*/
export type NavigationTabRouterConfig = {
initialRouteName?: string,
paths?: NavigationPathsConfig,
@ -288,7 +321,8 @@ export type NavigationTabRouterConfig = {
backBehavior?: 'none' | 'initialRoute', // defaults `initialRoute`
};
export type NavigationTabScreenOptions = NavigationScreenOptions & {
export type NavigationTabScreenOptions = {
...$Exact<NavigationScreenOptions>,
tabBarIcon?:
| React.Element<*>
| ((options: { tintColor: ?string, focused: boolean }) => ?React.Element<
@ -303,7 +337,12 @@ export type NavigationTabScreenOptions = NavigationScreenOptions & {
tabBarVisible?: boolean,
};
export type NavigationDrawerScreenOptions = NavigationScreenOptions & {
/**
* Drawer
*/
export type NavigationDrawerScreenOptions = {
...$Exact<NavigationScreenOptions>,
drawerIcon?:
| React.Element<*>
| ((options: { tintColor: ?string, focused: boolean }) => ?React.Element<
@ -316,9 +355,9 @@ export type NavigationDrawerScreenOptions = NavigationScreenOptions & {
>),
};
export type NavigationRouteConfigMap = {
[routeName: string]: NavigationRouteConfig<*>,
};
/**
* Navigator Prop
*/
export type NavigationDispatch<A> = (action: A) => boolean;
@ -339,10 +378,10 @@ export type NavigationScreenProp<S, A> = {
setParams: (newParams: NavigationParams) => boolean,
};
export type NavigationNavigatorProps<T> = {
navigation: NavigationProp<T, NavigationAction>,
export type NavigationNavigatorProps<O, S> = {
navigation: NavigationProp<S, NavigationAction>,
screenProps: *,
navigationOptions: *,
navigationOptions: O,
};
/**
@ -352,11 +391,11 @@ export type NavigationNavigatorProps<T> = {
export type NavigationGestureDirection = 'horizontal' | 'vertical';
export type NavigationLayout = {
height: AnimatedValue,
height: Animated.Value,
initHeight: number,
initWidth: number,
isMeasured: boolean,
width: AnimatedValue,
width: Animated.Value,
};
export type NavigationScene = {
@ -375,14 +414,14 @@ export type NavigationTransitionProps = {
navigation: NavigationScreenProp<NavigationState, NavigationAction>,
// The progressive index of the transitioner's navigation state.
position: AnimatedValue,
position: Animated.Value,
// The value that represents the progress of the transition when navigation
// state changes from one to another. Its numberic value will range from 0
// to 1.
// progress.__getAnimatedValue() < 1 : transtion is happening.
// progress.__getAnimatedValue() == 1 : transtion completes.
progress: AnimatedValue,
progress: Animated.Value,
// All the scenes of the transitioner.
scenes: Array<NavigationScene>,
@ -406,9 +445,9 @@ export type NavigationSceneRendererProps = NavigationTransitionProps;
export type NavigationTransitionSpec = {
duration?: number,
// An easing function from `Easing`.
easing?: (t: number) => number,
easing?: (t?: number) => number,
// A timing function such as `Animated.timing`.
timing?: (value: AnimatedValue, config: any) => any,
timing?: (value: Animated.Value, config: any) => any,
};
/**
@ -419,14 +458,14 @@ export type TransitionConfig = {
transitionSpec?: NavigationTransitionSpec,
// How to animate position and opacity of the screen
// based on the value generated by the transitionSpec
screenInterpolator?: (props: NavigationSceneRendererProps) => Object,
screenInterpolator?: (props: NavigationSceneRendererProps) => {},
// The style of the container. Useful when a scene doesn't have
// 100% opacity and the underlying container is visible.
containerStyle?: Style,
containerStyle?: $PropertyType<ViewProps, 'style'>,
};
export type NavigationAnimationSetter = (
position: AnimatedValue,
position: Animated.Value,
newState: NavigationState,
lastState: NavigationState
) => void;
@ -435,7 +474,7 @@ export type NavigationSceneRenderer = () => ?React.Element<*>;
export type NavigationStyleInterpolator = (
props: NavigationSceneRendererProps
) => Style;
) => AnimatedViewStylePropTypes;
export type LayoutEvent = {
nativeEvent: {

View File

@ -2,7 +2,7 @@
import React from 'react';
import invariant from './utils/invariant';
import { BackAndroid, Linking } from './PlatformHelpers';
import { BackHandler, Linking } from './PlatformHelpers';
import NavigationActions from './NavigationActions';
import addNavigationHelpers from './addNavigationHelpers';
@ -12,6 +12,7 @@ import type {
NavigationState,
NavigationScreenProp,
NavigationNavigatorProps,
NavigationNavigator,
} from './TypeDefinition';
type NavigationContainerProps = {
@ -23,7 +24,7 @@ type NavigationContainerProps = {
) => void,
};
type Props<T> = NavigationContainerProps & NavigationNavigatorProps<T>;
type Props<O, S> = NavigationContainerProps & NavigationNavigatorProps<O, S>;
type State = {
nav: ?NavigationState,
@ -35,18 +36,12 @@ type State = {
* This allows to use e.g. the StackNavigator and TabNavigator as root-level
* components.
*/
export default function createNavigationContainer<T: *>(
Component: ReactClass<NavigationNavigatorProps<T>>,
containerOptions?: {}
export default function createNavigationContainer<S: *, O>(
Component: NavigationNavigator<*, S, *, O>
) {
invariant(
typeof containerOptions === 'undefined',
'containerOptions.URIPrefix has been removed. Pass the uriPrefix prop to the navigator instead'
);
class NavigationContainer extends React.Component<void, Props<T>, State> {
class NavigationContainer extends React.Component<void, Props<O, S>, State> {
state: State;
props: Props<T>;
props: Props<O, S>;
subs: ?{
remove: () => void,
@ -54,7 +49,7 @@ export default function createNavigationContainer<T: *>(
static router = Component.router;
constructor(props: Props<T>) {
constructor(props: Props<O, S>) {
super(props);
this._validateProps(props);
@ -70,7 +65,7 @@ export default function createNavigationContainer<T: *>(
return !this.props.navigation;
}
_validateProps(props: Props<T>) {
_validateProps(props: Props<O, S>) {
if (this._isStateful()) {
return;
}
@ -82,7 +77,9 @@ export default function createNavigationContainer<T: *>(
invariant(
keys.length === 0,
'This navigator has both navigation and container props, so it is ' +
`unclear if it should own its own state. Remove props: "${keys.join(', ')}" ` +
`unclear if it should own its own state. Remove props: "${keys.join(
', '
)}" ` +
'if the navigator should get its state from the navigation prop. If the ' +
'navigator should maintain its own state, do not pass a navigation prop.'
);
@ -119,7 +116,8 @@ export default function createNavigationContainer<T: *>(
) {
if (
typeof this.props.onNavigationStateChange === 'undefined' &&
this._isStateful()
this._isStateful() &&
!!process.env.REACT_NAV_LOGGING
) {
/* eslint-disable no-console */
if (console.group) {
@ -153,7 +151,7 @@ export default function createNavigationContainer<T: *>(
return;
}
this.subs = BackAndroid.addEventListener('backPress', () =>
this.subs = BackHandler.addEventListener('hardwareBackPress', () =>
this.dispatch(NavigationActions.back())
);
@ -162,7 +160,7 @@ export default function createNavigationContainer<T: *>(
});
Linking.getInitialURL().then(
(url: string) => url && this._handleOpenURL(url)
(url: ?string) => url && this._handleOpenURL(url)
);
}

View File

@ -28,8 +28,8 @@ const DefaultDrawerConfig = {
* Default drawer width is screen width - header width
* https://material.io/guidelines/patterns/navigation-drawer.html
*/
drawerWidth: Dimensions.get('window').width -
(Platform.OS === 'android' ? 56 : 64),
drawerWidth:
Dimensions.get('window').width - (Platform.OS === 'android' ? 56 : 64),
contentComponent: DrawerItems,
drawerPosition: 'left',
};
@ -74,7 +74,7 @@ const DrawerNavigator = (
routeConfigs,
config,
NavigatorTypes.DRAWER
)((props: *) => (
)((props: *) =>
<DrawerView
{...props}
drawerWidth={drawerWidth}
@ -82,9 +82,9 @@ const DrawerNavigator = (
contentOptions={contentOptions}
drawerPosition={drawerPosition}
/>
));
);
return createNavigationContainer(navigator, containerConfig);
return createNavigationContainer(navigator);
};
export default DrawerNavigator;

View File

@ -3,21 +3,15 @@
import React from 'react';
import createNavigationContainer from '../createNavigationContainer';
import createNavigator from './createNavigator';
import CardStackTransitioner from '../views/CardStackTransitioner';
import CardStackTransitioner from '../views/CardStack/CardStackTransitioner';
import StackRouter from '../routers/StackRouter';
import NavigatorTypes from './NavigatorTypes';
import type {
NavigationStackRouterConfig,
NavigationStackViewConfig,
NavigationRouteConfigMap,
StackNavigatorConfig,
} from '../TypeDefinition';
export type StackNavigatorConfig = {
containerOptions?: void,
} & NavigationStackViewConfig &
NavigationStackRouterConfig;
export default (
routeConfigMap: NavigationRouteConfigMap,
stackConfig: StackNavigatorConfig = {}
@ -34,6 +28,7 @@ export default (
onTransitionEnd,
navigationOptions,
} = stackConfig;
const stackRouterConfig = {
initialRouteName,
initialRouteParams,
@ -43,12 +38,13 @@ export default (
const router = StackRouter(routeConfigMap, stackRouterConfig);
// Create a navigator with CardStackTransitioner as the view
const navigator = createNavigator(
router,
routeConfigMap,
stackConfig,
NavigatorTypes.STACK
)((props: *) => (
)((props: *) =>
<CardStackTransitioner
{...props}
headerMode={headerMode}
@ -58,7 +54,7 @@ export default (
onTransitionStart={onTransitionStart}
onTransitionEnd={onTransitionEnd}
/>
));
);
return createNavigationContainer(navigator, stackConfig.containerOptions);
return createNavigationContainer(navigator);
};

View File

@ -47,7 +47,7 @@ const TabNavigator = (
routeConfigs,
config,
NavigatorTypes.TABS
)((props: *) => (
)((props: *) =>
<TabView
{...props}
tabBarComponent={tabBarComponent}
@ -57,9 +57,9 @@ const TabNavigator = (
animationEnabled={animationEnabled}
lazy={lazy}
/>
));
);
return createNavigationContainer(navigator, tabsConfig.containerOptions);
return createNavigationContainer(navigator);
};
const Presets = {
@ -100,9 +100,8 @@ const Presets = {
TabNavigator.Presets = {
iOSBottomTabs: Presets.iOSBottomTabs,
AndroidTopTabs: Presets.AndroidTopTabs,
Default: Platform.OS === 'ios'
? Presets.iOSBottomTabs
: Presets.AndroidTopTabs,
Default:
Platform.OS === 'ios' ? Presets.iOSBottomTabs : Presets.AndroidTopTabs,
};
export default TabNavigator;

View File

@ -14,14 +14,17 @@ import type { NavigatorType } from './NavigatorTypes';
/**
* Creates a navigator based on a router and a view that renders the screens.
*/
const createNavigator = (
router: NavigationRouter<*, *, *>,
export default function createNavigator<C: *, S, A, NavigatorConfig, Options>(
router: NavigationRouter<S, A, Options>,
routeConfigs: NavigationRouteConfigMap,
navigatorConfig: any,
navigatorConfig: NavigatorConfig,
navigatorType: NavigatorType
) => (View: NavigationNavigator<*, *, *, *>) => {
) {
return (
NavigationView: ReactClass<C>
): NavigationNavigator<C, S, A, Options> => {
class Navigator extends React.Component {
props: NavigationNavigatorProps<*>;
props: NavigationNavigatorProps<Options, S>;
static router = router;
@ -30,11 +33,10 @@ const createNavigator = (
static navigatorType = navigatorType;
render() {
return <View {...this.props} router={router} />;
return <NavigationView {...this.props} router={router} />;
}
}
return Navigator;
};
export default createNavigator;
};
}

View File

@ -46,24 +46,24 @@ module.exports = {
return require('./views/Transitioner').default;
},
get CardStackTransitioner() {
return require('./views/CardStackTransitioner').default;
return require('./views/CardStack/CardStackTransitioner').default;
},
get CardStack() {
return require('./views/CardStack').default;
return require('./views/CardStack/CardStack').default;
},
get Card() {
return require('./views/Card').default;
return require('./views/CardStack/Card').default;
},
// Header
get Header() {
return require('./views/Header').default;
return require('./views/Header/Header').default;
},
get HeaderTitle() {
return require('./views/HeaderTitle').default;
return require('./views/Header/HeaderTitle').default;
},
get HeaderBackButton() {
return require('./views/HeaderBackButton').default;
return require('./views/Header/HeaderBackButton').default;
},
// DrawerView

View File

@ -20,6 +20,7 @@ import type {
NavigationState,
NavigationStackAction,
NavigationStackRouterConfig,
NavigationStackScreenOptions,
} from '../TypeDefinition';
const uniqueBaseId = `id-${Date.now()}`;
@ -31,13 +32,14 @@ function _getUuid() {
export default (
routeConfigs: NavigationRouteConfigMap,
stackConfig: NavigationStackRouterConfig = {}
): NavigationRouter<*, *, *> => {
): NavigationRouter<*, *, NavigationStackScreenOptions> => {
// Fail fast on invalid route definitions
validateRouteConfigMap(routeConfigs);
const childRouters = {};
const routeNames = Object.keys(routeConfigs);
// Loop through routes and find child routers
routeNames.forEach((routeName: string) => {
const screen = getScreenForRouteName(routeConfigs, routeName);
if (screen && screen.router) {
@ -56,6 +58,7 @@ export default (
const initialChildRouter = childRouters[initialRouteName];
const paths = stackConfig.paths || {};
// Build paths for each route
routeNames.forEach((routeName: string) => {
let pathPattern = paths[routeName] || routeConfigs[routeName].path;
const matchExact = !!pathPattern && !childRouters[routeName];

View File

@ -38,9 +38,8 @@ export default (
const tabRouters = {};
order.forEach((routeName: string) => {
const routeConfig = routeConfigs[routeName];
paths[routeName] = typeof routeConfig.path === 'string'
? routeConfig.path
: routeName;
paths[routeName] =
typeof routeConfig.path === 'string' ? routeConfig.path : routeName;
tabRouters[routeName] = null;
if (routeConfig.screen && routeConfig.screen.router) {
tabRouters[routeName] = routeConfig.screen.router;

View File

@ -752,7 +752,6 @@ describe('StackRouter', () => {
expect(state2 && state2.routes[1].params).toEqual({ foo: '42' });
/* $FlowFixMe */
expect(state2 && state2.routes[1].routes).toEqual([
/* $FlowFixMe */
expect.objectContaining({
routeName: 'Baz',
params: { foo: '42' },
@ -819,7 +818,6 @@ describe('StackRouter', () => {
}
expect(state && state.index).toEqual(0);
expect(state && state.routes[0]).toEqual(
// $FlowFixMe
expect.objectContaining({
routeName: 'Bar',
type: undefined,

View File

@ -13,7 +13,9 @@ test('should get config for screen', () => {
class HomeScreen extends Component {
static navigationOptions = ({ navigation }: *) => ({
title: `Welcome ${navigation.state.params ? navigation.state.params.user : 'anonymous'}`,
title: `Welcome ${navigation.state.params
? navigation.state.params.user
: 'anonymous'}`,
gesturesEnabled: true,
});

View File

@ -18,9 +18,9 @@ import type {
NavigationScreenConfigProps,
} from '../TypeDefinition';
function applyConfig(
configurer: ?NavigationScreenConfig<*>,
navigationOptions: *,
function applyConfig<T: {}>(
configurer: ?NavigationScreenConfig<T>,
navigationOptions: any,
configProps: NavigationScreenConfigProps
): * {
if (typeof configurer === 'function') {

View File

@ -6,11 +6,12 @@ import { Animated, StyleSheet } from 'react-native';
import createPointerEventsContainer from './PointerEventsContainer';
import type { NavigationSceneRendererProps } from '../TypeDefinition';
import type { NavigationSceneRendererProps } from '../../TypeDefinition';
type Props = NavigationSceneRendererProps & {
type Props = {
...$Exact<NavigationSceneRendererProps>,
children: React.Children<*>,
onComponentRef: (ref: any) => void,
onComponentRef: (ref: React.Element<*>) => void,
pointerEvents: string,
style: any,
};
@ -18,7 +19,7 @@ type Props = NavigationSceneRendererProps & {
/**
* Component that renders the scene as card for the <NavigationCardStack />.
*/
class Card extends React.Component<any, Props, any> {
class Card extends React.Component<void, Props, void> {
props: Props;
render() {

View File

@ -14,10 +14,10 @@ import {
} from 'react-native';
import Card from './Card';
import Header from './Header';
import NavigationActions from '../NavigationActions';
import addNavigationHelpers from '../addNavigationHelpers';
import SceneView from './SceneView';
import Header from '../Header/Header';
import NavigationActions from '../../NavigationActions';
import addNavigationHelpers from '../../addNavigationHelpers';
import SceneView from '../SceneView';
import type {
NavigationAction,
@ -29,9 +29,9 @@ import type {
NavigationScreenDetails,
NavigationStackScreenOptions,
HeaderMode,
Style,
ViewStyleProp,
TransitionConfig,
} from '../TypeDefinition';
} from '../../TypeDefinition';
import TransitionConfigs from './TransitionConfigs';
@ -42,15 +42,16 @@ type Props = {
headerMode: HeaderMode,
headerComponent?: ReactClass<*>,
mode: 'card' | 'modal',
navigation: NavigationScreenProp<NavigationState, NavigationAction>,
router: NavigationRouter<
NavigationState,
NavigationAction,
NavigationStackScreenOptions
>,
cardStyle?: Style,
cardStyle?: ViewStyleProp,
onTransitionStart?: () => void,
onTransitionEnd?: () => void,
style?: any,
style?: any, // TODO: Remove
/**
* Optional custom animation when transitioning between screens.
*/
@ -258,9 +259,8 @@ class CardStack extends Component {
if (index !== scene.index) {
return false;
}
const immediateIndex = this._immediateIndex == null
? index
: this._immediateIndex;
const immediateIndex =
this._immediateIndex == null ? index : this._immediateIndex;
const currentDragDistance = gesture[isVertical ? 'dy' : 'dx'];
const currentDragPosition =
event.nativeEvent[isVertical ? 'pageY' : 'pageX'];
@ -296,7 +296,8 @@ class CardStack extends Component {
const axisDistance = isVertical
? layout.height.__getValue()
: layout.width.__getValue();
const currentValue = I18nManager.isRTL && axis === 'dx'
const currentValue =
I18nManager.isRTL && axis === 'dx'
? startValue + gesture[axis] / axisDistance
: startValue - gesture[axis] / axisDistance;
const value = clamp(index - 1, currentValue, index);
@ -312,9 +313,8 @@ class CardStack extends Component {
}
this._isResponding = false;
const immediateIndex = this._immediateIndex == null
? index
: this._immediateIndex;
const immediateIndex =
this._immediateIndex == null ? index : this._immediateIndex;
// Calculate animate duration according to gesture speed and moved distance
const axisDistance = isVertical
@ -352,7 +352,8 @@ class CardStack extends Component {
});
const { options } = this._getScreenDetails(scene);
const gesturesEnabled = typeof options.gesturesEnabled === 'boolean'
const gesturesEnabled =
typeof options.gesturesEnabled === 'boolean'
? options.gesturesEnabled
: Platform.OS === 'ios';

View File

@ -1,8 +1,8 @@
/* @flow */
import { I18nManager } from 'react-native';
import { I18nManager, type AnimatedViewStylePropTypes } from 'react-native';
import type { NavigationSceneRendererProps } from '../TypeDefinition';
import type { NavigationSceneRendererProps } from '../../TypeDefinition';
/**
* Utility that builds the style for the card in the cards stack.
@ -22,7 +22,9 @@ import type { NavigationSceneRendererProps } from '../TypeDefinition';
/**
* Render the initial style when the initial layout isn't measured yet.
*/
function forInitial(props: NavigationSceneRendererProps): Object {
function forInitial(
props: NavigationSceneRendererProps
): AnimatedViewStylePropTypes {
const { navigation, scene } = props;
const focused = navigation.state.index === scene.index;
@ -38,7 +40,9 @@ function forInitial(props: NavigationSceneRendererProps): Object {
/**
* Standard iOS-style slide in from the right.
*/
function forHorizontal(props: NavigationSceneRendererProps): Object {
function forHorizontal(
props: NavigationSceneRendererProps
): AnimatedViewStylePropTypes {
const { layout, position, scene } = props;
if (!layout.isMeasured) {
@ -81,7 +85,9 @@ function forHorizontal(props: NavigationSceneRendererProps): Object {
/**
* Standard iOS-style slide in from the bottom (used for modals).
*/
function forVertical(props: NavigationSceneRendererProps): Object {
function forVertical(
props: NavigationSceneRendererProps
): AnimatedViewStylePropTypes {
const { layout, position, scene } = props;
if (!layout.isMeasured) {
@ -117,7 +123,9 @@ function forVertical(props: NavigationSceneRendererProps): Object {
/**
* Standard Android-style fade in from the bottom.
*/
function forFadeFromBottomAndroid(props: NavigationSceneRendererProps): Object {
function forFadeFromBottomAndroid(
props: NavigationSceneRendererProps
): AnimatedViewStylePropTypes {
const { layout, position, scene } = props;
if (!layout.isMeasured) {

View File

@ -5,7 +5,7 @@ import { NativeModules } from 'react-native';
import CardStack from './CardStack';
import CardStackStyleInterpolator from './CardStackStyleInterpolator';
import Transitioner from './Transitioner';
import Transitioner from '../Transitioner';
import TransitionConfigs from './TransitionConfigs';
import type {
@ -17,9 +17,9 @@ import type {
NavigationTransitionProps,
NavigationRouter,
HeaderMode,
Style,
ViewStyleProp,
TransitionConfig,
} from '../TypeDefinition';
} from '../../TypeDefinition';
const NativeAnimatedModule =
NativeModules && NativeModules.NativeAnimatedModule;
@ -34,10 +34,10 @@ type Props = {
NavigationAction,
NavigationStackScreenOptions
>,
cardStyle?: Style,
cardStyle?: ViewStyleProp,
onTransitionStart?: () => void,
onTransitionEnd?: () => void,
style: Style,
style: ViewStyleProp,
/**
* Optional custom animation when transitioning between screens.
*/
@ -88,7 +88,7 @@ class CardStackTransitioner extends Component<DefaultProps, Props, void> {
if (
!!NativeAnimatedModule &&
// Native animation support also depends on the transforms used:
CardStackStyleInterpolator.canUseNativeDriver(isModal)
CardStackStyleInterpolator.canUseNativeDriver()
) {
// Internal undocumented prop
transitionSpec.useNativeDriver = true;

View File

@ -2,11 +2,11 @@
import React from 'react';
import invariant from '../utils/invariant';
import invariant from '../../utils/invariant';
import AnimatedValueSubscription from './AnimatedValueSubscription';
import AnimatedValueSubscription from '../AnimatedValueSubscription';
import type { NavigationSceneRendererProps } from '../TypeDefinition';
import type { NavigationSceneRendererProps } from '../../TypeDefinition';
type Props = NavigationSceneRendererProps;

View File

@ -6,17 +6,10 @@ import type {
NavigationTransitionProps,
NavigationTransitionSpec,
TransitionConfig,
} from '../TypeDefinition';
} from '../../TypeDefinition';
import CardStackStyleInterpolator from './CardStackStyleInterpolator';
// Used for all animations unless overriden
const DefaultTransitionSpec = ({
duration: 250,
easing: Easing.inOut(Easing.ease),
timing: Animated.timing,
}: NavigationTransitionSpec);
const IOSTransitionSpec = ({
duration: 500,
easing: Easing.bezier(0.2833, 0.99, 0.31833, 0.99),
@ -113,7 +106,6 @@ function getTransitionConfig(
}
export default {
DefaultTransitionSpec,
defaultTransitionConfig,
getTransitionConfig,
};

View File

@ -10,7 +10,8 @@ import type {
NavigationState,
NavigationAction,
NavigationRoute,
Style,
ViewStyleProp,
TextStyleProp,
} from '../../TypeDefinition';
import type { DrawerScene, DrawerItem } from './DrawerView.js';
@ -25,8 +26,8 @@ type Props = {
getLabel: (scene: DrawerScene) => ?(React.Element<*> | string),
renderIcon: (scene: DrawerScene) => ?React.Element<*>,
onItemPress: (info: DrawerItem) => void,
style?: Style,
labelStyle?: Style,
style?: ViewStyleProp,
labelStyle?: TextStyleProp,
};
/**
@ -45,7 +46,7 @@ const DrawerNavigatorItems = ({
onItemPress,
style,
labelStyle,
}: Props) => (
}: Props) =>
<View style={[styles.container, style]}>
{items.map((route: NavigationRoute, index: number) => {
const focused = activeItemKey === route.key;
@ -81,8 +82,7 @@ const DrawerNavigatorItems = ({
</TouchableItem>
);
})}
</View>
);
</View>;
/* Material design specs - https://material.io/guidelines/patterns/navigation-drawer.html#navigation-drawer-specs */
DrawerNavigatorItems.defaultProps = {

View File

@ -14,7 +14,7 @@ import type {
NavigationDrawerScreenOptions,
NavigationState,
NavigationStateRoute,
Style,
ViewStyleProp,
} from '../../TypeDefinition';
import type { DrawerScene, DrawerItem } from './DrawerView';
@ -32,7 +32,7 @@ type Props = {
contentComponent: ReactClass<*>,
contentOptions?: {},
screenProps?: {},
style?: Style,
style?: ViewStyleProp,
};
/**
@ -85,9 +85,14 @@ class DrawerSidebar extends PureComponent<void, Props, void> {
_onItemPress = ({ route, focused }: DrawerItem) => {
this.props.navigation.navigate('DrawerClose');
if (!focused) {
const subAction = route.index !== undefined && route.index !== 0 // if the child screen is a StackRouter then always navigate to its first screen (see #1914)
? NavigationActions.navigate({ routeName: route.routes[0].routeName })
: undefined;
let subAction;
// if the child screen is a StackRouter then always navigate to its first screen (see #1914)
if (route.index !== undefined && route.index !== 0) {
route = ((route: any): NavigationStateRoute);
subAction = NavigationActions.navigate({
routeName: route.routes[0].routeName,
});
}
this.props.navigation.navigate(route.routeName, undefined, subAction);
}
};

View File

@ -13,7 +13,7 @@ import type {
NavigationState,
NavigationAction,
NavigationDrawerScreenOptions,
Style,
ViewStyleProp,
} from '../../TypeDefinition';
export type DrawerScene = {
@ -33,7 +33,7 @@ export type DrawerViewConfig = {
drawerPosition: 'left' | 'right',
contentComponent: ReactClass<*>,
contentOptions?: {},
style?: Style,
style?: ViewStyleProp,
};
type Props = DrawerViewConfig & {
@ -115,7 +115,7 @@ export default class DrawerView<T: *> extends PureComponent<void, Props, void> {
return navigationState;
};
_renderNavigationView = () => (
_renderNavigationView = () =>
<DrawerSidebar
screenProps={this.props.screenProps}
navigation={this._screenNavigationProp}
@ -123,8 +123,7 @@ export default class DrawerView<T: *> extends PureComponent<void, Props, void> {
contentComponent={this.props.contentComponent}
contentOptions={this.props.contentOptions}
style={this.props.style}
/>
);
/>;
_drawer: any;

View File

@ -15,7 +15,7 @@ import type {
NavigationStyleInterpolator,
LayoutEvent,
HeaderProps,
} from '../TypeDefinition';
} from '../../TypeDefinition';
type SceneProps = {
scene: NavigationScene,
@ -23,7 +23,7 @@ type SceneProps = {
progress: Animated.Value,
};
type SubViewRenderer = (props: SceneProps) => ?React.Element<any>;
type SubViewRenderer<T> = (props: SceneProps) => ?React.Element<T>;
type SubViewName = 'left' | 'title' | 'right';
@ -81,7 +81,7 @@ class Header extends React.PureComponent<void, HeaderProps, HeaderState> {
this.props.navigation.goBack(null);
};
_renderTitleComponent = (props: SceneProps) => {
_renderTitleComponent = (props: SceneProps): ?React.Element<*> => {
const details = this.props.getScreenDetails(props.scene);
const headerTitle = details.options.headerTitle;
if (headerTitle && typeof headerTitle !== 'string') {
@ -94,7 +94,8 @@ class Header extends React.PureComponent<void, HeaderProps, HeaderState> {
// On iOS, width of left/right components depends on the calculated
// size of the title.
const onLayoutIOS = Platform.OS === 'ios'
const onLayoutIOS =
Platform.OS === 'ios'
? (e: LayoutEvent) => {
this.setState({
widths: {
@ -115,7 +116,7 @@ class Header extends React.PureComponent<void, HeaderProps, HeaderState> {
);
};
_renderLeftComponent = (props: SceneProps) => {
_renderLeftComponent = (props: SceneProps): ?React.Element<*> => {
const options = this.props.getScreenDetails(props.scene).options;
if (typeof options.headerLeft !== 'undefined') {
return options.headerLeft;
@ -143,7 +144,7 @@ class Header extends React.PureComponent<void, HeaderProps, HeaderState> {
);
};
_renderRightComponent = (props: SceneProps) => {
_renderRightComponent = (props: SceneProps): ?React.Element<*> => {
const details = this.props.getScreenDetails(props.scene);
const { headerRight } = details.options;
return headerRight || null;
@ -187,10 +188,10 @@ class Header extends React.PureComponent<void, HeaderProps, HeaderState> {
);
}
_renderSubView(
_renderSubView<T>(
props: SceneProps,
name: SubViewName,
renderer: SubViewRenderer,
renderer: SubViewRenderer<T>,
styleInterpolator: NavigationStyleInterpolator
): ?React.Element<*> {
const { scene } = props;
@ -283,7 +284,7 @@ class Header extends React.PureComponent<void, HeaderProps, HeaderState> {
...rest
} = this.props;
const { options } = this.props.getScreenDetails(scene, screenProps);
const { options } = this.props.getScreenDetails(scene);
const headerStyle = options.headerStyle;
return (
@ -296,11 +297,14 @@ class Header extends React.PureComponent<void, HeaderProps, HeaderState> {
}
}
const styles = StyleSheet.create({
container: {
paddingTop: STATUSBAR_HEIGHT,
backgroundColor: Platform.OS === 'ios' ? '#EFEFF2' : '#FFF',
height: STATUSBAR_HEIGHT + APPBAR_HEIGHT,
let platformContainerStyles;
if (Platform.OS === 'ios') {
platformContainerStyles = {
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: 'rgba(0, 0, 0, .3)',
};
} else {
platformContainerStyles = {
shadowColor: 'black',
shadowOpacity: 0.1,
shadowRadius: StyleSheet.hairlineWidth,
@ -308,6 +312,15 @@ const styles = StyleSheet.create({
height: StyleSheet.hairlineWidth,
},
elevation: 4,
};
}
const styles = StyleSheet.create({
container: {
paddingTop: STATUSBAR_HEIGHT,
backgroundColor: Platform.OS === 'ios' ? '#F7F7F7' : '#FFF',
height: STATUSBAR_HEIGHT + APPBAR_HEIGHT,
...platformContainerStyles,
},
appBar: {
flex: 1,

View File

@ -10,22 +10,22 @@ import {
StyleSheet,
} from 'react-native';
import type { LayoutEvent, Style } from '../TypeDefinition';
import type { LayoutEvent, TextStyleProp } from '../../TypeDefinition';
import TouchableItem from './TouchableItem';
import TouchableItem from '../TouchableItem';
type Props = {
onPress?: () => void,
pressColorAndroid?: ?string,
pressColorAndroid?: string,
title?: ?string,
titleStyle?: ?Style,
titleStyle?: ?TextStyleProp,
tintColor?: ?string,
truncatedTitle?: ?string,
width?: ?number,
};
type DefaultProps = {
pressColorAndroid: ?string,
pressColorAndroid: string,
tintColor: ?string,
truncatedTitle: ?string,
};
@ -65,14 +65,15 @@ class HeaderBackButton extends React.PureComponent<DefaultProps, Props, State> {
truncatedTitle,
} = this.props;
const renderTruncated = this.state.initialTextWidth && width
const renderTruncated =
this.state.initialTextWidth && width
? this.state.initialTextWidth > width
: false;
const backButtonTitle = renderTruncated ? truncatedTitle : title;
// eslint-disable-next-line global-require
const asset = require('./assets/back-icon.png');
const asset = require('../assets/back-icon.png');
return (
<TouchableItem
@ -88,14 +89,22 @@ class HeaderBackButton extends React.PureComponent<DefaultProps, Props, State> {
>
<View style={styles.container}>
<Image
style={[styles.icon, title && styles.iconWithTitle, { tintColor }]}
style={[
styles.icon,
!!title && styles.iconWithTitle,
!!tintColor && { tintColor },
]}
source={asset}
/>
{Platform.OS === 'ios' &&
title &&
<Text
onLayout={this._onTextLayout}
style={[styles.title, { color: tintColor }, titleStyle]}
style={[
styles.title,
!!tintColor && { color: tintColor },
titleStyle,
]}
numberOfLines={1}
>
{backButtonTitle}
@ -116,7 +125,8 @@ const styles = StyleSheet.create({
fontSize: 17,
paddingRight: 10,
},
icon: Platform.OS === 'ios'
icon:
Platform.OS === 'ios'
? {
height: 21,
width: 13,
@ -133,7 +143,8 @@ const styles = StyleSheet.create({
resizeMode: 'contain',
transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
},
iconWithTitle: Platform.OS === 'ios'
iconWithTitle:
Platform.OS === 'ios'
? {
marginRight: 5,
}

View File

@ -1,8 +1,16 @@
/* @flow */
import { I18nManager } from 'react-native';
import {
I18nManager,
Animated,
type StyleDefinition,
type AnimatedViewStylePropTypes,
} from 'react-native';
import type { NavigationSceneRendererProps } from '../TypeDefinition';
import type {
NavigationSceneRendererProps,
AnimatedViewStyleProp,
} from '../../TypeDefinition';
/**
* Utility that builds the style for the navigation header.
@ -15,7 +23,9 @@ import type { NavigationSceneRendererProps } from '../TypeDefinition';
* +-------------+-------------+-------------+
*/
function forLeft(props: NavigationSceneRendererProps): Object {
function forLeft(
props: NavigationSceneRendererProps
): AnimatedViewStylePropTypes {
const { position, scene } = props;
const { index } = scene;
return {
@ -26,7 +36,9 @@ function forLeft(props: NavigationSceneRendererProps): Object {
};
}
function forCenter(props: NavigationSceneRendererProps): Object {
function forCenter(
props: NavigationSceneRendererProps
): AnimatedViewStylePropTypes {
const { position, scene } = props;
const { index } = scene;
return {
@ -47,7 +59,9 @@ function forCenter(props: NavigationSceneRendererProps): Object {
};
}
function forRight(props: NavigationSceneRendererProps): Object {
function forRight(
props: NavigationSceneRendererProps
): AnimatedViewStylePropTypes {
const { position, scene } = props;
const { index } = scene;
return {

View File

@ -2,23 +2,28 @@
import React from 'react';
import { Platform, StyleSheet, Animated } from 'react-native';
import { Text, View, Platform, StyleSheet, Animated } from 'react-native';
import type { Style } from '../TypeDefinition';
type AnimatedTextStyleProp = $PropertyType<
$PropertyType<Animated.Text, 'props'>,
'style'
>;
type Props = {
tintColor?: ?string,
style?: Style,
children: React$Element<*>,
selectionColor?: string | number,
style?: AnimatedTextStyleProp,
};
const HeaderTitle = ({ style, ...rest }: Props) => (
<Animated.Text
const AnimatedText = Animated.Text;
const HeaderTitle = ({ style, ...rest }: Props) =>
<AnimatedText
numberOfLines={1}
{...rest}
style={[styles.title, style]}
accessibilityTraits="header"
/>
);
/>;
const styles = StyleSheet.create({
title: {

View File

@ -10,18 +10,18 @@ import type {
NavigationNavigatorProps,
} from '../TypeDefinition';
type Props = {
type Props<O> = {
screenProps?: {},
navigation: NavigationScreenProp<NavigationRoute, NavigationAction>,
component: ReactClass<NavigationNavigatorProps<NavigationRoute>>,
component: ReactClass<NavigationNavigatorProps<O, NavigationRoute>>,
};
export default class SceneView extends PureComponent<void, Props, void> {
export default class SceneView<O> extends PureComponent<void, Props<O>, void> {
static childContextTypes = {
navigation: propTypes.object.isRequired,
};
props: Props;
props: Props<O>;
getChildContext() {
return {

View File

@ -9,7 +9,8 @@ import type {
NavigationRoute,
NavigationState,
NavigationScreenProp,
Style,
ViewStyleProp,
TextStyleProp,
} from '../../TypeDefinition';
import type { TabScene } from './TabView';
@ -33,14 +34,17 @@ type Props = {
getLabel: (scene: TabScene) => ?(React.Element<*> | string),
renderIcon: (scene: TabScene) => React.Element<*>,
showLabel: boolean,
style?: Style,
labelStyle?: Style,
tabStyle?: Style,
style?: ViewStyleProp,
labelStyle?: TextStyleProp,
tabStyle?: ViewStyleProp,
showIcon: boolean,
};
export default class TabBarBottom
extends PureComponent<DefaultProps, Props, void> {
export default class TabBarBottom extends PureComponent<
DefaultProps,
Props,
void
> {
// See https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/UIKitUICatalog/UITabBar.html
static defaultProps = {
activeTintColor: '#3478f6', // Default active tint color in iOS 10
@ -75,7 +79,7 @@ export default class TabBarBottom
);
const color = position.interpolate({
inputRange,
outputRange,
outputRange: (outputRange: Array<string>),
});
const tintColor = scene.focused ? activeTintColor : inactiveTintColor;
@ -146,7 +150,7 @@ export default class TabBarBottom
);
const backgroundColor = position.interpolate({
inputRange,
outputRange,
outputRange: (outputRange: Array<string>),
});
const justifyContent = this.props.showIcon ? 'flex-end' : 'center';
return (
@ -177,8 +181,8 @@ const styles = StyleSheet.create({
height: 49, // Default tab bar height in iOS 10
flexDirection: 'row',
borderTopWidth: StyleSheet.hairlineWidth,
borderTopColor: 'rgba(0, 0, 0, .2)',
backgroundColor: '#f4f4f4', // Default background color in iOS 10
borderTopColor: 'rgba(0, 0, 0, .3)',
backgroundColor: '#F7F7F7', // Default background color in iOS 10
},
tab: {
flex: 1,

View File

@ -7,7 +7,7 @@ import type {
NavigationAction,
NavigationState,
NavigationScreenProp,
Style,
ViewStyleProp,
} from '../../TypeDefinition';
import type { TabScene } from './TabView';
@ -19,7 +19,7 @@ type Props = {
position: Animated.Value,
navigation: NavigationScreenProp<NavigationState, NavigationAction>,
renderIcon: (scene: TabScene) => React.Element<*>,
style?: Style,
style?: ViewStyleProp,
};
export default class TabBarIcon extends PureComponent<void, Props, void> {

View File

@ -9,7 +9,8 @@ import type {
NavigationAction,
NavigationScreenProp,
NavigationState,
Style,
ViewStyleProp,
TextStyleProp,
} from '../../TypeDefinition';
import type { TabScene } from './TabView';
@ -32,12 +33,15 @@ type Props = {
navigation: NavigationScreenProp<NavigationState, NavigationAction>,
getLabel: (scene: TabScene) => ?(React.Element<*> | string),
renderIcon: (scene: TabScene) => React.Element<*>,
labelStyle?: Style,
iconStyle?: Style,
labelStyle?: TextStyleProp,
iconStyle?: ViewStyleProp,
};
export default class TabBarTop
extends PureComponent<DefaultProps, Props, void> {
export default class TabBarTop extends PureComponent<
DefaultProps,
Props,
void
> {
static defaultProps = {
activeTintColor: '#fff',
inactiveTintColor: '#fff',
@ -71,7 +75,7 @@ export default class TabBarTop
);
const color = position.interpolate({
inputRange,
outputRange,
outputRange: (outputRange: Array<string>),
});
const tintColor = scene.focused ? activeTintColor : inactiveTintColor;

View File

@ -153,9 +153,8 @@ class TabView extends PureComponent<void, Props, void> {
screenProps || {}
);
const tabBarVisible = options.tabBarVisible == null
? true
: options.tabBarVisible;
const tabBarVisible =
options.tabBarVisible == null ? true : options.tabBarVisible;
if (tabBarComponent !== undefined && tabBarVisible) {
if (tabBarPosition === 'bottom') {

View File

@ -16,27 +16,31 @@ import {
TouchableOpacity,
View,
} from 'react-native';
import type { Style } from '../TypeDefinition';
import type { ViewStyleProp } from '../TypeDefinition';
const ANDROID_VERSION_LOLLIPOP = 21;
type Props = {
onPress: Function,
onPress: () => void,
delayPressIn?: number,
borderless?: boolean,
pressColor?: ?string,
pressColor?: string,
activeOpacity?: number,
children?: React.Element<*>,
style?: Style,
style?: ViewStyleProp,
};
type DefaultProps = {
pressColor: ?string,
pressColor: string,
};
export default class TouchableItem
extends Component<DefaultProps, Props, void> {
export default class TouchableItem extends Component<
DefaultProps,
Props,
void
> {
static defaultProps = {
borderless: false,
pressColor: 'rgba(0, 0, 0, .32)',
};
@ -54,14 +58,13 @@ export default class TouchableItem
Platform.Version >= ANDROID_VERSION_LOLLIPOP
) {
const { style, ...rest } = this.props; // eslint-disable-line no-unused-vars
return (
<TouchableNativeFeedback
{...rest}
style={null}
background={TouchableNativeFeedback.Ripple(
this.props.pressColor,
this.props.borderless
this.props.pressColor || '',
this.props.borderless || false
)}
>
<View style={this.props.style}>

View File

@ -2,12 +2,11 @@
import React from 'react';
import { Animated, StyleSheet, View } from 'react-native';
import { Animated, Easing, StyleSheet, View } from 'react-native';
import invariant from '../utils/invariant';
import NavigationScenesReducer from './ScenesReducer';
import TransitionConfigs from './TransitionConfigs';
import type {
NavigationLayout,
@ -25,8 +24,8 @@ type Props = {
prevTransitionProps: ?NavigationTransitionProps
) => NavigationTransitionSpec,
navigation: NavigationScreenProp<NavigationState, NavigationAction>,
onTransitionEnd?: () => void,
onTransitionStart?: () => void,
onTransitionEnd?: (...args: Array<mixed>) => void,
onTransitionStart?: (...args: Array<mixed>) => void,
render: (
transitionProps: NavigationTransitionProps,
prevTransitionProps: ?NavigationTransitionProps
@ -41,7 +40,12 @@ type State = {
scenes: Array<NavigationScene>,
};
const DefaultTransitionSpec = TransitionConfigs.DefaultTransitionSpec;
// Used for all animations unless overriden
const DefaultTransitionSpec = ({
duration: 250,
easing: Easing.inOut(Easing.ease),
timing: Animated.timing,
}: NavigationTransitionSpec);
class Transitioner extends React.Component<*, Props, State> {
_onLayout: (event: any) => void;
@ -157,7 +161,8 @@ class Transitioner extends React.Component<*, Props, State> {
const positionHasChanged = position.__getValue() !== toValue;
// if swiped back, indexHasChanged == true && positionHasChanged == false
const animations = indexHasChanged && positionHasChanged
const animations =
indexHasChanged && positionHasChanged
? [
timing(progress, {
...transitionSpec,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 792 B

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 950 B

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 760 B

View File

@ -17,11 +17,11 @@ type InjectedProps = {
export default function withNavigation<T: *>(
Component: ReactClass<T & InjectedProps>
) {
const componentWithNavigation = (props: T, { navigation }: Context) => (
<Component {...props} navigation={navigation} />
);
const componentWithNavigation = (props: T, { navigation }: Context) =>
<Component {...props} navigation={navigation} />;
componentWithNavigation.displayName = `withNavigation(${Component.displayName || Component.name})`;
componentWithNavigation.displayName = `withNavigation(${Component.displayName ||
Component.name})`;
componentWithNavigation.contextTypes = {
navigation: propTypes.object.isRequired,

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