react-router-native 5.1.2 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/BackButton.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { BackHandler } from "react-native";
3
3
 
4
- import { __RouterContext as RouterContext } from "react-router";
4
+ import { __HistoryContext as HistoryContext } from "react-router";
5
5
 
6
6
  class BackButton extends React.Component {
7
7
  handleBack = () => {
@@ -23,12 +23,12 @@ class BackButton extends React.Component {
23
23
 
24
24
  render() {
25
25
  return (
26
- <RouterContext.Consumer>
27
- {context => {
28
- this.history = context.history;
26
+ <HistoryContext.Consumer>
27
+ {history => {
28
+ this.history = history;
29
29
  return this.props.children || null;
30
30
  }}
31
- </RouterContext.Consumer>
31
+ </HistoryContext.Consumer>
32
32
  );
33
33
  }
34
34
  }
package/DeepLinking.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { Linking } from "react-native";
3
3
 
4
- import { __RouterContext as RouterContext } from "react-router";
4
+ import { __HistoryContext as HistoryContext } from "react-router";
5
5
 
6
6
  const protocolAndSlashes = /.*?:\/\//g;
7
7
 
@@ -27,12 +27,12 @@ class DeepLinking extends React.Component {
27
27
 
28
28
  render() {
29
29
  return (
30
- <RouterContext.Consumer>
31
- {context => {
32
- this.history = context.history;
30
+ <HistoryContext.Consumer>
31
+ {history => {
32
+ this.history = history;
33
33
  return this.props.children || null;
34
34
  }}
35
- </RouterContext.Consumer>
35
+ </HistoryContext.Consumer>
36
36
  );
37
37
  }
38
38
  }
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) React Training 2016-2018
3
+ Copyright (c) React Training
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/Link.js CHANGED
@@ -2,9 +2,9 @@ import React from "react";
2
2
  import { TouchableHighlight } from "react-native";
3
3
  import PropTypes from "prop-types";
4
4
 
5
- import { __RouterContext as RouterContext } from "react-router";
5
+ import { __HistoryContext as HistoryContext } from "react-router";
6
6
 
7
- class Link extends React.Component {
7
+ export default class Link extends React.Component {
8
8
  static defaultProps = {
9
9
  component: TouchableHighlight,
10
10
  replace: false
@@ -28,14 +28,14 @@ class Link extends React.Component {
28
28
  const { component: Component, to, replace, ...rest } = this.props;
29
29
 
30
30
  return (
31
- <RouterContext.Consumer>
32
- {context => (
31
+ <HistoryContext.Consumer>
32
+ {history => (
33
33
  <Component
34
34
  {...rest}
35
- onPress={event => this.handlePress(event, context.history)}
35
+ onPress={event => this.handlePress(event, history)}
36
36
  />
37
37
  )}
38
- </RouterContext.Consumer>
38
+ </HistoryContext.Consumer>
39
39
  );
40
40
  }
41
41
  }
@@ -45,10 +45,8 @@ const __DEV__ = true; // TODO
45
45
  if (__DEV__) {
46
46
  Link.propTypes = {
47
47
  onPress: PropTypes.func,
48
- component: PropTypes.func,
48
+ component: PropTypes.elementType,
49
49
  replace: PropTypes.bool,
50
50
  to: PropTypes.oneOfType([PropTypes.string, PropTypes.object])
51
51
  };
52
52
  }
53
-
54
- export default Link;
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # react-router-native
2
2
 
3
- [React Native](https://facebook.github.io/react-native/) bindings for [React Router](https://reacttraining.com/react-router).
3
+ [React Native](https://facebook.github.io/react-native/) bindings for [React Router](https://reactrouter.com).
4
4
 
5
5
  ## Installation
6
6
 
@@ -22,7 +22,7 @@ var Link = require("react-router-native").Link;
22
22
 
23
23
  ## Issues
24
24
 
25
- If you find a bug, please file an issue on [our issue tracker on GitHub](https://github.com/ReactTraining/react-router/issues).
25
+ If you find a bug, please file an issue on [our issue tracker on GitHub](https://github.com/remix-run/react-router/issues).
26
26
 
27
27
  ## Credits
28
28
 
@@ -10,7 +10,7 @@ import { Route, Redirect } from "react-router";
10
10
  import { Text, View, Dimensions, Animated, PanResponder } from "react-native";
11
11
  import PropTypes from "prop-types";
12
12
 
13
- import Link from "../Link";
13
+ import Link from "../Link.js";
14
14
 
15
15
  class StackContainer extends Component {
16
16
  static contextTypes = {
@@ -136,7 +136,7 @@ class AnimatedStack extends React.Component {
136
136
  Animated.timing(this.animation, {
137
137
  toValue: 0,
138
138
  duration: releaseRatio * ANIMATION_DURATION + 2000
139
- }).start(({ finished }) => {
139
+ }).start(() => {
140
140
  this.props.onCancelPan();
141
141
  });
142
142
  }
@@ -147,7 +147,7 @@ class AnimatedStack extends React.Component {
147
147
  Animated.timing(this.animation, {
148
148
  toValue: width,
149
149
  duration: (1 - releaseRatio) * ANIMATION_DURATION + 2000
150
- }).start(({ finished }) => {
150
+ }).start(() => {
151
151
  this.setState({
152
152
  previousProps: null
153
153
  });
@@ -186,7 +186,7 @@ class AnimatedStack extends React.Component {
186
186
  Animated.timing(this.animation, {
187
187
  toValue: width,
188
188
  duration: ANIMATION_DURATION
189
- }).start(({ finished }) => {
189
+ }).start(() => {
190
190
  this.setState({ previousProps: null });
191
191
  });
192
192
  }
@@ -198,7 +198,7 @@ class AnimatedStack extends React.Component {
198
198
  render() {
199
199
  const { width, height } = Dimensions.get("window");
200
200
  const { direction } = this.props;
201
- const { previousProps, panDx, panning, panStartLeft } = this.state;
201
+ const { previousProps, panning, panStartLeft } = this.state;
202
202
  const animating = !!previousProps;
203
203
  const bothProps = [this.props];
204
204
  if (animating) bothProps.push(previousProps);
@@ -229,14 +229,14 @@ class AnimatedStack extends React.Component {
229
229
  opacity: !transitioning
230
230
  ? 1
231
231
  : isParent
232
- ? this.animation.interpolate({
233
- inputRange: [0, width],
234
- outputRange: [0, 1]
235
- })
236
- : this.animation.interpolate({
237
- inputRange: [0, width],
238
- outputRange: [1, 0]
239
- }),
232
+ ? this.animation.interpolate({
233
+ inputRange: [0, width],
234
+ outputRange: [0, 1]
235
+ })
236
+ : this.animation.interpolate({
237
+ inputRange: [0, width],
238
+ outputRange: [1, 0]
239
+ }),
240
240
  flexDirection: "row",
241
241
  alignItems: "center",
242
242
  position: "absolute",
@@ -272,42 +272,39 @@ class AnimatedStack extends React.Component {
272
272
  translateX: !transitioning
273
273
  ? 0
274
274
  : panning
275
- ? isParent
276
- ? this.animation.interpolate({
277
- inputRange: [0, width],
278
- outputRange: [
279
- -PARENT_TRAVEL_DISTANCE - panStartLeft,
280
- -panStartLeft
281
- ]
282
- })
283
- : this.animation.interpolate({
284
- inputRange: [0, width],
285
- outputRange: [
286
- -panStartLeft,
287
- width - panStartLeft
288
- ]
289
- })
275
+ ? isParent
276
+ ? this.animation.interpolate({
277
+ inputRange: [0, width],
278
+ outputRange: [
279
+ -PARENT_TRAVEL_DISTANCE - panStartLeft,
280
+ -panStartLeft
281
+ ]
282
+ })
290
283
  : this.animation.interpolate({
291
284
  inputRange: [0, width],
292
- outputRange: isParent
293
- ? direction === "down"
294
- ? [width + CARD_SHADOW_RADIUS, 0]
295
- : [-PARENT_TRAVEL_DISTANCE, 0]
296
- : direction === "down"
297
- ? [0, -PARENT_TRAVEL_DISTANCE]
298
- : [0, width + CARD_SHADOW_RADIUS]
285
+ outputRange: [-panStartLeft, width - panStartLeft]
299
286
  })
287
+ : this.animation.interpolate({
288
+ inputRange: [0, width],
289
+ outputRange: isParent
290
+ ? direction === "down"
291
+ ? [width + CARD_SHADOW_RADIUS, 0]
292
+ : [-PARENT_TRAVEL_DISTANCE, 0]
293
+ : direction === "down"
294
+ ? [0, -PARENT_TRAVEL_DISTANCE]
295
+ : [0, width + CARD_SHADOW_RADIUS]
296
+ })
300
297
  }
301
298
  ],
302
299
  zIndex: !transitioning
303
300
  ? 1
304
301
  : isParent
305
- ? direction === "down"
306
- ? 1
307
- : 0
308
- : direction === "down"
309
- ? 0
310
- : 1,
302
+ ? direction === "down"
303
+ ? 1
304
+ : 0
305
+ : direction === "down"
306
+ ? 0
307
+ : 1,
311
308
  position: "absolute",
312
309
  width,
313
310
  height,
@@ -323,20 +320,20 @@ class AnimatedStack extends React.Component {
323
320
  outputRange: [PARENT_FINAL_OPACITY, 1]
324
321
  })
325
322
  : !transitioning
326
- ? 1
327
- : isParent && "direction" === "down"
328
- ? 1
329
- : this.animation.interpolate({
330
- inputRange: [0, width],
331
- outputRange:
332
- index === 1 && direction === "down"
333
- ? [1, PARENT_FINAL_OPACITY]
334
- : isParent && direction === "up"
335
- ? [PARENT_FINAL_OPACITY, 1]
336
- : index === 1 && direction === "up"
337
- ? [1, 1]
338
- : [1, 1]
339
- })
323
+ ? 1
324
+ : isParent && "direction" === "down"
325
+ ? 1
326
+ : this.animation.interpolate({
327
+ inputRange: [0, width],
328
+ outputRange:
329
+ index === 1 && direction === "down"
330
+ ? [1, PARENT_FINAL_OPACITY]
331
+ : isParent && direction === "up"
332
+ ? [PARENT_FINAL_OPACITY, 1]
333
+ : index === 1 && direction === "up"
334
+ ? [1, 1]
335
+ : [1, 1]
336
+ })
340
337
  }}
341
338
  >
342
339
  {props.content}
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { Route } from "react-router";
3
3
  import { View } from "react-native";
4
4
 
5
- import Link from "../Link";
5
+ import Link from "../Link.js";
6
6
 
7
7
  export class TabRoutes extends React.Component {
8
8
  render() {
package/main.js CHANGED
@@ -1,14 +1,22 @@
1
- export * from "react-router";
2
-
3
- import BackButton from "./BackButton";
4
- import DeepLinking from "./DeepLinking";
5
- import Link from "./Link";
6
- import NativeRouter from "./NativeRouter";
7
-
8
1
  export {
9
- BackButton,
10
- BackButton as AndroidBackButton,
11
- DeepLinking,
12
- Link,
13
- NativeRouter
14
- };
2
+ MemoryRouter,
3
+ Prompt,
4
+ Redirect,
5
+ Route,
6
+ Router,
7
+ StaticRouter,
8
+ Switch,
9
+ generatePath,
10
+ matchPath,
11
+ withRouter,
12
+ useHistory,
13
+ useLocation,
14
+ useParams,
15
+ useRouteMatch
16
+ } from "react-router";
17
+
18
+ export { default as BackButton } from "./BackButton.js";
19
+ export { default as AndroidBackButton } from "./BackButton.js";
20
+ export { default as DeepLinking } from "./DeepLinking.js";
21
+ export { default as Link } from "./Link.js";
22
+ export { default as NativeRouter } from "./NativeRouter.js";
package/package.json CHANGED
@@ -1,20 +1,23 @@
1
1
  {
2
2
  "name": "react-router-native",
3
- "version": "5.1.2",
3
+ "version": "5.3.1",
4
4
  "description": "React Native bindings for React Router",
5
- "repository": "ReactTraining/react-router",
5
+ "homepage": "https://reactrouter.com/",
6
+ "repository": {
7
+ "url": "https://github.com/remix-run/react-router.git",
8
+ "type": "git",
9
+ "directory": "packages/react-router-native"
10
+ },
6
11
  "license": "MIT",
7
- "authors": [
8
- "Michael Jackson",
9
- "Ryan Florence"
10
- ],
12
+ "author": "React Training <hello@reacttraining.com>",
11
13
  "main": "main.js",
12
14
  "sideEffects": false,
13
15
  "scripts": {
14
- "start": "node node_modules/react-native/local-cli/cli.js start",
15
- "test": "jest"
16
+ "start": "node node_modules/react-native/local-cli/cli.js start"
16
17
  },
17
18
  "files": [
19
+ "LICENSE",
20
+ "README.md",
18
21
  "BackButton.js",
19
22
  "DeepLinking.js",
20
23
  "Link.js",
@@ -29,16 +32,6 @@
29
32
  },
30
33
  "dependencies": {
31
34
  "prop-types": "^15.6.1",
32
- "react-router": "5.1.2"
33
- },
34
- "devDependencies": {
35
- "babel-jest": "^24.8.0",
36
- "jest": "^24.8.0",
37
- "jest-circus": "^24.8.0",
38
- "metro-react-native-babel-preset": "^0.53.1",
39
- "react": "^16.8.3",
40
- "react-native": "^0.59.8",
41
- "react-test-renderer": "^16.8.3"
42
- },
43
- "gitHead": "f31bb27aa61dd4cb1c3cd9aa78133f739e2e9bb9"
35
+ "react-router": "5.3.1"
36
+ }
44
37
  }