1.0.8 • Published 10 months ago

@kode-frontend/pathfinder-rn v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

:construction: :construction: :construction: THIS PROJECT HAS EXPERIMENTAL STATUS, DON'T USE IT :construction: :construction: :construction:

pathfinder-rn

This is a library for integrating a pathfinder into your application. The library is easy to integrate into an existing project and does not require any further development.

Installation

yarn add @kode-frontend/pathfinder-rn

Usage

import {
  createPathfinder,
  PathfinderConfiguration,
} from '@kode-frontend/pathfinder-rn';
import AsyncStorage from '@react-native-async-storage/async-storage';

import petstore from '../petstore.json';
import users from '../users.json';

const config = PathfinderConfiguration
  // create pathfinder configuration with default settings for mock server
  // default mock server settings are optional
  .create({
    domain: 'https://127.0.0.1:3100',
    headers: {
      Accept: 'application/json',
    },
    queryParams: {
      __dynamic: false,
    },
  })
  // add specification
  .addScheme({
    name: 'petstore',
    specification: petstore,
  })
  .addScheme({
    name: 'users',
    specification: users,
    // if needed set specific mock server settings for scheme
    // optional
    server: {
      domain: 'https://1.1.1.1/some/path',
      headers: {
        Accept: 'application/json',
      },
      queryParams: {
        __dynamic: false,
      },
    },
  });

// creating native pathfinder component
const Pathfinder = createPathfinder(config, AsyncStorage);

export default function App() {
  const [environment, setEnvironment] = React.useState('dev');
  return (
    <Pathfinder
      initialEnvironment={environment}
      environments={['dev', 'prod']}
      onChangeEnvironment={setEnvironment}
      devMode
      autostartForDev
    >
    	<YourApp />
    </Pathfinder>
  );
}

Props

prop nametypedescription
initialEnvironmentstringInitial environments, should be static (required)
environmentsstring[]List of environments (required)
devModebooleanAllows you to output information for developers to the console
autostartForDevbooleanLaunches the pathfinder when the application is launched in dev mode

Toggle devtools with Deep Links

  • open - \<prefix>://pathfinder/open
  • close - \<prefix>://pathfinder/close

Tags

release - create release tag and increase version

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.3

11 months ago

0.1.5

2 years ago

0.1.1

2 years ago