How to use the react-router-native.matchPath function in react-router-native

To help you get started, we’ve selected a few react-router-native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / react-router-native_v4.x.x / flow_v0.53.x- / test_react-router-native.js View on Github external
// matchPath
const match: null | Match = matchPath("/the/pathname", {
  path: "/the/:dynamicId",
  exact: true,
  strict: false
});
const match2: null | Match = matchPath("/the/pathname", {
  path: "/the/:dynamicId"
});
const match3: null | Match = matchPath("/the/pathname");

// $ExpectError
matchPath();
// $ExpectError
const matchError: string = matchPath("/the/pathname", {
  path: "the/:dynamicId"
});

const Unrouted: React$ComponentType<{|
  ...ContextRouter,
  someProp: string
|}&gt; = () =&gt; <span>;

const Routed1: React$ComponentType&lt;{| someProp: string |}&gt; = withRouter(
  Unrouted
);

// $ExpectError: This error bubbles up from the assignment in Routed2.
const Unrouted2: React$ComponentType&lt;{|
  ...ContextRouter,
  someProp: string</span>
github flow-typed / flow-typed / definitions / npm / react-router-native_v4.x.x / flow_v0.53.x- / test_react-router-native.js View on Github external
}}
&gt;
  About
;

// $ExpectError
;

// DeepLinking
;

// AndroidBackButton
;

// matchPath
const match: null | Match = matchPath("/the/pathname", {
  path: "/the/:dynamicId",
  exact: true,
  strict: false
});
const match2: null | Match = matchPath("/the/pathname", {
  path: "/the/:dynamicId"
});
const match3: null | Match = matchPath("/the/pathname");

// $ExpectError
matchPath();
// $ExpectError
const matchError: string = matchPath("/the/pathname", {
  path: "the/:dynamicId"
});
github flow-typed / flow-typed / definitions / npm / react-router-native_v4.x.x / flow_v0.53.x- / test_react-router-native.js View on Github external
// $ExpectError
;

// DeepLinking
;

// AndroidBackButton
;

// matchPath
const match: null | Match = matchPath("/the/pathname", {
  path: "/the/:dynamicId",
  exact: true,
  strict: false
});
const match2: null | Match = matchPath("/the/pathname", {
  path: "/the/:dynamicId"
});
const match3: null | Match = matchPath("/the/pathname");

// $ExpectError
matchPath();
// $ExpectError
const matchError: string = matchPath("/the/pathname", {
  path: "the/:dynamicId"
});

const Unrouted: React$ComponentType&lt;{|
  ...ContextRouter,
  someProp: string
|}&gt; = () =&gt; <span>;
</span>
github flow-typed / flow-typed / definitions / npm / react-router-native_v4.x.x / flow_v0.53.x- / test_react-router-native.js View on Github external
// DeepLinking
;

// AndroidBackButton
;

// matchPath
const match: null | Match = matchPath("/the/pathname", {
  path: "/the/:dynamicId",
  exact: true,
  strict: false
});
const match2: null | Match = matchPath("/the/pathname", {
  path: "/the/:dynamicId"
});
const match3: null | Match = matchPath("/the/pathname");

// $ExpectError
matchPath();
// $ExpectError
const matchError: string = matchPath("/the/pathname", {
  path: "the/:dynamicId"
});

const Unrouted: React$ComponentType&lt;{|
  ...ContextRouter,
  someProp: string
|}&gt; = () =&gt; <span>;

const Routed1: React$ComponentType&lt;{| someProp: string |}&gt; = withRouter(
  Unrouted
);</span>
github Traviskn / react-router-native-stack / lib / findFirstMatch.js View on Github external
React.Children.forEach(children, element => {
    if (!React.isValidElement(element)) return;

    const { path: pathProp, exact, strict, sensitive, from } = element.props;
    const path = pathProp || from;

    if (match == null) {
      child = element;
      match = path == null ? {} : matchPath(location.pathname, { path, exact, strict, sensitive });
    }
  });

react-router-native

Declarative routing for React Native applications

MIT
Latest version published 10 days ago

Package Health Score

95 / 100
Full package analysis