mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-13 09:30:30 +08:00
Compare commits
19 Commits
@react-nav
...
@react-nav
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da9948bfd8 | ||
|
|
d3f5c55dbf | ||
|
|
f91d16cd5d | ||
|
|
fbadea46f1 | ||
|
|
5614a7cd31 | ||
|
|
d8b88bd83f | ||
|
|
d6d06d07d9 | ||
|
|
65ce20ecbc | ||
|
|
12d90833eb | ||
|
|
edeb2e8ad9 | ||
|
|
133b59cd17 | ||
|
|
a9e584c3b7 | ||
|
|
c46e0a9c14 | ||
|
|
418a858f23 | ||
|
|
b201fd2071 | ||
|
|
c514542305 | ||
|
|
dcc5f99ecd | ||
|
|
adbeb292f5 | ||
|
|
543679f185 |
@@ -49,6 +49,7 @@ jobs:
|
||||
at: ~/project
|
||||
- run: |
|
||||
yarn lerna run prepare
|
||||
node scripts/check-types-path.js
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
|
||||
70
.github/workflows/main.yml
vendored
Normal file
70
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
name: Detox (iOS)
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macOS-latest
|
||||
timeout-minutes: 15
|
||||
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_11.2.app
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Use Node.js 10
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
|
||||
- name: Get Yarn cache
|
||||
id: yarn-cache
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
|
||||
- name: Cache Yarn packages
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ${{ steps.yarn-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: ${{ runner.os }}-yarn-
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
||||
run: yarn --frozen-lockfile
|
||||
|
||||
- name: Cache Pods
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: example/ios/Pods
|
||||
key: pods-${{ hashFiles('**/Podfile.lock') }}
|
||||
|
||||
- name: Update Pods
|
||||
run: |
|
||||
gem update cocoapods xcodeproj
|
||||
cd example/ios
|
||||
pod install
|
||||
|
||||
- name: Configure dependencies
|
||||
run: |
|
||||
brew tap wix/brew
|
||||
brew install applesimutils
|
||||
yarn global add detox-cli
|
||||
|
||||
- name: Cache Detox build
|
||||
uses: actions/cache@v1
|
||||
id: detox-cache
|
||||
with:
|
||||
path: example/ios/build
|
||||
key: detox-build-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/Podfile.lock') }}
|
||||
|
||||
- name: Build Detox
|
||||
if: steps.detox-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd example
|
||||
detox build --configuration ios.sim.release
|
||||
|
||||
- name: Run Detox tests
|
||||
run: |
|
||||
cd example
|
||||
detox test --configuration ios.sim.release --cleanup --debug-synchronization 200
|
||||
513
README.md
513
README.md
@@ -1,496 +1,12 @@
|
||||
# Rethinking Navigation
|
||||
# React Navigation 5
|
||||
|
||||
[![Build Status][build-badge]][build]
|
||||
[![Code Coverage][coverage-badge]][coverage]
|
||||
[![MIT License][license-badge]][license]
|
||||
|
||||
An exploration of a component-first API for React Navigation for building more dynamic navigation solutions.
|
||||
Routing and navigation for your React Native apps with a component-first API.
|
||||
|
||||
## Considerations
|
||||
|
||||
- Should play well with static type system
|
||||
- Navigation state should be contained in root component (helpful for stuff such as deep linking)
|
||||
- Component-first API
|
||||
|
||||
## Building blocks
|
||||
|
||||
### `NavigationContainer`
|
||||
|
||||
Component which wraps the whole app. It stores the state for the whole navigation tree.
|
||||
|
||||
### `useNavigationBuilder`
|
||||
|
||||
Hook which can access the navigation state from the context. Along with the state, it also provides some helpers to modify the navigation state provided by the router. All state changes are notified to the parent `NavigationContainer`.
|
||||
|
||||
### Router
|
||||
|
||||
The router object provides various helper methods to deal with the state and actions, a reducer to update the state as well as some action creators.
|
||||
|
||||
The router is responsible for handling actions dispatched by calling methods on the `navigation` object. If the router cannot handle an action, it can return `null`, which would propagate the action to other routers until it's handled.
|
||||
|
||||
### Navigator
|
||||
|
||||
Navigators bundle a router and a view which takes the navigation state and decides how to render it.
|
||||
|
||||
A simple navigator could look like this:
|
||||
|
||||
```js
|
||||
import { createNavigatorFactory } from '@react-navigation/native';
|
||||
|
||||
function StackNavigator({ initialRouteName, children, ...rest }) {
|
||||
// The `navigation` object contains the navigation state and some helpers (e.g. push, pop)
|
||||
// The `descriptors` object contains the screen options and a helper for rendering a screen
|
||||
const { state, navigation, descriptors } = useNavigationBuilder(StackRouter, {
|
||||
initialRouteName,
|
||||
children,
|
||||
});
|
||||
|
||||
return (
|
||||
// The view determines how to animate any state changes
|
||||
<StackView
|
||||
state={state}
|
||||
navigation={navigation}
|
||||
descriptors={descriptors}
|
||||
{...rest}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default createNavigatorFactory(StackNavigator);
|
||||
```
|
||||
|
||||
The navigator can render a screen by calling `descriptors[route.key].render()`. Internally, the descriptor adds appropriate wrappers to handle nested state.
|
||||
|
||||
## Architectural differences
|
||||
|
||||
### Shape of the navigation state
|
||||
|
||||
The shape of the navigation state looks very similar to the current implementation. There are few important differences:
|
||||
|
||||
- The name of the route is in the `route.name` property instead of `route.routeName`.
|
||||
- The state of the child navigator exists on a separate property `route.state`.
|
||||
- The state object contains a `routeNames` property which contains the list of defined route names in an array of strings,
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
{
|
||||
index: 0,
|
||||
key: 'stack-ytwk65',
|
||||
routeNames: ['home', 'profile', 'settings'],
|
||||
routes: [
|
||||
{
|
||||
key: 'home-hjds3b',
|
||||
name: 'home',
|
||||
state: {
|
||||
index: 1,
|
||||
key: 'tab-jhsf6g',
|
||||
routeNames: ['feed', 'recommended'],
|
||||
routes: [
|
||||
{
|
||||
key: 'feed-jv2iud',
|
||||
name: 'feed',
|
||||
},
|
||||
{
|
||||
key: 'recommended-njdh63',
|
||||
name: 'recommended',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
```
|
||||
|
||||
### Deriving initial state
|
||||
|
||||
In the current implementation of React Navigation, the initial state is extracted from the navigator definitions. This is possible because they are defined statically. In our case, it's not possible because the screens are rendered dynamically.
|
||||
|
||||
Turns out we don't really need the initial state in the `NavigationContainer`. This state is the default state, so we can store `undefined` instead, and let the navigators initialize their initial state themselves. Next time an action modifies the state, we update the value in the container.
|
||||
|
||||
If an initial state is specified, e.g. as a result of `Linking.getInitialURL()`, the child navigators will use that state, instead of having to initialize it themselves.
|
||||
|
||||
### Passing state to child navigator
|
||||
|
||||
Navigation state is exposed to children navigators via React context instead of having to pass it down manually. This lets the user nest navigators freely without having to worry about properly passing the state down.
|
||||
|
||||
### Accessing state of other navigators
|
||||
|
||||
Navigators should not access the state of other navigators. It might be tempting to access the state of a child route to perform some checks, but it's not going to work correctly, as the state object may not exist yet.
|
||||
|
||||
Instead of direct state access, navigators should communicate via events. Each navigator should access and modify its own state only.
|
||||
|
||||
### Bubbling of actions
|
||||
|
||||
In the current implementation of React Navigation, routers manually call the child routers to apply any actions. Since we have a component based architecture, this is not really possible.
|
||||
|
||||
Instead, we use an event based system. Child navigators can add listeners to handle actions. If the parent couldn't handle the action, it'll call the listeners. The event system is built into the core and the routers don't need to worry about it.
|
||||
|
||||
When an action can be bubble, the `getStateForAction` method from a router should return `null`, otherwise it should return the state object.
|
||||
|
||||
It's also possible to disable bubbling of actions when dispatching them by adding a `target` key in the action. The `target` key should refer to the key of the navigator that should handle the action.
|
||||
|
||||
## Basic usage
|
||||
|
||||
```js
|
||||
import { createStackNavigator } from '@react-navigation/stack';
|
||||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
||||
|
||||
const Stack = createStackNavigator();
|
||||
const Tab = createBottomTabNavigator();
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<NavigationContainer>
|
||||
<Stack.Navigator initialRouteName="home">
|
||||
<Stack.Screen name="settings" component={Settings} />
|
||||
<Stack.Screen
|
||||
name="profile"
|
||||
component={Profile}
|
||||
options={{ title: 'John Doe' }}
|
||||
/>
|
||||
<Stack.Screen name="home">
|
||||
{() => (
|
||||
<Tab.Navigator initialRouteName="feed">
|
||||
<Tab.Screen name="feed" component={Feed} />
|
||||
<Tab.Screen name="article" component={Article} />
|
||||
<Tab.Screen name="notifications">
|
||||
{props => <Notifications {...props} />}
|
||||
</Tab.Screen>
|
||||
</Tab.Navigator>
|
||||
)}
|
||||
</Stack.Screen>
|
||||
</Stack.Navigator>
|
||||
</NavigationContainer>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
Navigators need to have `Screen` components as their direct children. These components don't do anything by themselves, but the navigator can extract information from these and determine what to render. Implementation-wise, we use `React.Children` API for this purpose.
|
||||
|
||||
The content to render can be specified in 2 ways:
|
||||
|
||||
1. React component in `component` prop (recommended)
|
||||
2. Render callback as children
|
||||
|
||||
When a React component is specified, the navigator takes care of adding a `React.memo` to prevent unnecessary re-renders. However, it's not possible to pass extra props to the component this way. It's preferable to use the context API for such cases instead of props.
|
||||
|
||||
A render callback which doesn't have such limitation and is easier to use for this purpose. However, performance optimization for the component is left to the user in such case.
|
||||
|
||||
The rendered component will receives a `navigation` prop with various helpers and a `route` prop which represents the route being rendered.
|
||||
|
||||
## Setting screen options
|
||||
|
||||
In React Navigation, screen options can be specified in a static property on the component (`navigationOptions`). This poses few issues:
|
||||
|
||||
- It's not possible to configure options based on props, state or context
|
||||
- To update the props based on an action in the component (such as button press), we need to do it in a hacky way by changing params
|
||||
- It breaks when used with HOCs which don't hoist static props, which is a common source of confusion
|
||||
|
||||
Instead of a static property, we expose a method to configure screen options:
|
||||
|
||||
```js
|
||||
function Selection({ navigation }) {
|
||||
const [selectedIds, setSelectedIds] = React.useState([]);
|
||||
|
||||
navigation.setOptions({
|
||||
title: `${selectedIds.length} items selected`,
|
||||
});
|
||||
|
||||
return <SelectionList onSelect={id => setSelectedIds(ids => [...ids, id])} />;
|
||||
}
|
||||
```
|
||||
|
||||
This allows options to be changed based on props, state or context, and doesn't have the disadvantages of static configuration.
|
||||
|
||||
## Navigation events
|
||||
|
||||
Screens can add listeners on the `navigation` prop like in React Navigation. By default, `focus` and `blur` events are fired when focused screen changes:
|
||||
|
||||
```js
|
||||
function Profile({ navigation }) {
|
||||
React.useEffect(() =>
|
||||
navigation.addListener('focus', () => {
|
||||
// do something
|
||||
})
|
||||
);
|
||||
|
||||
return <ProfileContent />;
|
||||
}
|
||||
```
|
||||
|
||||
The `navigation.addListener` method returns a function to remove the listener which can be returned as the cleanup function in an effect.
|
||||
|
||||
Navigators can also emit custom events using the `emit` method in the `navigation` object passed:
|
||||
|
||||
```js
|
||||
navigation.emit({
|
||||
type: 'transitionStart',
|
||||
data: { blurring: false },
|
||||
target: route.key,
|
||||
});
|
||||
```
|
||||
|
||||
The `data` is available under the `data` property in the `event` object, i.e. `event.data`.
|
||||
|
||||
The `target` property determines the screen that will receive the event. If the `target` property is omitted, the event is dispatched to all screens in the navigator.
|
||||
|
||||
Screens cannot emit events as there is no `emit` method on a screen's `navigation` prop.
|
||||
|
||||
If you don't need to get notified of focus change, but just need to check if the screen is currently focused in a callback, you can use the `navigation.isFocused()` method which returns a boolean. Note that it's not safe to use this in `render`. Only use it in callbacks, event listeners etc.
|
||||
|
||||
## Additional utilities
|
||||
|
||||
### Access navigation anywhere
|
||||
|
||||
Passing the `navigation` prop down can be tedious. The library exports a `useNavigation` hook which can access the `navigation` prop from the parent screen:
|
||||
|
||||
```js
|
||||
const navigation = useNavigation();
|
||||
```
|
||||
|
||||
### Side-effects in focused screen
|
||||
|
||||
Sometimes we want to run side-effects when a screen is focused. A side effect may involve things like adding an event listener, fetching data, updating document title, etc. While this can be achieved using `focus` and `blur` events, it's not very ergonomic.
|
||||
|
||||
To make this easier, the library exports a `useFocusEffect` hook:
|
||||
|
||||
```js
|
||||
import { useFocusEffect } from '@react-navigation/native';
|
||||
|
||||
function Profile({ userId }) {
|
||||
const [user, setUser] = React.useState(null);
|
||||
|
||||
const fetchUser = React.useCallback(() => {
|
||||
const request = API.fetchUser(userId).then(
|
||||
data => setUser(data),
|
||||
error => alert(error.message)
|
||||
);
|
||||
|
||||
return () => request.abort();
|
||||
}, [userId]);
|
||||
|
||||
useFocusEffect(fetchUser);
|
||||
|
||||
return <ProfileContent user={user} />;
|
||||
}
|
||||
```
|
||||
|
||||
The `useFocusEffect` is analogous to React's `useEffect` hook. The only difference is that it runs on focus instead of render.
|
||||
|
||||
**NOTE:** To avoid the running the effect too often, it's important to wrap the callback in `useCallback` before passing it to `useFocusEffect` as shown in the example.
|
||||
|
||||
### Render based on focus state
|
||||
|
||||
We might want to render different content based on the current focus state of the screen. The library exports a `useIsFocused` hook to make this easier:
|
||||
|
||||
```js
|
||||
import { useIsFocused } from '@react-navigation/native';
|
||||
|
||||
// ...
|
||||
|
||||
const isFocused = useIsFocused();
|
||||
```
|
||||
|
||||
## React Native
|
||||
|
||||
For proper UX in React Native, we need to respect platform behavior such as the device back button on Android, deep linking etc. The library exports few hooks to make it easier.
|
||||
|
||||
### Back button integration
|
||||
|
||||
When the back button on the device is pressed, we also want to navigate back in the focused navigator. The library exports a `useBackButton` hook to handle this:
|
||||
|
||||
```js
|
||||
import { useBackButton } from '@react-navigation/native';
|
||||
|
||||
// ...
|
||||
|
||||
const ref = React.useRef();
|
||||
|
||||
useBackButton(ref);
|
||||
|
||||
return <NavigationContainer ref={ref}>{/* content */}</NavigationContainer>;
|
||||
```
|
||||
|
||||
### Scroll to top on tab button press
|
||||
|
||||
When there's a scroll view in a tab and the user taps on the already focused tab bar again, we might want to scroll to top in our scroll view. The library exports a `useScrollToTop` hook to handle this:
|
||||
|
||||
```js
|
||||
import { useScrollToTop } from '@react-navigation/native';
|
||||
|
||||
// ...
|
||||
|
||||
const ref = React.useRef();
|
||||
|
||||
useScrollToTop(ref);
|
||||
|
||||
return <ScrollView ref={ref}>{/* content */}</ScrollView>;
|
||||
```
|
||||
|
||||
The hook can accept a ref object to any view that has a `scrollTo` method.
|
||||
|
||||
### Deep-link integration
|
||||
|
||||
To handle incoming links, we need to handle 2 scenarios:
|
||||
|
||||
1. If the app wasn't previously open, we need to set the initial state based on the link
|
||||
2. If the app was already open, we need to update the state to reflect the incoming link
|
||||
|
||||
The current implementation of React Navigation has an advantage in handling deep links and is able to automatically set the state based on the path definitions for each screen. It's possible because it can get the configuration for all screens statically.
|
||||
|
||||
With our dynamic architecture, we can't determine the state automatically. So it's necessary to manually translate a deep link to a navigation state. The library exports a `getStateFromPath` utility to convert a URL to a state object if the path segments translate directly to route names.
|
||||
|
||||
For example, the path `/rooms/chat?user=jane` will be translated to a state object like this:
|
||||
|
||||
```js
|
||||
{
|
||||
routes: [
|
||||
{
|
||||
name: 'rooms',
|
||||
state: {
|
||||
routes: [
|
||||
{
|
||||
name: 'chat',
|
||||
params: { user: 'jane' },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
```
|
||||
|
||||
The `useLinking` hooks makes it easier to handle incoming links:
|
||||
|
||||
```js
|
||||
import { useLinking } from '@react-navigation/native';
|
||||
|
||||
// ...
|
||||
|
||||
const ref = React.useRef();
|
||||
|
||||
const { getInitialState } = useLinking(ref, {
|
||||
prefixes: ['https://myapp.com', 'myapp://'],
|
||||
});
|
||||
|
||||
const [isReady, setIsReady] = React.useState(false);
|
||||
const [initialState, setInitialState] = React.useState();
|
||||
|
||||
React.useEffect(() => {
|
||||
getInitialState()
|
||||
.catch(() => {})
|
||||
.then(state => {
|
||||
if (state !== undefined) {
|
||||
setInitialState(state);
|
||||
}
|
||||
|
||||
setIsReady(true);
|
||||
});
|
||||
}, [getInitialState]);
|
||||
|
||||
if (!isReady) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<NavigationContainer initialState={initialState} ref={ref}>
|
||||
{/* content */}
|
||||
</NavigationContainer>
|
||||
);
|
||||
```
|
||||
|
||||
The hook also accepts a `getStateFromPath` option where you can provide a custom function to convert the URL to a valid state object for more advanced use cases.
|
||||
|
||||
## Type-checking
|
||||
|
||||
The library is written with TypeScript and provides type definitions for TypeScript projects.
|
||||
|
||||
When building custom navigators, each navigator also need to export a custom type for the `navigation` prop which should contain the actions they provide, .e.g. `push` for stack, `jumpTo` for tab etc. and pass correct type parameters to the helper functions to ensure that it works well with type-checking.
|
||||
|
||||
Currently type checking and intelliSense works for route name and params. The user has to define a type alias with a list of routes along with the type of params they use.
|
||||
|
||||
For our example above, we need 2 separate types for stack and tabs:
|
||||
|
||||
```ts
|
||||
type StackParamList = {
|
||||
settings: undefined;
|
||||
profile: { userId: string };
|
||||
home: undefined;
|
||||
};
|
||||
|
||||
type TabParamList = {
|
||||
feed: undefined;
|
||||
article: undefined;
|
||||
notifications: undefined;
|
||||
};
|
||||
```
|
||||
|
||||
In a component, it's possible to annotate the `navigation` and `route` props using these types:
|
||||
|
||||
```ts
|
||||
type Props = {
|
||||
navigation: StackNavigationProp<StackParamList, 'profile'>;
|
||||
route: RouteProp<StackParamList, 'profile'>;
|
||||
};
|
||||
|
||||
function Profile(props: Props) {
|
||||
// Content
|
||||
}
|
||||
```
|
||||
|
||||
Annotating the `navigation` prop will be enough for provide type-checking for actions such as `navigate` etc. Annotating `route` will provide type-checking for accessing `params` for the current route.
|
||||
|
||||
For nested navigators, the `navigation` prop is a combination of multiple `navigation` props, so we need to combine multiple types to type them. We export a type called `CompositeNavigationProp` to make it easier:
|
||||
|
||||
```ts
|
||||
type FeedScreenNavigationProp = CompositeNavigationProp<
|
||||
TabNavigationProp<TabParamList, 'feed'>,
|
||||
StackNavigationProp<StackParamList>
|
||||
>;
|
||||
```
|
||||
|
||||
The `CompositeNavigationProp` type takes 2 parameters, first parameter is the primary navigation type (type for the navigator that owns this screen) and second parameter is the secondary navigation type (type for a parent navigator). The primary navigation type should always have the screen's route name as it's second parameter.
|
||||
|
||||
For multiple parent navigators, this secondary type should be nested:
|
||||
|
||||
```ts
|
||||
type FeedScreenNavigationProp = CompositeNavigationProp<
|
||||
TabNavigationProp<TabParamList, 'feed'>,
|
||||
CompositeNavigationProp<
|
||||
StackNavigationProp<StackParamList>,
|
||||
DrawerNavigationProp<DrawerParamList>
|
||||
>
|
||||
>;
|
||||
```
|
||||
|
||||
To annotate the `navigation` prop from `useNavigation`, we can use a type parameter:
|
||||
|
||||
```ts
|
||||
const navigation = useNavigation<FeedScreenNavigationProp>();
|
||||
```
|
||||
|
||||
It's also possible to type-check the navigator to some extent. To do this, we need to pass a generic when creating the navigator object:
|
||||
|
||||
```ts
|
||||
const Stack = createStackNavigator<StackParamList>();
|
||||
```
|
||||
|
||||
And then we can use it:
|
||||
|
||||
```js
|
||||
<Stack.Navigator initialRouteName="profile">
|
||||
<Stack.Screen name="settings" component={Settings} />
|
||||
<Stack.Screen
|
||||
name="profile"
|
||||
component={Profile}
|
||||
options={{ title: 'My profile' }}
|
||||
/>
|
||||
<Stack.Screen name="home" component={Home} />
|
||||
</Stack.Navigator>
|
||||
```
|
||||
|
||||
Unfortunately it's not possible to verify that the type of children elements are correct since [TypeScript doesn't support type-checking JSX elements](https://github.com/microsoft/TypeScript/issues/21699).
|
||||
Documentation can be found at [next.reactnavigation.org](https://next.reactnavigation.org/).
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -519,12 +35,33 @@ To fix formatting errors, run the following:
|
||||
yarn lint --fix
|
||||
```
|
||||
|
||||
Remember to add tests for your change if possible. Run the tests by:
|
||||
Remember to add tests for your change if possible. Run the unit tests by:
|
||||
|
||||
```sh
|
||||
yarn test
|
||||
```
|
||||
|
||||
Running Detox (on iOS) requires the following:
|
||||
|
||||
- Mac with macOS (at least macOS High Sierra 10.13.6)
|
||||
- Xcode 10.1+ with Xcode command line tools
|
||||
|
||||
To run the integration tests, first you need to install `applesimutils` and `detox-cli`:
|
||||
|
||||
```sh
|
||||
brew tap wix/brew
|
||||
brew install applesimutils
|
||||
yarn global add detox-cli
|
||||
```
|
||||
|
||||
Then you can build and run the tests:
|
||||
|
||||
```sh
|
||||
cd example
|
||||
detox build -c ios.sim.debug
|
||||
detox test -c ios.sim.debug
|
||||
```
|
||||
|
||||
## Publishing
|
||||
|
||||
To publish a new version, first we need to export a `GH_TOKEN` environment variable as mentioned [here](https://github.com/lerna/lerna/tree/master/commands/version#--create-release-type). Then run:
|
||||
|
||||
9
example/e2e/__integration_tests__/index.test.js
Normal file
9
example/e2e/__integration_tests__/index.test.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import { by, element, expect, device } from 'detox';
|
||||
|
||||
beforeEach(async () => {
|
||||
await device.reloadReactNative();
|
||||
});
|
||||
|
||||
it('has dark theme toggle', async () => {
|
||||
await expect(element(by.text('Dark theme'))).toBeVisible();
|
||||
});
|
||||
6
example/e2e/config.json
Normal file
6
example/e2e/config.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"setupFilesAfterEnv": ["./init.js"],
|
||||
"testEnvironment": "node",
|
||||
"reporters": ["detox/runners/jest/streamlineReporter"],
|
||||
"verbose": true
|
||||
}
|
||||
29
example/e2e/init.js
Normal file
29
example/e2e/init.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable import/no-commonjs, jest/no-jasmine-globals */
|
||||
/* eslint-env jest, jasmine */
|
||||
|
||||
const detox = require('detox');
|
||||
const config = require('../package.json').detox;
|
||||
const adapter = require('detox/runners/jest/adapter');
|
||||
const specReporter = require('detox/runners/jest/specReporter');
|
||||
|
||||
// Set the default timeout
|
||||
jest.setTimeout(120000);
|
||||
|
||||
jasmine.getEnv().addReporter(adapter);
|
||||
|
||||
// This takes care of generating status logs on a per-spec basis. By default, jest only reports at file-level.
|
||||
// This is strictly optional.
|
||||
jasmine.getEnv().addReporter(specReporter);
|
||||
|
||||
beforeAll(async () => {
|
||||
await detox.init(config);
|
||||
}, 300000);
|
||||
|
||||
beforeEach(async () => {
|
||||
await adapter.beforeEach();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await adapter.afterAll();
|
||||
await detox.cleanup();
|
||||
});
|
||||
@@ -253,7 +253,7 @@ PODS:
|
||||
- React
|
||||
- RNReanimated (1.4.0):
|
||||
- React
|
||||
- RNScreens (2.0.0-alpha.17):
|
||||
- RNScreens (2.0.0-alpha.19):
|
||||
- React
|
||||
- UMBarCodeScannerInterface (5.0.0)
|
||||
- UMCameraInterface (5.0.0)
|
||||
@@ -274,15 +274,15 @@ PODS:
|
||||
|
||||
DEPENDENCIES:
|
||||
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
|
||||
- EXAppLoaderProvider (from `../node_modules/expo/node_modules/expo-app-loader-provider/ios`)
|
||||
- EXConstants (from `../node_modules/expo/node_modules/expo-constants/ios`)
|
||||
- EXAppLoaderProvider (from `../node_modules/expo-app-loader-provider/ios`)
|
||||
- EXConstants (from `../node_modules/expo-constants/ios`)
|
||||
- EXErrorRecovery (from `../node_modules/expo-error-recovery/ios`)
|
||||
- EXFileSystem (from `../node_modules/expo/node_modules/expo-file-system/ios`)
|
||||
- EXFileSystem (from `../node_modules/expo-file-system/ios`)
|
||||
- EXFont (from `../node_modules/expo-font/ios`)
|
||||
- EXKeepAwake (from `../node_modules/expo-keep-awake/ios`)
|
||||
- EXLinearGradient (from `../node_modules/expo-linear-gradient/ios`)
|
||||
- EXLocation (from `../node_modules/expo-location/ios`)
|
||||
- EXPermissions (from `../node_modules/expo/node_modules/expo-permissions/ios`)
|
||||
- EXPermissions (from `../node_modules/expo-permissions/ios`)
|
||||
- EXSQLite (from `../node_modules/expo-sqlite/ios`)
|
||||
- EXWebBrowser (from `../node_modules/expo-web-browser/ios`)
|
||||
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
|
||||
@@ -316,18 +316,18 @@ DEPENDENCIES:
|
||||
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
|
||||
- RNReanimated (from `../node_modules/react-native-reanimated`)
|
||||
- RNScreens (from `../node_modules/react-native-screens`)
|
||||
- UMBarCodeScannerInterface (from `../node_modules/expo/node_modules/unimodules-barcode-scanner-interface/ios`)
|
||||
- UMCameraInterface (from `../node_modules/expo/node_modules/unimodules-camera-interface/ios`)
|
||||
- UMConstantsInterface (from `../node_modules/expo/node_modules/unimodules-constants-interface/ios`)
|
||||
- "UMCore (from `../node_modules/expo/node_modules/@unimodules/core/ios`)"
|
||||
- UMFaceDetectorInterface (from `../node_modules/expo/node_modules/unimodules-face-detector-interface/ios`)
|
||||
- UMFileSystemInterface (from `../node_modules/expo/node_modules/unimodules-file-system-interface/ios`)
|
||||
- UMFontInterface (from `../node_modules/expo/node_modules/unimodules-font-interface/ios`)
|
||||
- UMImageLoaderInterface (from `../node_modules/expo/node_modules/unimodules-image-loader-interface/ios`)
|
||||
- UMPermissionsInterface (from `../node_modules/expo/node_modules/unimodules-permissions-interface/ios`)
|
||||
- "UMReactNativeAdapter (from `../node_modules/expo/node_modules/@unimodules/react-native-adapter/ios`)"
|
||||
- UMSensorsInterface (from `../node_modules/expo/node_modules/unimodules-sensors-interface/ios`)
|
||||
- UMTaskManagerInterface (from `../node_modules/expo/node_modules/unimodules-task-manager-interface/ios`)
|
||||
- UMBarCodeScannerInterface (from `../node_modules/unimodules-barcode-scanner-interface/ios`)
|
||||
- UMCameraInterface (from `../node_modules/unimodules-camera-interface/ios`)
|
||||
- UMConstantsInterface (from `../node_modules/unimodules-constants-interface/ios`)
|
||||
- "UMCore (from `../node_modules/@unimodules/core/ios`)"
|
||||
- UMFaceDetectorInterface (from `../node_modules/unimodules-face-detector-interface/ios`)
|
||||
- UMFileSystemInterface (from `../node_modules/unimodules-file-system-interface/ios`)
|
||||
- UMFontInterface (from `../node_modules/unimodules-font-interface/ios`)
|
||||
- UMImageLoaderInterface (from `../node_modules/unimodules-image-loader-interface/ios`)
|
||||
- UMPermissionsInterface (from `../node_modules/unimodules-permissions-interface/ios`)
|
||||
- "UMReactNativeAdapter (from `../node_modules/@unimodules/react-native-adapter/ios`)"
|
||||
- UMSensorsInterface (from `../node_modules/unimodules-sensors-interface/ios`)
|
||||
- UMTaskManagerInterface (from `../node_modules/unimodules-task-manager-interface/ios`)
|
||||
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
|
||||
|
||||
SPEC REPOS:
|
||||
@@ -339,16 +339,16 @@ EXTERNAL SOURCES:
|
||||
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
|
||||
EXAppLoaderProvider:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/expo-app-loader-provider/ios"
|
||||
path: "../node_modules/expo-app-loader-provider/ios"
|
||||
EXConstants:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/expo-constants/ios"
|
||||
path: "../node_modules/expo-constants/ios"
|
||||
EXErrorRecovery:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo-error-recovery/ios"
|
||||
EXFileSystem:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/expo-file-system/ios"
|
||||
path: "../node_modules/expo-file-system/ios"
|
||||
EXFont:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo-font/ios"
|
||||
@@ -363,7 +363,7 @@ EXTERNAL SOURCES:
|
||||
path: "../node_modules/expo-location/ios"
|
||||
EXPermissions:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/expo-permissions/ios"
|
||||
path: "../node_modules/expo-permissions/ios"
|
||||
EXSQLite:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo-sqlite/ios"
|
||||
@@ -428,40 +428,40 @@ EXTERNAL SOURCES:
|
||||
:path: "../node_modules/react-native-screens"
|
||||
UMBarCodeScannerInterface:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/unimodules-barcode-scanner-interface/ios"
|
||||
path: "../node_modules/unimodules-barcode-scanner-interface/ios"
|
||||
UMCameraInterface:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/unimodules-camera-interface/ios"
|
||||
path: "../node_modules/unimodules-camera-interface/ios"
|
||||
UMConstantsInterface:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/unimodules-constants-interface/ios"
|
||||
path: "../node_modules/unimodules-constants-interface/ios"
|
||||
UMCore:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/@unimodules/core/ios"
|
||||
path: "../node_modules/@unimodules/core/ios"
|
||||
UMFaceDetectorInterface:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/unimodules-face-detector-interface/ios"
|
||||
path: "../node_modules/unimodules-face-detector-interface/ios"
|
||||
UMFileSystemInterface:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/unimodules-file-system-interface/ios"
|
||||
path: "../node_modules/unimodules-file-system-interface/ios"
|
||||
UMFontInterface:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/unimodules-font-interface/ios"
|
||||
path: "../node_modules/unimodules-font-interface/ios"
|
||||
UMImageLoaderInterface:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/unimodules-image-loader-interface/ios"
|
||||
path: "../node_modules/unimodules-image-loader-interface/ios"
|
||||
UMPermissionsInterface:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/unimodules-permissions-interface/ios"
|
||||
path: "../node_modules/unimodules-permissions-interface/ios"
|
||||
UMReactNativeAdapter:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/@unimodules/react-native-adapter/ios"
|
||||
path: "../node_modules/@unimodules/react-native-adapter/ios"
|
||||
UMSensorsInterface:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/unimodules-sensors-interface/ios"
|
||||
path: "../node_modules/unimodules-sensors-interface/ios"
|
||||
UMTaskManagerInterface:
|
||||
:path: !ruby/object:Pathname
|
||||
path: "../node_modules/expo/node_modules/unimodules-task-manager-interface/ios"
|
||||
path: "../node_modules/unimodules-task-manager-interface/ios"
|
||||
Yoga:
|
||||
:path: "../node_modules/react-native/ReactCommon/yoga"
|
||||
|
||||
@@ -506,7 +506,7 @@ SPEC CHECKSUMS:
|
||||
RNCMaskedView: dd13f9f7b146a9ad82f9b7eb6c9b5548fcf6e990
|
||||
RNGestureHandler: 946a7691e41df61e2c4b1884deab41a4cdc3afff
|
||||
RNReanimated: b2ab0b693dddd2339bd2f300e770f6302d2e960c
|
||||
RNScreens: f5e2ff7ccde2a1bfcf2a48c6fd07fdcf1fd95223
|
||||
RNScreens: 62284de159bbddba268edd282337afdb8771aaed
|
||||
UMBarCodeScannerInterface: 3802c8574ef119c150701d679ab386e2266d6a54
|
||||
UMCameraInterface: 985d301f688ed392f815728f0dd906ca34b7ccb1
|
||||
UMConstantsInterface: bda5f8bd3403ad99e663eb3c4da685d063c5653c
|
||||
|
||||
@@ -46,7 +46,30 @@
|
||||
"@types/react": "^16.9.16",
|
||||
"@types/react-native": "^0.60.25",
|
||||
"babel-preset-expo": "^8.0.0",
|
||||
"detox": "^15.0.0",
|
||||
"expo-cli": "^3.11.1",
|
||||
"jest": "^24.9.0",
|
||||
"typescript": "^3.7.3"
|
||||
},
|
||||
"detox": {
|
||||
"test-runner": "jest",
|
||||
"configurations": {
|
||||
"ios.sim.debug": {
|
||||
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/ReactNavigationExample.app",
|
||||
"build": "set -o pipefail; xcodebuild -workspace ios/ReactNavigationExample.xcworkspace -scheme ReactNavigationExample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
|
||||
"type": "ios.simulator",
|
||||
"device": {
|
||||
"type": "iPhone 11 Pro"
|
||||
}
|
||||
},
|
||||
"ios.sim.release": {
|
||||
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/ReactNavigationExample.app",
|
||||
"build": "export RCT_NO_LAUNCH_PACKAGER=true; set -o pipefail; xcodebuild -workspace ios/ReactNavigationExample.xcworkspace -scheme ReactNavigationExample -configuration Release -sdk iphonesimulator -derivedDataPath ios/build",
|
||||
"type": "ios.simulator",
|
||||
"device": {
|
||||
"type": "iPhone 11 Pro"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { View, StyleSheet } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
import { useSafeArea } from 'react-native-safe-area-context';
|
||||
import { RouteProp, ParamListBase } from '@react-navigation/native';
|
||||
import {
|
||||
createStackNavigator,
|
||||
@@ -25,11 +24,9 @@ const ArticleScreen = ({
|
||||
navigation: ModalStackNavigation;
|
||||
route: RouteProp<ModalStackParams, 'Article'>;
|
||||
}) => {
|
||||
const insets = useSafeArea();
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<View style={[styles.buttons, { marginTop: insets.top }]}>
|
||||
<View style={styles.buttons}>
|
||||
<Button
|
||||
mode="contained"
|
||||
onPress={() => navigation.push('Album')}
|
||||
@@ -51,11 +48,9 @@ const ArticleScreen = ({
|
||||
};
|
||||
|
||||
const AlbumsScreen = ({ navigation }: { navigation: ModalStackNavigation }) => {
|
||||
const insets = useSafeArea();
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<View style={[styles.buttons, { marginTop: insets.top }]}>
|
||||
<View style={styles.buttons}>
|
||||
<Button
|
||||
mode="contained"
|
||||
onPress={() => navigation.push('Article', { author: 'Babel fish' })}
|
||||
@@ -91,12 +86,16 @@ export default function SimpleStackScreen({ navigation, options }: Props) {
|
||||
return (
|
||||
<ModalPresentationStack.Navigator
|
||||
mode="modal"
|
||||
headerMode="none"
|
||||
screenOptions={{
|
||||
headerMode="screen"
|
||||
screenOptions={({ route, navigation }) => ({
|
||||
...TransitionPresets.ModalPresentationIOS,
|
||||
cardOverlayEnabled: true,
|
||||
gestureEnabled: true,
|
||||
}}
|
||||
headerStatusBarHeight:
|
||||
navigation.dangerouslyGetState().routes.indexOf(route) > 0
|
||||
? 0
|
||||
: undefined,
|
||||
})}
|
||||
{...options}
|
||||
>
|
||||
<ModalPresentationStack.Screen
|
||||
|
||||
@@ -4,6 +4,9 @@ const createExpoWebpackConfigAsync = require('@expo/webpack-config');
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
||||
|
||||
const node_modules = path.resolve(__dirname, 'node_modules');
|
||||
const packages = path.resolve(__dirname, '..', 'packages');
|
||||
|
||||
module.exports = async function(env, argv) {
|
||||
const config = await createExpoWebpackConfigAsync(env, argv);
|
||||
|
||||
@@ -19,28 +22,15 @@ module.exports = async function(env, argv) {
|
||||
);
|
||||
|
||||
Object.assign(config.resolve.alias, {
|
||||
react: path.resolve(__dirname, 'node_modules', 'react'),
|
||||
'react-native': path.resolve(__dirname, 'node_modules', 'react-native-web'),
|
||||
'react-native-web': path.resolve(
|
||||
__dirname,
|
||||
'node_modules',
|
||||
'react-native-web'
|
||||
),
|
||||
'react-native-reanimated': path.resolve(
|
||||
__dirname,
|
||||
'node_modules',
|
||||
'react-native-reanimated-web'
|
||||
),
|
||||
'@expo/vector-icons/MaterialCommunityIcons': require.resolve(
|
||||
'@expo/vector-icons/MaterialCommunityIcons'
|
||||
),
|
||||
react: path.resolve(node_modules, 'react'),
|
||||
'react-native': path.resolve(node_modules, 'react-native-web'),
|
||||
'react-native-web': path.resolve(node_modules, 'react-native-web'),
|
||||
'@expo/vector-icons': path.resolve(node_modules, '@expo/vector-icons'),
|
||||
});
|
||||
|
||||
fs.readdirSync(path.join(__dirname, '..')).forEach(name => {
|
||||
fs.readdirSync(packages).forEach(name => {
|
||||
config.resolve.alias[`@react-navigation/${name}`] = path.resolve(
|
||||
__dirname,
|
||||
'..',
|
||||
'packages',
|
||||
packages,
|
||||
name,
|
||||
'src'
|
||||
);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-config-satya164": "^3.1.5",
|
||||
"husky": "^3.0.9",
|
||||
"jest": "^24.8.0",
|
||||
"jest": "^24.9.0",
|
||||
"lerna": "^3.18.4",
|
||||
"prettier": "^1.19.1",
|
||||
"typescript": "^3.7.3"
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [5.0.0-alpha.32](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/bottom-tabs@5.0.0-alpha.31...@react-navigation/bottom-tabs@5.0.0-alpha.32) (2020-01-05)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.31](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/bottom-tabs@5.0.0-alpha.30...@react-navigation/bottom-tabs@5.0.0-alpha.31) (2020-01-03)
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"android",
|
||||
"tab"
|
||||
],
|
||||
"version": "5.0.0-alpha.31",
|
||||
"version": "5.0.0-alpha.32",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -33,7 +33,7 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/routers": "^5.0.0-alpha.19",
|
||||
"@react-navigation/routers": "^5.0.0-alpha.20",
|
||||
"color": "^3.1.2",
|
||||
"react-native-iphone-x-helper": "^1.2.1"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [5.0.0-alpha.21](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/compat@5.0.0-alpha.20...@react-navigation/compat@5.0.0-alpha.21) (2020-01-05)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/compat
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.20](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/compat@5.0.0-alpha.19...@react-navigation/compat@5.0.0-alpha.20) (2020-01-01)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/compat
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/compat",
|
||||
"description": "Compatibility layer to write navigator definitions in static configuration format",
|
||||
"version": "5.0.0-alpha.20",
|
||||
"version": "5.0.0-alpha.21",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -24,7 +24,7 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/routers": "^5.0.0-alpha.19"
|
||||
"@react-navigation/routers": "^5.0.0-alpha.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^16.9.16",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [5.0.0-alpha.34](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/drawer@5.0.0-alpha.33...@react-navigation/drawer@5.0.0-alpha.34) (2020-01-05)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/drawer
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.33](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/drawer@5.0.0-alpha.32...@react-navigation/drawer@5.0.0-alpha.33) (2020-01-03)
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"material",
|
||||
"drawer"
|
||||
],
|
||||
"version": "5.0.0-alpha.33",
|
||||
"version": "5.0.0-alpha.34",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -34,7 +34,7 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/routers": "^5.0.0-alpha.19",
|
||||
"@react-navigation/routers": "^5.0.0-alpha.20",
|
||||
"color": "^3.1.2",
|
||||
"react-native-iphone-x-helper": "^1.2.1"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [5.0.0-alpha.29](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/material-bottom-tabs@5.0.0-alpha.28...@react-navigation/material-bottom-tabs@5.0.0-alpha.29) (2020-01-05)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.28](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/material-bottom-tabs@5.0.0-alpha.27...@react-navigation/material-bottom-tabs@5.0.0-alpha.28) (2020-01-01)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"material",
|
||||
"tab"
|
||||
],
|
||||
"version": "5.0.0-alpha.28",
|
||||
"version": "5.0.0-alpha.29",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -34,7 +34,7 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/routers": "^5.0.0-alpha.19"
|
||||
"@react-navigation/routers": "^5.0.0-alpha.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-native-community/bob": "^0.7.0",
|
||||
|
||||
@@ -3,6 +3,17 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [5.0.0-alpha.27](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/material-top-tabs@5.0.0-alpha.26...@react-navigation/material-top-tabs@5.0.0-alpha.27) (2020-01-05)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for pager component ([dcc5f99](https://github.com/react-navigation/navigation-ex/commit/dcc5f99ecd495ad1903c9e99884e0d4e9b3994f1))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.26](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/material-top-tabs@5.0.0-alpha.25...@react-navigation/material-top-tabs@5.0.0-alpha.26) (2020-01-01)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"material",
|
||||
"tab"
|
||||
],
|
||||
"version": "5.0.0-alpha.26",
|
||||
"version": "5.0.0-alpha.27",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -34,7 +34,7 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/routers": "^5.0.0-alpha.19",
|
||||
"@react-navigation/routers": "^5.0.0-alpha.20",
|
||||
"color": "^3.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -113,9 +113,15 @@ export type MaterialTopTabNavigationConfig = Partial<
|
||||
| 'onSwipeEnd'
|
||||
| 'renderScene'
|
||||
| 'renderTabBar'
|
||||
| 'renderPager'
|
||||
| 'renderLazyPlaceholder'
|
||||
>
|
||||
> & {
|
||||
/**
|
||||
* Function that returns a React element to use as the pager.
|
||||
* The pager handles swipe gestures and page switching.
|
||||
*/
|
||||
pager?: React.ComponentProps<typeof TabView>['renderPager'];
|
||||
/**
|
||||
* Function that returns a React element to render for routes that haven't been rendered yet.
|
||||
* Receives an object containing the route as the prop.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { TabView, SceneRendererProps } from 'react-native-tab-view';
|
||||
import { Route, useTheme } from '@react-navigation/native';
|
||||
import { useTheme } from '@react-navigation/native';
|
||||
import { TabNavigationState, TabActions } from '@react-navigation/routers';
|
||||
|
||||
import MaterialTopTabBar from './MaterialTopTabBar';
|
||||
@@ -19,6 +19,7 @@ type Props = MaterialTopTabNavigationConfig & {
|
||||
};
|
||||
|
||||
export default function MaterialTopTabView({
|
||||
pager,
|
||||
lazyPlaceholder,
|
||||
tabBar = (props: MaterialTopTabBarProps) => <MaterialTopTabBar {...props} />,
|
||||
tabBarOptions,
|
||||
@@ -30,14 +31,6 @@ export default function MaterialTopTabView({
|
||||
}: Props) {
|
||||
const { colors } = useTheme();
|
||||
|
||||
const renderLazyPlaceholder = (props: { route: Route<string> }) => {
|
||||
if (lazyPlaceholder != null) {
|
||||
return lazyPlaceholder(props);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
const renderTabBar = (props: SceneRendererProps) => {
|
||||
const route = state.routes[state.index];
|
||||
const options = descriptors[route.key].options;
|
||||
@@ -69,7 +62,8 @@ export default function MaterialTopTabView({
|
||||
renderScene={({ route }) => descriptors[route.key].render()}
|
||||
navigationState={state}
|
||||
renderTabBar={renderTabBar}
|
||||
renderLazyPlaceholder={renderLazyPlaceholder}
|
||||
renderPager={pager}
|
||||
renderLazyPlaceholder={lazyPlaceholder}
|
||||
onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}
|
||||
onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}
|
||||
sceneContainerStyle={[
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [5.0.0-alpha.22](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/native-stack@5.0.0-alpha.21...@react-navigation/native-stack@5.0.0-alpha.22) (2020-01-05)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/native-stack
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.21](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/native-stack@5.0.0-alpha.20...@react-navigation/native-stack@5.0.0-alpha.21) (2020-01-03)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/native-stack
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"react-native",
|
||||
"react-navigation"
|
||||
],
|
||||
"version": "5.0.0-alpha.21",
|
||||
"version": "5.0.0-alpha.22",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -29,7 +29,7 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/routers": "^5.0.0-alpha.19"
|
||||
"@react-navigation/routers": "^5.0.0-alpha.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-native-community/bob": "^0.7.0",
|
||||
|
||||
@@ -3,6 +3,17 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [5.0.0-alpha.20](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/routers@5.0.0-alpha.19...@react-navigation/routers@5.0.0-alpha.20) (2020-01-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* preserve focused route in tab on changing screens list ([adbeb29](https://github.com/react-navigation/navigation-ex/commit/adbeb292f522be8d7a58dd3f84e560a6d83d01a8))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.19](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/routers@5.0.0-alpha.18...@react-navigation/routers@5.0.0-alpha.19) (2020-01-01)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/routers
|
||||
|
||||
@@ -250,6 +250,89 @@ it('gets state on route names change', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('preserves focused route on route names change', () => {
|
||||
const router = TabRouter({});
|
||||
|
||||
expect(
|
||||
router.getStateForRouteNamesChange(
|
||||
{
|
||||
index: 1,
|
||||
key: 'tab-test',
|
||||
routeKeyHistory: [],
|
||||
routeNames: ['bar', 'baz', 'qux'],
|
||||
routes: [
|
||||
{ key: 'bar-test', name: 'bar' },
|
||||
{ key: 'baz-test', name: 'baz', params: { answer: 42 } },
|
||||
{ key: 'qux-test', name: 'qux', params: { name: 'Jane' } },
|
||||
],
|
||||
stale: false,
|
||||
type: 'tab',
|
||||
},
|
||||
{
|
||||
routeNames: ['qux', 'foo', 'fiz', 'baz'],
|
||||
routeParamList: {
|
||||
qux: { name: 'John' },
|
||||
fiz: { fruit: 'apple' },
|
||||
},
|
||||
}
|
||||
)
|
||||
).toEqual({
|
||||
index: 3,
|
||||
key: 'tab-test',
|
||||
routeKeyHistory: [],
|
||||
routeNames: ['qux', 'foo', 'fiz', 'baz'],
|
||||
routes: [
|
||||
{ key: 'qux-test', name: 'qux', params: { name: 'Jane' } },
|
||||
{ key: 'foo-test', name: 'foo' },
|
||||
{ key: 'fiz-test', name: 'fiz', params: { fruit: 'apple' } },
|
||||
{ key: 'baz-test', name: 'baz', params: { answer: 42 } },
|
||||
],
|
||||
stale: false,
|
||||
type: 'tab',
|
||||
});
|
||||
});
|
||||
|
||||
it('falls back to first route if route is removed on route names change', () => {
|
||||
const router = TabRouter({});
|
||||
|
||||
expect(
|
||||
router.getStateForRouteNamesChange(
|
||||
{
|
||||
index: 1,
|
||||
key: 'tab-test',
|
||||
routeKeyHistory: [],
|
||||
routeNames: ['bar', 'baz', 'qux'],
|
||||
routes: [
|
||||
{ key: 'bar-test', name: 'bar' },
|
||||
{ key: 'baz-test', name: 'baz', params: { answer: 42 } },
|
||||
{ key: 'qux-test', name: 'qux', params: { name: 'Jane' } },
|
||||
],
|
||||
stale: false,
|
||||
type: 'tab',
|
||||
},
|
||||
{
|
||||
routeNames: ['qux', 'foo', 'fiz'],
|
||||
routeParamList: {
|
||||
qux: { name: 'John' },
|
||||
fiz: { fruit: 'apple' },
|
||||
},
|
||||
}
|
||||
)
|
||||
).toEqual({
|
||||
index: 0,
|
||||
key: 'tab-test',
|
||||
routeKeyHistory: [],
|
||||
routeNames: ['qux', 'foo', 'fiz'],
|
||||
routes: [
|
||||
{ key: 'qux-test', name: 'qux', params: { name: 'Jane' } },
|
||||
{ key: 'foo-test', name: 'foo' },
|
||||
{ key: 'fiz-test', name: 'fiz', params: { fruit: 'apple' } },
|
||||
],
|
||||
stale: false,
|
||||
type: 'tab',
|
||||
});
|
||||
});
|
||||
|
||||
it('handles navigate action', () => {
|
||||
const router = TabRouter({});
|
||||
const options = {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"react-native",
|
||||
"react-navigation"
|
||||
],
|
||||
"version": "5.0.0-alpha.19",
|
||||
"version": "5.0.0-alpha.20",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -147,11 +147,16 @@ export default function TabRouter({
|
||||
}
|
||||
);
|
||||
|
||||
const index = Math.max(
|
||||
0,
|
||||
routeNames.indexOf(state.routes[state.index].name)
|
||||
);
|
||||
|
||||
return {
|
||||
...state,
|
||||
routeNames,
|
||||
routes,
|
||||
index: Math.min(state.index, routes.length - 1),
|
||||
index,
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
@@ -3,6 +3,75 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [5.0.0-alpha.56](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.55...@react-navigation/stack@5.0.0-alpha.56) (2020-01-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove clamping in extrapolation of progress of stack animation ([d3f5c55](https://github.com/react-navigation/navigation-ex/commit/d3f5c55dbfbbff604c3289a40f3eccd91a60ee2e))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.55](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.54...@react-navigation/stack@5.0.0-alpha.55) (2020-01-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* memoize interpolated style to avoid extra work ([d8b88bd](https://github.com/react-navigation/navigation-ex/commit/d8b88bd83f57f2626d5b66bb157fd8e21a937c28))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.54](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.53...@react-navigation/stack@5.0.0-alpha.54) (2020-01-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* expose the header height even if not floating ([12d9083](https://github.com/react-navigation/navigation-ex/commit/12d90833eb36e9e7f229384ec8a05823b0a564d1))
|
||||
* use memo for card container ([65ce20e](https://github.com/react-navigation/navigation-ex/commit/65ce20ecbc1e5f2dba9f1004cb29de03a6e5504a))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.53](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.52...@react-navigation/stack@5.0.0-alpha.53) (2020-01-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* compare with correct height when floating header height updates ([a9e584c](https://github.com/react-navigation/navigation-ex/commit/a9e584c3b765ae1e166a3a82b3fa0a40e8e2172a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* expose header height in context ([133b59c](https://github.com/react-navigation/navigation-ex/commit/133b59cd175ddc899dff3b56bf3a0514c0c91ae6))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.52](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.51...@react-navigation/stack@5.0.0-alpha.52) (2020-01-05)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add headerStatusBarHeight option to stack ([b201fd2](https://github.com/react-navigation/navigation-ex/commit/b201fd20716a2f03cb9373c72281f5d396a9356d))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.51](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.50...@react-navigation/stack@5.0.0-alpha.51) (2020-01-05)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/stack
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.50](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.49...@react-navigation/stack@5.0.0-alpha.50) (2020-01-03)
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"android",
|
||||
"stack"
|
||||
],
|
||||
"version": "5.0.0-alpha.50",
|
||||
"version": "5.0.0-alpha.56",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -33,7 +33,7 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/routers": "^5.0.0-alpha.19",
|
||||
"@react-navigation/routers": "^5.0.0-alpha.20",
|
||||
"color": "^3.1.2",
|
||||
"react-native-iphone-x-helper": "^1.2.1"
|
||||
},
|
||||
|
||||
@@ -36,8 +36,13 @@ export {
|
||||
/**
|
||||
* Utilities
|
||||
*/
|
||||
export { default as StackGestureContext } from './utils/StackGestureContext';
|
||||
export { default as StackCardAnimationContext } from './utils/StackCardAnimationContext';
|
||||
export { default as CardAnimationContext } from './utils/CardAnimationContext';
|
||||
export { default as HeaderHeightContext } from './utils/HeaderHeightContext';
|
||||
export { default as GestureHandlerRefContext } from './utils/GestureHandlerRefContext';
|
||||
|
||||
export { default as useCardAnimation } from './utils/useCardAnimation';
|
||||
export { default as useHeaderHeight } from './utils/useHeaderHeight';
|
||||
export { default as useGestureHandlerRef } from './utils/useGestureHandlerRef';
|
||||
|
||||
/**
|
||||
* Types
|
||||
|
||||
@@ -205,6 +205,12 @@ export type StackHeaderOptions = {
|
||||
* This is useful if you want to render a semi-transparent header or a blurred background.
|
||||
*/
|
||||
headerTransparent?: boolean;
|
||||
/**
|
||||
* Extra padding to add at the top of header to account for translucent status bar.
|
||||
* By default, it uses the top value from the safe area insets of the device.
|
||||
* Pass 0 or a custom value to disable the default behaviour, and customize the height.
|
||||
*/
|
||||
headerStatusBarHeight?: number;
|
||||
};
|
||||
|
||||
export type StackHeaderProps = {
|
||||
|
||||
3
packages/stack/src/utils/HeaderHeightContext.tsx
Normal file
3
packages/stack/src/utils/HeaderHeightContext.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
import * as React from 'react';
|
||||
|
||||
export default React.createContext<number | undefined>(undefined);
|
||||
14
packages/stack/src/utils/useCardAnimation.tsx
Normal file
14
packages/stack/src/utils/useCardAnimation.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import CardAnimationContext from './CardAnimationContext';
|
||||
|
||||
export default function useCardAnimation() {
|
||||
const animation = React.useContext(CardAnimationContext);
|
||||
|
||||
if (animation === undefined) {
|
||||
throw new Error(
|
||||
"Couldn't find values for card animation. Are you inside a screen in Stack?"
|
||||
);
|
||||
}
|
||||
|
||||
return animation;
|
||||
}
|
||||
14
packages/stack/src/utils/useGestureHandlerRef.tsx
Normal file
14
packages/stack/src/utils/useGestureHandlerRef.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import StackGestureRefContext from './GestureHandlerRefContext';
|
||||
|
||||
export default function useGestureHandlerRef() {
|
||||
const ref = React.useContext(StackGestureRefContext);
|
||||
|
||||
if (ref === undefined) {
|
||||
throw new Error(
|
||||
"Couldn't find a ref for gesture handler. Are you inside a screen in Stack?"
|
||||
);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
14
packages/stack/src/utils/useHeaderHeight.tsx
Normal file
14
packages/stack/src/utils/useHeaderHeight.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import HeaderHeightContext from './HeaderHeightContext';
|
||||
|
||||
export default function useFloatingHeaderHeight() {
|
||||
const height = React.useContext(HeaderHeightContext);
|
||||
|
||||
if (height === undefined) {
|
||||
throw new Error(
|
||||
"Couldn't find the header height. Are you inside a screen in Stack?"
|
||||
);
|
||||
}
|
||||
|
||||
return height;
|
||||
}
|
||||
@@ -53,7 +53,10 @@ const warnIfHeaderStylesDefined = (styles: Record<string, any>) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getDefaultHeaderHeight = (layout: Layout, insets: EdgeInsets) => {
|
||||
export const getDefaultHeaderHeight = (
|
||||
layout: Layout,
|
||||
statusBarHeight: number
|
||||
) => {
|
||||
const isLandscape = layout.width > layout.height;
|
||||
|
||||
let headerHeight;
|
||||
@@ -71,7 +74,7 @@ export const getDefaultHeaderHeight = (layout: Layout, insets: EdgeInsets) => {
|
||||
headerHeight = 64;
|
||||
}
|
||||
|
||||
return headerHeight + insets.top;
|
||||
return headerHeight + statusBarHeight;
|
||||
};
|
||||
|
||||
export default class HeaderSegment extends React.Component<Props, State> {
|
||||
@@ -163,6 +166,7 @@ export default class HeaderSegment extends React.Component<Props, State> {
|
||||
headerRightContainerStyle: rightContainerStyle,
|
||||
headerTitleContainerStyle: titleContainerStyle,
|
||||
headerStyle: customHeaderStyle,
|
||||
headerStatusBarHeight = insets.top,
|
||||
styleInterpolator,
|
||||
} = this.props;
|
||||
|
||||
@@ -184,7 +188,7 @@ export default class HeaderSegment extends React.Component<Props, State> {
|
||||
);
|
||||
|
||||
const {
|
||||
height = getDefaultHeaderHeight(layout, insets),
|
||||
height = getDefaultHeaderHeight(layout, headerStatusBarHeight),
|
||||
minHeight,
|
||||
maxHeight,
|
||||
backgroundColor,
|
||||
@@ -311,7 +315,10 @@ export default class HeaderSegment extends React.Component<Props, State> {
|
||||
pointerEvents="box-none"
|
||||
style={[{ height, minHeight, maxHeight, opacity, transform }]}
|
||||
>
|
||||
<View pointerEvents="none" style={{ height: insets.top }} />
|
||||
<View
|
||||
pointerEvents="none"
|
||||
style={{ height: headerStatusBarHeight }}
|
||||
/>
|
||||
<View pointerEvents="box-none" style={styles.content}>
|
||||
{leftButton ? (
|
||||
<Animated.View
|
||||
|
||||
@@ -16,8 +16,8 @@ import {
|
||||
} from 'react-native-gesture-handler';
|
||||
import { EdgeInsets } from 'react-native-safe-area-context';
|
||||
import Color from 'color';
|
||||
import StackGestureContext from '../../utils/StackGestureContext';
|
||||
import StackCardAnimationContext from '../../utils/StackCardAnimationContext';
|
||||
import StackGestureRefContext from '../../utils/GestureHandlerRefContext';
|
||||
import CardAnimationContext from '../../utils/CardAnimationContext';
|
||||
import getDistanceForDirection from '../../utils/getDistanceForDirection';
|
||||
import getInvertedMultiplier from '../../utils/getInvertedMultiplier';
|
||||
import memoize from '../../utils/memoize';
|
||||
@@ -273,6 +273,38 @@ export default class Card extends React.Component<Props> {
|
||||
}
|
||||
};
|
||||
|
||||
// Memoize this to avoid extra work on re-render
|
||||
private getInterpolatedStyle = memoize(
|
||||
(
|
||||
styleInterpolator: StackCardStyleInterpolator,
|
||||
index: number,
|
||||
current: Animated.AnimatedInterpolation,
|
||||
next: Animated.AnimatedInterpolation | undefined,
|
||||
layout: Layout,
|
||||
insetTop: number,
|
||||
insetRight: number,
|
||||
insetBottom: number,
|
||||
insetLeft: number
|
||||
) =>
|
||||
styleInterpolator({
|
||||
index,
|
||||
current: { progress: current },
|
||||
next: next && { progress: next },
|
||||
closing: this.isClosing,
|
||||
swiping: this.isSwiping,
|
||||
inverted: this.inverted,
|
||||
layouts: {
|
||||
screen: layout,
|
||||
},
|
||||
insets: {
|
||||
top: insetTop,
|
||||
right: insetRight,
|
||||
bottom: insetBottom,
|
||||
left: insetLeft,
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
// Keep track of the animation context when deps changes.
|
||||
private getCardAnimationContext = memoize(
|
||||
(
|
||||
@@ -369,18 +401,17 @@ export default class Card extends React.Component<Props> {
|
||||
...rest
|
||||
} = this.props;
|
||||
|
||||
const interpolatedStyle = styleInterpolator({
|
||||
const interpolatedStyle = this.getInterpolatedStyle(
|
||||
styleInterpolator,
|
||||
index,
|
||||
current: { progress: current },
|
||||
next: next && { progress: next },
|
||||
closing: this.isClosing,
|
||||
swiping: this.isSwiping,
|
||||
inverted: this.inverted,
|
||||
layouts: {
|
||||
screen: layout,
|
||||
},
|
||||
insets,
|
||||
});
|
||||
current,
|
||||
next,
|
||||
layout,
|
||||
insets.top,
|
||||
insets.right,
|
||||
insets.bottom,
|
||||
insets.left
|
||||
);
|
||||
|
||||
const animationContext = this.getCardAnimationContext(
|
||||
index,
|
||||
@@ -421,48 +452,48 @@ export default class Card extends React.Component<Props> {
|
||||
: false;
|
||||
|
||||
return (
|
||||
<StackGestureContext.Provider value={this.gestureRef}>
|
||||
<View pointerEvents="box-none" {...rest}>
|
||||
{overlayEnabled && overlayStyle ? (
|
||||
<Animated.View
|
||||
pointerEvents="none"
|
||||
style={[styles.overlay, overlayStyle]}
|
||||
/>
|
||||
) : null}
|
||||
<View pointerEvents="box-none" {...rest}>
|
||||
{overlayEnabled && overlayStyle ? (
|
||||
<Animated.View
|
||||
style={[styles.container, containerStyle, customContainerStyle]}
|
||||
pointerEvents="box-none"
|
||||
pointerEvents="none"
|
||||
style={[styles.overlay, overlayStyle]}
|
||||
/>
|
||||
) : null}
|
||||
<Animated.View
|
||||
style={[styles.container, containerStyle, customContainerStyle]}
|
||||
pointerEvents="box-none"
|
||||
>
|
||||
<PanGestureHandler
|
||||
ref={this.gestureRef}
|
||||
enabled={layout.width !== 0 && gestureEnabled}
|
||||
onGestureEvent={handleGestureEvent}
|
||||
onHandlerStateChange={this.handleGestureStateChange}
|
||||
{...this.gestureActivationCriteria()}
|
||||
>
|
||||
<PanGestureHandler
|
||||
ref={this.gestureRef}
|
||||
enabled={layout.width !== 0 && gestureEnabled}
|
||||
onGestureEvent={handleGestureEvent}
|
||||
onHandlerStateChange={this.handleGestureStateChange}
|
||||
{...this.gestureActivationCriteria()}
|
||||
>
|
||||
<Animated.View style={[styles.container, cardStyle]}>
|
||||
{shadowEnabled && shadowStyle && !isTransparent ? (
|
||||
<Animated.View
|
||||
style={[
|
||||
styles.shadow,
|
||||
gestureDirection === 'horizontal'
|
||||
? styles.shadowHorizontal
|
||||
: styles.shadowVertical,
|
||||
shadowStyle,
|
||||
]}
|
||||
pointerEvents="none"
|
||||
/>
|
||||
) : null}
|
||||
<View ref={this.content} style={[styles.content, contentStyle]}>
|
||||
<StackCardAnimationContext.Provider value={animationContext}>
|
||||
<Animated.View style={[styles.container, cardStyle]}>
|
||||
{shadowEnabled && shadowStyle && !isTransparent ? (
|
||||
<Animated.View
|
||||
style={[
|
||||
styles.shadow,
|
||||
gestureDirection === 'horizontal'
|
||||
? styles.shadowHorizontal
|
||||
: styles.shadowVertical,
|
||||
shadowStyle,
|
||||
]}
|
||||
pointerEvents="none"
|
||||
/>
|
||||
) : null}
|
||||
<View ref={this.content} style={[styles.content, contentStyle]}>
|
||||
<StackGestureRefContext.Provider value={this.gestureRef}>
|
||||
<CardAnimationContext.Provider value={animationContext}>
|
||||
{children}
|
||||
</StackCardAnimationContext.Provider>
|
||||
</View>
|
||||
</Animated.View>
|
||||
</PanGestureHandler>
|
||||
</Animated.View>
|
||||
</View>
|
||||
</StackGestureContext.Provider>
|
||||
</CardAnimationContext.Provider>
|
||||
</StackGestureRefContext.Provider>
|
||||
</View>
|
||||
</Animated.View>
|
||||
</PanGestureHandler>
|
||||
</Animated.View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { StackNavigationState } from '@react-navigation/routers';
|
||||
import { Route, useTheme } from '@react-navigation/native';
|
||||
import { Props as HeaderContainerProps } from '../Header/HeaderContainer';
|
||||
import Card from './Card';
|
||||
import HeaderHeightContext from '../../utils/HeaderHeightContext';
|
||||
import { Scene, Layout, StackHeaderMode, TransitionPreset } from '../../types';
|
||||
|
||||
type Props = TransitionPreset & {
|
||||
@@ -47,10 +48,14 @@ type Props = TransitionPreset & {
|
||||
headerMode: StackHeaderMode;
|
||||
headerShown?: boolean;
|
||||
headerTransparent?: boolean;
|
||||
floatingHeaderHeight: number;
|
||||
headerHeight: number;
|
||||
onHeaderHeightChange: (props: {
|
||||
route: Route<string>;
|
||||
height: number;
|
||||
}) => void;
|
||||
};
|
||||
|
||||
export default function CardContainer({
|
||||
function CardContainer({
|
||||
active,
|
||||
cardOverlayEnabled,
|
||||
cardShadowEnabled,
|
||||
@@ -58,7 +63,6 @@ export default function CardContainer({
|
||||
cardStyleInterpolator,
|
||||
closing,
|
||||
gesture,
|
||||
floatingHeaderHeight,
|
||||
focused,
|
||||
gestureDirection,
|
||||
gestureEnabled,
|
||||
@@ -69,6 +73,8 @@ export default function CardContainer({
|
||||
headerShown,
|
||||
headerStyleInterpolator,
|
||||
headerTransparent,
|
||||
headerHeight,
|
||||
onHeaderHeightChange,
|
||||
index,
|
||||
layout,
|
||||
onCloseRoute,
|
||||
@@ -149,14 +155,18 @@ export default function CardContainer({
|
||||
pointerEvents="box-none"
|
||||
containerStyle={
|
||||
headerMode === 'float' && !headerTransparent && headerShown !== false
|
||||
? { marginTop: floatingHeaderHeight }
|
||||
? { marginTop: headerHeight }
|
||||
: null
|
||||
}
|
||||
contentStyle={[{ backgroundColor: colors.background }, cardStyle]}
|
||||
style={StyleSheet.absoluteFill}
|
||||
>
|
||||
<View style={styles.container}>
|
||||
<View style={styles.scene}>{renderScene({ route: scene.route })}</View>
|
||||
<View style={styles.scene}>
|
||||
<HeaderHeightContext.Provider value={headerHeight}>
|
||||
{renderScene({ route: scene.route })}
|
||||
</HeaderHeightContext.Provider>
|
||||
</View>
|
||||
{headerMode === 'screen'
|
||||
? renderHeader({
|
||||
mode: 'screen',
|
||||
@@ -166,6 +176,7 @@ export default function CardContainer({
|
||||
state,
|
||||
getPreviousRoute,
|
||||
styleInterpolator: headerStyleInterpolator,
|
||||
onContentHeightChange: onHeaderHeightChange,
|
||||
})
|
||||
: null}
|
||||
</View>
|
||||
@@ -173,6 +184,8 @@ export default function CardContainer({
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(CardContainer);
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
|
||||
@@ -71,7 +71,7 @@ type State = {
|
||||
scenes: Scene<Route<string>>[];
|
||||
gestures: GestureValues;
|
||||
layout: Layout;
|
||||
floatingHeaderHeights: Record<string, number>;
|
||||
headerHeights: Record<string, number>;
|
||||
};
|
||||
|
||||
const EPSILON = 1e-5;
|
||||
@@ -112,7 +112,7 @@ const MaybeScreen = ({
|
||||
|
||||
const FALLBACK_DESCRIPTOR = Object.freeze({ options: {} });
|
||||
|
||||
const getFloatingHeaderHeights = (
|
||||
const getHeaderHeights = (
|
||||
routes: Route<string>[],
|
||||
insets: EdgeInsets,
|
||||
descriptors: StackDescriptorMap,
|
||||
@@ -125,13 +125,17 @@ const getFloatingHeaderHeights = (
|
||||
options.headerStyle || {}
|
||||
);
|
||||
|
||||
const safeAreaInsets = {
|
||||
...insets,
|
||||
...options.safeAreaInsets,
|
||||
};
|
||||
|
||||
const { headerStatusBarHeight = safeAreaInsets.top } = options;
|
||||
|
||||
acc[curr.key] =
|
||||
typeof height === 'number'
|
||||
? height
|
||||
: getDefaultHeaderHeight(layout, {
|
||||
...insets,
|
||||
...options.safeAreaInsets,
|
||||
});
|
||||
: getDefaultHeaderHeight(layout, headerStatusBarHeight);
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
@@ -163,14 +167,12 @@ const getProgressFromGesture = (
|
||||
return gesture.interpolate({
|
||||
inputRange: [0, distance],
|
||||
outputRange: [1, 0],
|
||||
extrapolate: 'clamp',
|
||||
});
|
||||
}
|
||||
|
||||
return gesture.interpolate({
|
||||
inputRange: [distance, 0],
|
||||
outputRange: [0, 1],
|
||||
extrapolate: 'clamp',
|
||||
});
|
||||
};
|
||||
|
||||
@@ -279,12 +281,12 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
}),
|
||||
gestures,
|
||||
descriptors: props.descriptors,
|
||||
floatingHeaderHeights: getFloatingHeaderHeights(
|
||||
headerHeights: getHeaderHeights(
|
||||
props.routes,
|
||||
props.insets,
|
||||
state.descriptors,
|
||||
state.layout,
|
||||
state.floatingHeaderHeights
|
||||
state.headerHeights
|
||||
),
|
||||
};
|
||||
}
|
||||
@@ -300,7 +302,7 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
// This is not a great heuristic here. We don't know synchronously
|
||||
// on mount what the header height is so we have just used the most
|
||||
// common cases here.
|
||||
floatingHeaderHeights: {},
|
||||
headerHeights: {},
|
||||
};
|
||||
|
||||
private handleLayout = (e: LayoutChangeEvent) => {
|
||||
@@ -315,7 +317,7 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
|
||||
return {
|
||||
layout,
|
||||
floatingHeaderHeights: getFloatingHeaderHeights(
|
||||
headerHeights: getHeaderHeights(
|
||||
props.routes,
|
||||
props.insets,
|
||||
state.descriptors,
|
||||
@@ -326,23 +328,23 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
});
|
||||
};
|
||||
|
||||
private handleFloatingHeaderLayout = ({
|
||||
private handleHeaderLayout = ({
|
||||
route,
|
||||
height,
|
||||
}: {
|
||||
route: Route<string>;
|
||||
height: number;
|
||||
}) => {
|
||||
this.setState(({ floatingHeaderHeights }) => {
|
||||
const previousHeight = this.state.floatingHeaderHeights[route.key];
|
||||
this.setState(({ headerHeights }) => {
|
||||
const previousHeight = headerHeights[route.key];
|
||||
|
||||
if (previousHeight && previousHeight === height) {
|
||||
if (previousHeight === height) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
floatingHeaderHeights: {
|
||||
...floatingHeaderHeights,
|
||||
headerHeights: {
|
||||
...headerHeights,
|
||||
[route.key]: height,
|
||||
},
|
||||
};
|
||||
@@ -371,7 +373,7 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
onPageChangeCancel,
|
||||
} = this.props;
|
||||
|
||||
const { scenes, layout, gestures, floatingHeaderHeights } = this.state;
|
||||
const { scenes, layout, gestures, headerHeights } = this.state;
|
||||
|
||||
const focusedRoute = state.routes[state.index];
|
||||
const focusedDescriptor = descriptors[focusedRoute.key];
|
||||
@@ -517,7 +519,8 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
onPageChangeConfirm={onPageChangeConfirm}
|
||||
onPageChangeCancel={onPageChangeCancel}
|
||||
gestureResponseDistance={gestureResponseDistance}
|
||||
floatingHeaderHeight={floatingHeaderHeights[route.key]}
|
||||
headerHeight={headerHeights[route.key]}
|
||||
onHeaderHeightChange={this.handleHeaderLayout}
|
||||
getPreviousRoute={getPreviousRoute}
|
||||
headerMode={headerMode}
|
||||
headerShown={headerShown}
|
||||
@@ -544,7 +547,7 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
scenes,
|
||||
state,
|
||||
getPreviousRoute,
|
||||
onContentHeightChange: this.handleFloatingHeaderLayout,
|
||||
onContentHeightChange: this.handleHeaderLayout,
|
||||
styleInterpolator:
|
||||
focusedOptions.headerStyleInterpolator !== undefined
|
||||
? focusedOptions.headerStyleInterpolator
|
||||
|
||||
31
scripts/check-types-path.js
Normal file
31
scripts/check-types-path.js
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const packages = path.join(__dirname, '..', 'packages');
|
||||
|
||||
const invalid = [];
|
||||
|
||||
fs.readdirSync(packages).forEach(name => {
|
||||
const dir = path.join(packages, name);
|
||||
|
||||
if (fs.statSync(path.join(packages, name)).isDirectory()) {
|
||||
const pak = JSON.parse(
|
||||
fs.readFileSync(path.join(dir, 'package.json'), 'utf8')
|
||||
);
|
||||
|
||||
if (pak.types && !fs.existsSync(path.join(dir, pak.types))) {
|
||||
invalid.push(pak);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (invalid.length) {
|
||||
console.log(
|
||||
'Found invalid path to type definitions in the following packages:\n',
|
||||
invalid.map(p => `- ${p.name} (${p.types})`).join('\n')
|
||||
);
|
||||
}
|
||||
154
yarn.lock
154
yarn.lock
@@ -4113,6 +4113,11 @@ bl@^3.0.0:
|
||||
dependencies:
|
||||
readable-stream "^3.0.1"
|
||||
|
||||
bluebird@3.5.x:
|
||||
version "3.5.5"
|
||||
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f"
|
||||
integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==
|
||||
|
||||
bluebird@^3.5.0, bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5:
|
||||
version "3.7.2"
|
||||
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
|
||||
@@ -4434,6 +4439,14 @@ builtins@^1.0.3:
|
||||
resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88"
|
||||
integrity sha1-y5T662HIaWRR2zZTThQi+U8K7og=
|
||||
|
||||
bunyan-debug-stream@^1.1.0:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/bunyan-debug-stream/-/bunyan-debug-stream-1.1.1.tgz#4740a00b7d5c2d9d1b714925ab0802516040813e"
|
||||
integrity sha512-jJbQ1gXUL6vMmZVdbaTFK1v1sGa7axLrSQQwkB6HU9HCPTzsw2HsKcPHm1vgXZlEck/4IvEuRwg/9+083YelCg==
|
||||
dependencies:
|
||||
colors "^1.0.3"
|
||||
exception-formatter "^1.0.4"
|
||||
|
||||
bunyan@^1.8.12:
|
||||
version "1.8.12"
|
||||
resolved "https://registry.yarnpkg.com/bunyan/-/bunyan-1.8.12.tgz#f150f0f6748abdd72aeae84f04403be2ef113797"
|
||||
@@ -4693,6 +4706,15 @@ check-types@^8.0.3:
|
||||
resolved "https://registry.yarnpkg.com/check-types/-/check-types-8.0.3.tgz#3356cca19c889544f2d7a95ed49ce508a0ecf552"
|
||||
integrity sha512-YpeKZngUmG65rLudJ4taU7VLkOCTMhNl/u4ctNC56LQS/zJTyNH0Lrtwm1tfTsbLlwvlfsA2d1c8vCf/Kh2KwQ==
|
||||
|
||||
child-process-promise@^2.2.0:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/child-process-promise/-/child-process-promise-2.2.1.tgz#4730a11ef610fad450b8f223c79d31d7bdad8074"
|
||||
integrity sha1-RzChHvYQ+tRQuPIjx50x172tgHQ=
|
||||
dependencies:
|
||||
cross-spawn "^4.0.2"
|
||||
node-version "^1.0.0"
|
||||
promise-polyfill "^6.0.1"
|
||||
|
||||
chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.4:
|
||||
version "2.1.8"
|
||||
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.8.tgz#804b3a7b6a99358c3c5c61e71d8728f041cff917"
|
||||
@@ -4936,6 +4958,11 @@ colors@1.0.3:
|
||||
resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b"
|
||||
integrity sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=
|
||||
|
||||
colors@^1.0.3:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78"
|
||||
integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==
|
||||
|
||||
columnify@^1.5.4:
|
||||
version "1.5.4"
|
||||
resolved "https://registry.yarnpkg.com/columnify/-/columnify-1.5.4.tgz#4737ddf1c7b69a8a7c340570782e947eec8e78bb"
|
||||
@@ -5405,6 +5432,14 @@ cross-spawn@6.0.5, cross-spawn@^6.0.0, cross-spawn@^6.0.5:
|
||||
shebang-command "^1.2.0"
|
||||
which "^1.2.9"
|
||||
|
||||
cross-spawn@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41"
|
||||
integrity sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=
|
||||
dependencies:
|
||||
lru-cache "^4.0.1"
|
||||
which "^1.2.9"
|
||||
|
||||
cross-spawn@^5.0.1, cross-spawn@^5.1.0:
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
|
||||
@@ -6002,6 +6037,33 @@ detect-port-alt@1.1.6:
|
||||
address "^1.0.1"
|
||||
debug "^2.6.0"
|
||||
|
||||
detox@^15.0.0:
|
||||
version "15.0.0"
|
||||
resolved "https://registry.yarnpkg.com/detox/-/detox-15.0.0.tgz#1b4a4133d2de1a9ac6918c061306cc348090b580"
|
||||
integrity sha512-mnF+3FoTP0ruqmYSJOEWQ5mmDYp3igD/CytBnhOupYHzTrzgIKl7F5+qnIg6SXIA+ANqgfQvy6bAiXI/26CSrQ==
|
||||
dependencies:
|
||||
"@babel/core" "^7.4.5"
|
||||
bunyan "^1.8.12"
|
||||
bunyan-debug-stream "^1.1.0"
|
||||
chalk "^2.4.2"
|
||||
child-process-promise "^2.2.0"
|
||||
fs-extra "^4.0.2"
|
||||
funpermaproxy "^1.0.1"
|
||||
get-port "^2.1.0"
|
||||
ini "^1.3.4"
|
||||
lodash "^4.17.5"
|
||||
minimist "^1.2.0"
|
||||
proper-lockfile "^3.0.2"
|
||||
sanitize-filename "^1.6.1"
|
||||
shell-utils "^1.0.9"
|
||||
tail "^2.0.0"
|
||||
telnet-client "0.15.3"
|
||||
tempfile "^2.0.0"
|
||||
which "^1.3.1"
|
||||
ws "^3.3.1"
|
||||
yargs "^13.0.0"
|
||||
yargs-parser "^13.0.0"
|
||||
|
||||
dezalgo@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.3.tgz#7f742de066fc748bc8db820569dddce49bf0d456"
|
||||
@@ -6756,6 +6818,13 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3:
|
||||
md5.js "^1.3.4"
|
||||
safe-buffer "^5.1.1"
|
||||
|
||||
exception-formatter@^1.0.4:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/exception-formatter/-/exception-formatter-1.0.7.tgz#3291616b86fceabefa97aee6a4708032c6e3b96d"
|
||||
integrity sha512-zV45vEsjytJrwfGq6X9qd1Ll56cW4NC2mhCO6lqwMk4ZpA1fZ6C3UiaQM/X7if+7wZFmCgss3ahp9B/uVFuLRw==
|
||||
dependencies:
|
||||
colors "^1.0.3"
|
||||
|
||||
exec-async@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/exec-async/-/exec-async-2.2.0.tgz#c7c5ad2eef3478d38390c6dd3acfe8af0efc8301"
|
||||
@@ -7690,6 +7759,11 @@ functional-red-black-tree@^1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
|
||||
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
|
||||
|
||||
funpermaproxy@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/funpermaproxy/-/funpermaproxy-1.0.1.tgz#4650e69b7c334d9717c06beba9b339cc08ac3335"
|
||||
integrity sha512-9pEzs5vnNtR7ZGihly98w/mQ7blsvl68Wj30ZCDAXy7qDN4CWLLjdfjtH/P2m6whsnaJkw15hysCNHMXue+wdA==
|
||||
|
||||
gauge@~2.7.3:
|
||||
version "2.7.4"
|
||||
resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7"
|
||||
@@ -7735,6 +7809,13 @@ get-pkg-repo@^1.0.0:
|
||||
parse-github-repo-url "^1.3.0"
|
||||
through2 "^2.0.0"
|
||||
|
||||
get-port@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/get-port/-/get-port-2.1.0.tgz#8783f9dcebd1eea495a334e1a6a251e78887ab1a"
|
||||
integrity sha1-h4P53OvR7qSVozThpqJR54iHqxo=
|
||||
dependencies:
|
||||
pinkie-promise "^2.0.0"
|
||||
|
||||
get-port@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/get-port/-/get-port-4.2.0.tgz#e37368b1e863b7629c43c5a323625f95cf24b119"
|
||||
@@ -9658,7 +9739,7 @@ jest-worker@^24.6.0, jest-worker@^24.9.0:
|
||||
merge-stream "^2.0.0"
|
||||
supports-color "^6.1.0"
|
||||
|
||||
jest@^24.8.0:
|
||||
jest@^24.9.0:
|
||||
version "24.9.0"
|
||||
resolved "https://registry.yarnpkg.com/jest/-/jest-24.9.0.tgz#987d290c05a08b52c56188c1002e368edb007171"
|
||||
integrity sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw==
|
||||
@@ -10181,7 +10262,7 @@ lodash@4.17.14:
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba"
|
||||
integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==
|
||||
|
||||
lodash@4.17.15, "lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.6.0, lodash@^4.6.1:
|
||||
lodash@4.17.15, lodash@4.x.x, "lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.6.0, lodash@^4.6.1:
|
||||
version "4.17.15"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
|
||||
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
|
||||
@@ -11365,6 +11446,11 @@ node-releases@^1.1.42:
|
||||
dependencies:
|
||||
semver "^6.3.0"
|
||||
|
||||
node-version@^1.0.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/node-version/-/node-version-1.2.0.tgz#34fde3ffa8e1149bd323983479dda620e1b5060d"
|
||||
integrity sha512-ma6oU4Sk0qOoKEAymVoTvk8EdXEobdS7m/mAGhDJ8Rouugho48crHBORAmy5BoOcv8wraPM6xumapQp5hl4iIQ==
|
||||
|
||||
noop-fn@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/noop-fn/-/noop-fn-1.0.0.tgz#5f33d47f13d2150df93e0cb036699e982f78ffbf"
|
||||
@@ -12858,6 +12944,11 @@ promise-inflight@^1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3"
|
||||
integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM=
|
||||
|
||||
promise-polyfill@^6.0.1:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-6.1.0.tgz#dfa96943ea9c121fca4de9b5868cb39d3472e057"
|
||||
integrity sha1-36lpQ+qcEh/KTem1hoyznTRy4Fc=
|
||||
|
||||
promise-retry@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/promise-retry/-/promise-retry-1.1.1.tgz#6739e968e3051da20ce6497fb2b50f6911df3d6d"
|
||||
@@ -12897,6 +12988,15 @@ prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:
|
||||
object-assign "^4.1.1"
|
||||
react-is "^16.8.1"
|
||||
|
||||
proper-lockfile@^3.0.2:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/proper-lockfile/-/proper-lockfile-3.2.0.tgz#89ca420eea1d55d38ca552578851460067bcda66"
|
||||
integrity sha512-iMghHHXv2bsxl6NchhEaFck8tvX3F9cknEEh1SUpguUOBjN7PAAW9BLzmbc1g/mCD1gY3EE2EABBHPJfFdHFmA==
|
||||
dependencies:
|
||||
graceful-fs "^4.1.11"
|
||||
retry "^0.12.0"
|
||||
signal-exit "^3.0.2"
|
||||
|
||||
property-expr@^1.5.0:
|
||||
version "1.5.1"
|
||||
resolved "https://registry.yarnpkg.com/property-expr/-/property-expr-1.5.1.tgz#22e8706894a0c8e28d58735804f6ba3a3673314f"
|
||||
@@ -14071,6 +14171,13 @@ sane@^4.0.3:
|
||||
minimist "^1.1.1"
|
||||
walker "~1.0.5"
|
||||
|
||||
sanitize-filename@^1.6.1:
|
||||
version "1.6.3"
|
||||
resolved "https://registry.yarnpkg.com/sanitize-filename/-/sanitize-filename-1.6.3.tgz#755ebd752045931977e30b2025d340d7c9090378"
|
||||
integrity sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==
|
||||
dependencies:
|
||||
truncate-utf8-bytes "^1.0.0"
|
||||
|
||||
sax@^1.2.1, sax@^1.2.4, sax@~1.2.4:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
|
||||
@@ -14343,6 +14450,13 @@ shell-quote@^1.6.1:
|
||||
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2"
|
||||
integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==
|
||||
|
||||
shell-utils@^1.0.9:
|
||||
version "1.0.10"
|
||||
resolved "https://registry.yarnpkg.com/shell-utils/-/shell-utils-1.0.10.tgz#7fe7b8084f5d6d21323d941267013bc38aed063e"
|
||||
integrity sha512-p1xuqhj3jgcXiV8wGoF1eL/NOvapN9tyGDoObqKwvZTUZn7fIzK75swLTEHfGa7sObeN9vxFplHw/zgYUYRTsg==
|
||||
dependencies:
|
||||
lodash "4.x.x"
|
||||
|
||||
shellwords@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
|
||||
@@ -15058,6 +15172,11 @@ table@^5.2.3:
|
||||
slice-ansi "^2.1.0"
|
||||
string-width "^3.0.0"
|
||||
|
||||
tail@^2.0.0:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/tail/-/tail-2.0.3.tgz#37567adc4624a70b35f1d146c3376fa3d6ef7c04"
|
||||
integrity sha512-s9NOGkLqqiDEtBttQZI7acLS8ycYK5sTlDwNjGnpXG9c8AWj0cfAtwEIzo/hVRMMiC5EYz+bXaJWC1u1u0GPpQ==
|
||||
|
||||
tapable@^1.0.0, tapable@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
|
||||
@@ -15149,6 +15268,13 @@ teeny-request@^3.11.3:
|
||||
node-fetch "^2.2.0"
|
||||
uuid "^3.3.2"
|
||||
|
||||
telnet-client@0.15.3:
|
||||
version "0.15.3"
|
||||
resolved "https://registry.yarnpkg.com/telnet-client/-/telnet-client-0.15.3.tgz#99ec754e4acf6fa51dc69898f574df3c2550712e"
|
||||
integrity sha512-GSfdzQV0BKIYsmeXq7bJFJ2wHeJud6icaIxCUf6QCGQUD6R0BBGbT1+yLDhq67JRdgRpwyPwUbV7JxFeRrZomQ==
|
||||
dependencies:
|
||||
bluebird "3.5.x"
|
||||
|
||||
temp-dir@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-1.0.0.tgz#0a7c0ea26d3a39afa7e0ebea9c1fc0bc4daa011d"
|
||||
@@ -15174,6 +15300,14 @@ temp@0.8.3:
|
||||
os-tmpdir "^1.0.0"
|
||||
rimraf "~2.2.6"
|
||||
|
||||
tempfile@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/tempfile/-/tempfile-2.0.0.tgz#6b0446856a9b1114d1856ffcbe509cccb0977265"
|
||||
integrity sha1-awRGhWqbERTRhW/8vlCczLCXcmU=
|
||||
dependencies:
|
||||
temp-dir "^1.0.0"
|
||||
uuid "^3.0.1"
|
||||
|
||||
tempy@0.3.0, tempy@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/tempy/-/tempy-0.3.0.tgz#6f6c5b295695a16130996ad5ab01a8bd726e8bf8"
|
||||
@@ -15443,6 +15577,13 @@ trim-off-newlines@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3"
|
||||
integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM=
|
||||
|
||||
truncate-utf8-bytes@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz#405923909592d56f78a5818434b0b78489ca5f2b"
|
||||
integrity sha1-QFkjkJWS1W94pYGENLC3hInKXys=
|
||||
dependencies:
|
||||
utf8-byte-length "^1.0.1"
|
||||
|
||||
tryer@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8"
|
||||
@@ -15837,6 +15978,11 @@ use@^3.1.0:
|
||||
resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f"
|
||||
integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==
|
||||
|
||||
utf8-byte-length@^1.0.1:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz#f45f150c4c66eee968186505ab93fcbb8ad6bf61"
|
||||
integrity sha1-9F8VDExm7uloGGUFq5P8u4rWv2E=
|
||||
|
||||
util-deprecate@^1.0.1, util-deprecate@~1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
||||
@@ -16598,7 +16744,7 @@ yargs-parser@^11.1.1:
|
||||
camelcase "^5.0.0"
|
||||
decamelize "^1.2.0"
|
||||
|
||||
yargs-parser@^13.1.1:
|
||||
yargs-parser@^13.0.0, yargs-parser@^13.1.1:
|
||||
version "13.1.1"
|
||||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0"
|
||||
integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==
|
||||
@@ -16657,7 +16803,7 @@ yargs@12.0.x, yargs@^12.0.5:
|
||||
y18n "^3.2.1 || ^4.0.0"
|
||||
yargs-parser "^11.1.1"
|
||||
|
||||
yargs@^13.2.2, yargs@^13.3.0:
|
||||
yargs@^13.0.0, yargs@^13.2.2, yargs@^13.3.0:
|
||||
version "13.3.0"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83"
|
||||
integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==
|
||||
|
||||
Reference in New Issue
Block a user