GithubHelp home page GithubHelp logo

react-native-simple-router-community / react-native-simple-router Goto Github PK

View Code? Open in Web Editor NEW
269.0 15.0 56.0 331 KB

A community maintained router component for React Native

License: MIT License

JavaScript 100.00%
react-native react-router router navigation react-native-navigation react-navigation

react-native-simple-router's Introduction

React Native Simple Router

Awesome navigation for your React Native app.

NavBar Example

Install

Make sure that you are in your React Native project directory and run:

$ npm install react-native-simple-router --save

Usage

import Router from 'react-native-simple-router';

The basics:

import React from 'react';
import { StyleSheet } from 'react-native';

// The initial page
class HelloPage extends React.Component {

  render() {
    return <Text>Hello world!</Text>;
  }

}

const styles = StyleSheet.create({
  header: {
	backgroundColor: '#5cafec',
  },
});

// Your route object should contain at least:
// - The name of the route (which will become the navigation bar title)
// - The component object for the page to render
const firstRoute = {
  name: 'Welcome!',
  component: HelloPage,
};

// The Router wrapper
class MyApp extends React.Component {

  render() {
    return (
      <Router
        firstRoute={firstRoute}
        headerStyle={styles.header}
      />
    );
  }
}

AppRegistry.registerComponent('routerTest', () => MyApp);

Boom. That's it.

From the "Hello world!"-page you can then navigate further to a new component by calling this.props.toRoute(). Let's build upon the HelloPage component in our first example:

import React, { PropTypes } from 'react';
import { StyleSheet } from 'react-native';

const propTypes = {
  toRoute: PropTypes.func.isRequired,
};

class HelloPage extends React.Component {
  constructor(props) {
      super(props);

      this.nextPage = this.nextPage.bind(this);
  }

  nextPage() {
    this.props.toRoute({
      name: "A new screen",
      component: HelloPage
    });
  }

  render() {
    return (
      <View>
        <TouchableHighlight onPress={this.nextPage} underlayColor="transparent">
          <Text>Next page please!</Text>
        </TouchableHighlight>
      </View>
    );
  }
}

HelloPage.propTypes = propTypes;

export default HelloPage;

Now, when you click on "Next page please!", it will go to the next page (which in this case is still HelloPage but with a new title). Keep in mind that this.props.toRoute() needs to be called from one of the top-level routes, therefore, if your link is deeply nested within multiple components, you need to make sure that the action "bubbles up" until it reaches the parent route, which in turn calls this.props.toRoute().

Configurations

The <Router /> object used to initialize the navigation can take the following props:

  • firstRoute (required): A React class corresponding to the first page of your navigation
  • headerStyle: Apply a StyleSheet to the navigation bar. You'll probably want to change the backgroundColor for example.
  • titleStyle: Apply a StyleSheet to the navigation bar titles. Useful for changing the font or text color.
  • bgStyle Apply a StyleSheet to the background of all routes.
  • statusBarColor: Specify the string black if you want the statusbar to be dark in color, or leave unspecified for a light-content style. Refer to StatusBarIOS for details.
  • borderBottomWidth: Apply a bottom border to your navbar.
  • borderColor: Apply a border color to your bottom border.
  • backButtonComponent: By default, the navigation bar will display a simple "Back" text for the back button. To change this, you can specify your own backButton component (like in the Twitter app).
  • backButtonProps: If you set a backButtonComponent you can use this property to pass props to that component.
  • rightCorner: If you have the same occuring action buttons on the right side of your navigation bar (like the Twitter "Compose"-button), you can specify a component for that view.
  • customAction: A special callback prop for your action buttons (this can be handy for triggering a side menu for example). The action gets triggered from your custom leftCorner or rightCorner components by calling this.props.customAction("someActionName") from them. It is then picked up like this: <Router customAction={this.doSomething} />.
  • hideNavigationBar: Hide the navigation bar, always
  • handleBackAndroid (Boolean value): Apply a listener to the native back button on Android. On click, it will go to the previous route until it reach the first scene, then it will exit the app.
  • statusBarProps: Default StatusBar props, please refer to StatusBar Docs. (Android) If backgroundColor isn't provided, it will take the same color as defined in headerStyle.
  • sceneConfig: Default animation to be used in case no sceneConfig is provided by the toRoute function. More details and possible parameters are in the toRoute documentation below. Defaults to Navigator.SceneConfigs.FloatFromRight.

The this.props.toRoute() callback prop takes one parameter (a JavaScript object) which can have the following keys:

  • name: The name of your route, which will be shown as the title of the navigation bar unless it is changed.
  • component (required): The React class corresponding to the view you want to render.
  • leftCorner: Specify a component to render on the left side of the navigation bar (like the "Add people"-button on the first page of the Twitter app)
  • rightCorner: Specify a component to render on the right side of the navigation bar
  • titleComponent: Specify a component to replace the title. This could for example be your logo (as in the first page of the Instagram app)
  • headerStyle: Change the style of your header for the new route. You could for example specify a new backgroundColor and the router will automatically make a nice transition from one color to the other!
  • titleStyle: Apply a StyleSheet to the navigation bar titles. Useful for changing the font or text color.
  • passProps: Takes in an object. Passes each key: value pair to your component as a prop. i.e.
  • trans: If set to a truthy value it will make the navbar transparent and move your component content so that it sits behind the nav.
  • noStatusBar: If hiding the navigationbar using hideNavigationBar you must set this option to true to not reserve the space on the top of the UI
  • hideNavigationBar: If set to a truthy value will hide the navigationbar out of view, and move the component so that it is at the top of the screen.
  • leftCornerProps: If you set a leftCorner component you can use this property to pass props to that component.
  • rightCornerProps: If you set a rightCorner component you can use this property to pass props to that component.
  • titleProps: If you set a titleComponent you can use this property to pass props to that component.
  • sceneConfig: Control the animation of the route being switched. Possible values are:
    • Navigator.SceneConfigs.FadeAndroid
    • Navigator.SceneConfigs.FloatFromBottom
    • Navigator.SceneConfigs.FloatFromBottomAndroid
    • Navigator.SceneConfigs.FloatFromLeft
    • Navigator.SceneConfigs.FloatFromRight
    • Navigator.SceneConfigs.HorizontalSwipeJump
    • Navigator.SceneConfigs.PushFromLeft
    • Navigator.SceneConfigs.PushFromRight
    • Navigator.SceneConfigs.VerticalDownSwipeJump
    • Navigator.SceneConfigs.VerticalUpSwipeJump
  • statusBarProps: Route specific StatusBar props, it will override statusBarProps defined in Router, please refer to StatusBar Docs.
  • custom data: you may provide the route with additional data.
      goToTweet(tweetData) {
        this.props.toRoute({
          name: 'Tweet',
          component: TweetPage,
          data: tweetData,
        });
      }
    
      // in component TweetPage
        const {
          text,
          user,
        } = this.props.data;  

The this.props.replaceRoute function takes in an object that can contain the same keys as toRoute(). The difference is that instead of adding a route to your stack, it replaces the route that you're on with the new route that you pass it.

  • This is useful for login or signup screens. If you don't want your user to be able to navigate back to it, then use replaceRoute() rather than toRoute().

The this.props.resetToRoute function takes in an object that can contain the same keys as toRoute(). The difference is that instead of adding a route to your stack, it replaces the route that you're on with the new route that you pass it, and empties the navigation stack as well.

  • This is useful for going to an application after a login or signup screens. If you don't want your user to be able to navigate back to it, then use resetToRoute() rather than replaceRoute().

The this.props.popToRoute function takes in an object that can contain the same keys as toRoute(). The difference is that instead of adding a route to your stack, it pop all routes until the desired one.

The this.props.getCurrentRoutes() returns the current list of routes (same as ReactNative Navigator getCurrentRoutes(0) ). This can be used as an argument for popToRoute().

The functions this.props.setRightProps, this.props.setLeftProps and this.props.setTitleProps take in an object of props and sends that to your navbar's RightComponent, LeftComponent or TitleComponent, respectively.

  • This allows you to talk directly to your navbar, because previously you could only talk to it when navigating forward or backward.

As of 0.7.0 the router acts as a relay for events emitted by the navigator, and extends these to the following list:

  • willFocus: Emitted when a route will focus. Emits route object.
  • didFocus: Emitted when a route did focus. Emits route object.
  • willPop: Emitted when a route stack will be popped. Triggered by Navigator.pop();
  • didPop: Emitted when a route stack did pop. Triggered by Navigator.pop();
  • willPush: Emitted when a new route will be pushed to the route stack. Emits the new route object. Triggered by Navigator.push(route);
  • didPush: Emitted when a new route has been pushed to the route stack. Emits the new route object. Triggered by Navigator.push(route);
  • willResetTo: Emitted when the route stack will be reset to a given route. Emits the route object. Triggered by Navigator.resetTo(route);
  • didResetTo: Emitted when the route stack has been reset to a given route. Emits the route object. Triggered by Navigator.resetTo(route);
  • willReplace: Emitted when a route will replace the current one in the route stack. Emits the new route object. Triggered by Navigator.reset(route);
  • didReplace: Emitted when a route has replaced the current one in the route stack. Emits the new route object. Triggered by Navigator.reset(route);
  • willPopToTop: Emitted when the route stack will be popped to the top. Triggered by Navigator.popToTop();
  • didPopToTop: Emitted when the route stack has been popped to the top. Triggered by Navigator.popToTop();
  • willPopToRoute: Emitted when the route stack will be popped to the route. Triggered by Navigator.popToRoute(route);
  • didPopToRoute: Emitted when the route stack has been popped to the route. Triggered by Navigator.popToRoute(route);

You can listen to these events by adding an event listener as such:

  this.props.routeEmitter.addListener('didFocus', (route) => {
      console.log(route.name, 'didFocus');
  });

As of v0.8.0 the leftCorner, rightCorner and titleComponent have access to the following router functions :

  • toRoute(route)
  • toBack()
  • replaceRoute(route)
  • resetToRoute(route)
  • goToFirstRoute()
  • popToRoute(route)

Examples

Explorer app

To see available features in action, you can check out the Explorer app.

Clone this repo or go inside node_modules/react-native-simple-router folder and install dependencies, after that you will able to launch this as an standalone react-native application.

cd examples/Explorer
npm install

Twitter app

To see more of the router in action, you can check out the Twitter example app that comes with the package.

Test the app by requiring the TwitterApp component:

import { AppRegistry } from 'react-native';
import TwitterApp from './node_modules/react-native-simple-router/examples/twitter-example';

AppRegistry.registerComponent('routerTest', () => TwitterApp);

react-native-simple-router's People

Contributors

alexgustafsson avatar anhldbk avatar annotis avatar asafbrieferydev avatar bigpun86 avatar charpeni avatar cpjolicoeur avatar davidleonardi avatar ericraio avatar hallucinogen avatar jackpu avatar johannhof avatar jpiv avatar jrapala avatar leolebras avatar maluramichael avatar markfranco avatar mikaelcarpenter avatar olegas avatar t4t5 avatar webwelten avatar zachgibb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-simple-router's Issues

Convert to ES6 style

  • Convert README.md to ES6
  • Convert index.js and ./components to ES6
  • Convert ./twitter-example to ES6
  • Add PropTypes to index.js and ./components

Refer to coding style as defined in #1.

NavBar components missing on the initial render

When I open my app or the twitter-example provided by you the navigation bar is empty until the route is changed and after that everything works just like expected.
img_1373

Do you have any idea what could cause this?

Back button style via prop

I would like to be able to apply a style to the back button component by giving a style object. Exactly like you can do with titleStyle. Something like adding a backStyle prop perhaps.

Thoughts on this?

Broken release

Line 49/50 throwing function not found:

this.onDidFocus = this.onDidFocus.bind(this);
this.onWillFocus = this.onWillFocus.bind(this);

Can this be fixed quickly?

Use Route ID Instead of Name

It would be nice to use an ID instead of name to identify routes. In some cases, you'd want to use the same title for multiple routes. When observing the routeEmitter, you only get the name (aka user-friendly title), so you don't know which route was triggered.

For now, I'm using the titleComponent and titleProps to separate the name from visible title. It works, but it's extra cruft.

Going back by swiping. Make the area to start swiping bigger.

Hi there!

untitled-1

I'm gonna try to explain it with an image.

Now, when I want to go back in my app with react-native-simple-router by swiping, the area where I have to start swiping is really small (light blue in the image). What I'd like to do is to make this area bigger (light blue + dark blue in the image) to be able to start swiping easily.

I don't know if it is possible.

Thanks!

sceneConfig with swipe, animation

I set sceneConfig with Navigator.SceneConfigs.VerticalUpSwipeJump.

in this situation, route to back action is not make sense.

If I swipe left to right, but view is up to down.

pass data page to navigator.

I take a look around twitter-example.
I try to edit something more,
TweetBig component has data. but I want to pass data edititem component (right upper side pencil).
How do I this?
additionally, If I new tweet form. fill the form and touch right upperside submit icon. how can I deliver form data to submit icon component?

Detail

Cant Hide NAV bar on first page and make it visible on second page

The First page we are gone Route to needs to use <Router /> and the documenation indicates that if we use hideNavigationBar: it Hides the navigation bar, always ; What this means is if we hide it on <Router /> we can never get it back .

Lets assume a use case where this way of doing things can make life very hard:

Splash page with a button that says Register and Signin; we don't want to show a Navbar on the splash page rather we want a picture to fill our view => (user Clikcs Register) => we route the user to Registeration page but we also want the NavBar to be Visible with a backButton so that if the user wants to go to the splash page and click on Signin incase he remembers he had an account.

I have tried a lot of ways but with no luck; i believe this is a very common use case and we should be able to do it with this router.

React.createElement: type should not be null, undefined, boolean, or number.

After updating from 0.6.0 to the latest 0.7.2; i am getting the following error's and the error is occurring when i return Router from my render method. i.e.

render(){
            return (<Router firstRoute={firstRoute} backButtonComponent={BackButton}/>);
            }

Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of projectName.

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of projectName.

Unhandled JS Exception: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of projectName.reactConsoleError @ ExceptionsManager.js:76console.error @ YellowBox.js:49logIfNoNativeHook @ RCTLog.js:38__callFunction @ MessageQueue.js:183(anonymous function) @ MessageQueue.js:87guard @ MessageQueue.js:41callFunctionReturnFlushedQueue @ MessageQueue.js:86onmessage @ debuggerWorker.js:39

onWillFocus & onDidFocus has been deprecated

onWillFocus supplied to Navigator has been deprecated. Use navigationContext.addListener('willfocus', callback) instead.

onDidFocus supplied to Navigator has been deprecated. Use navigationContext.addListener('didfocus', callback) instead.

Can be related to #15.

How to pass parameters to customAction callback methods

customAction: A special callback prop for your action buttons (this can be handy for triggering a side menu for example). The action gets triggered from your custom leftCorner or rightCorner components by calling this.props.customAction("someActionName") from them. It is then picked up like this: <Router customAction={this.doSomething} />.

thats the documentation it is not mentioned any where how to pass parameters; can we pass parameters ?

is titleProps working for anyone ?

is titleProps working for anyone ?
i am assuming titleProps is working like passProps;
this is my sample code:

this.props.toRoute({titleComponent:titlecomp,titleProps:{title:"test"},headerStyle:{backgroundColor:'#299CCA'},hideNavigationBar:false,trans:false,noStatusBar:false,component:require('./ContactDetail'),passProps:{data:rowData,callBack:this.deleteContact.bind(this),token:this.props.data.Token }});

and is this how we are suppose to access it from within our TitleComponent right ?

this.props.title or this.props.titleProps.title ; i am using the first one.

How can i pop back the route?

Hey there!

I was wondering how to just pop back a route like the title says. Is it possible to use React.Navigator.pop() or something? In my app this module is just fabulous, but i coudn´t figure out how to jump...

Can't 'resetToRoute' from leftCorner component passing the same leftCorner button

I have a project pretty much similar to the Twitter example. It is a ListView that has a button assigned to its leftCorner which takes you to a filter view. When you select the filters you want and apply them, you should be taken back to the ListView, with the filters applied.

I have tried to resetToRoute (passing the filter info with passProps, but when I specify the same leftCorner, I get:

Invariant Violation: Element type is invalid: expected a string 
(for built-in components) or a class/function (for composite 
components) but got: object. Check the render method of ``Navigator`

If I don't specify the leftCorner, I get taken to the ListView but the filter button disappears. I have also tried toBack method, but no porps can be passed with it (I think it would be cool).

Here is my code, and in the last file I specify the line in which the error is thrown.

index.android.js

var HomeView = require('./app/views/HomeView');
var FilterButton = require('./app/ui/buttons/Filters');

var startView = {
  name: 'Home',
  component: HomeView,
  leftCorner: FilterButton,
}

var MyApp = React.createClass({
  render: function() {
    return (
        <Router 
          firstRoute={startView}
          headerStyle={styles.header}
          backButtonComponent={BackButton}
          handleBackAndroid={true}
        />
    );
  }
});

AppRegistry.registerComponent('MyApp', () => MyApp);

Filters.js

var React = require('react-native');
var FilterView = require('../../views/FiltersView');

var Filters = React.createClass({
  goToFilterPage: function() {
    this.props.toRoute({
      name: "Filtros",
      component: FilterView
    });
  },
  render() {
    return (
      <TouchableHighlight underlayColor="transparent" onPress={this.goToFilterPage}>
        <Image source={Globals.Images.filtro} style={styles.icon} />
      </TouchableHighlight>
    )
  }
});
module.exports = Filters;

FiltersView.js

var React = require('react-native');
var FilterButton = require('./../ui/buttons/Filters');  <--- This is the line that throws the error
var HomeView = require('./app/views/HomeView');

var FiltersView = React.createClass({
  _applyFilters: function() {
    var filters = this.state.filters;
    this.props.resetToRoute({
      name: "Home",
      component: HomeView,
      leftCorner: FilterButton,
      passProps: {filters:filters}
    });
  },
  render() {
    (...)
  }
});

module.exports = FiltersView;

Improve documentation for 0.10.0 !

Dear community of users,

We would like to ask for your help and contribute to better documentation for this module.

More examples, better description of features, and making sure that everything is described with an example is what we are aiming for.

If you feel like contributing, please create a PR.
Thank you!

Wrap Drawer around Router

Hey there. I am trying to wrap the react-native-side-menu component around the Router, so it is on top and not under the navBar. I really can´t figure out where the right place is to put it and especially how to pass the Router props down/up to the SideMenu Routes. This was my try:

class App extends Component {
  render() {
    return (
        <SideMenu
            menu={<Components.Menu/>}
            isOpen={false}
        >
            <Router
                firstRoute={{
                    name: 'LOGIN',
                    component: Login
                }}
                headerStyle={{
                    backgroundColor: 'black',
                    elevation: 5
                }}
                backButtonComponent={ Components.BackButton }
            />
        </SideMenu>
    );
  }
}

Now how can i pass toRoute props to Components.Menu?

Cannot call "this.props.toRoute" in titleComponent

Hi,

I'm writing an application that need to navigate to other page from titleComponent in the router (actually it is a searchBar). But I cannot call "this.props.toRoute" in this component. This function is called successfully in leftCorner but is undefined in titleComponent.

So what can I do to call toRoute function in titleComponent?

The code of searchBar

 var SearchBar = React.createClass({
     searchLetters: function (text) {
         console.log(text);
         this.props.toRoute({
             name: "Result for: " + text,
             component: SearchPage,
             passProps: { strSearch: text }
         });
     },
     render() {
         return (
             <TextInput
                 style={styles.input} placeholder="Search letters.."
                 placeholderTextColor="rgba(255, 255, 255, 0.5)"
                 returnKeyType="search"
                 enablesReturnKeyAutomatically={true}
                 onEndEditing={ event => this.searchLetters(event.nativeEvent.text) }
             />
         )
     }
 });

The index code

 var firstRoute = {
   name: 'Letters',
   component: SearchPage,
   titleComponent: SearchBar,
   passProps: { strSearch: '' }
 };

 var Letters = React.createClass({
   render() {
     return (
         <Router firstRoute={firstRoute} headerStyle={ styles.routerHeader } />
     );
   }
 });

Thank you!

Unable to install using NPM 3

Hi I am unable to install using npm

First I got this error while installing
[email protected] requires a peer of fbemitter@^2.0.0 but none was installed.

Then I installed fbemitter (I am not sure if that is correct)

After that I got below error while running the app

Unable to resolve module fbemitter from /Users/.....

Please help

On Android NavBar height looks more

IOS it is fine, because the device battery,wifi etc.. displayed.

But On Android it looks odd. I try to set height for header but that is hiding the title. Not sure what is the better way to do this. Please help.

Unit Testing

How should we handling unit testing this project? Should we include this as apart of the definition of done?

Question: Tab bar implementation

I'm not quite sure how I should implement a tab bar to allow navigation between a small group of routes.

Should I achieve this by nesting a Router inside of the main router? So I'll have a single tab-router route, which loads my tab-bar + router component. Or is there a better way of doing this?

Replace route from right component

Hi,

is it possible to replace a route from the right component?
I want to use a "Logout" button component which redirects to the Login screen after
unset the credentials. But I get a Exception if I try to use this.props.resetToRoute.
this.props.toRoute works .. But I dont't want to see a "back" button.

Unhandled JS Exception: this.props.resetToRoute is not a function. (In 'this.props.resetToRoute({
name:'Login',
component:_Login2.default})'

Thank you!

NavigationBar transition when swipeback

Is there any way to do the native transition(fadeIn, fadeOut) for navigation bar when swipe back. The current behaviour is to replace to title when entering the view, but when swipe back action stays in the middle, the title isn't changing as native does.

Navigation bar missing

There's no navigation bar at the top of the screen. Code below:

import React, {
  AppRegistry,
  Component,
  StyleSheet,
  Text,
  TouchableHighlight,
  View
} from 'react-native';
import Router from 'react-native-simple-router';

class HelloPage extends Component {
  render() {
    return <View>
      <Text>Hello</Text>
    </View>
  }
}

let firstRoute = {
  name: 'Welcome!',
  component: HelloPage
};

class RouterTest extends Component {
  render() {
    return <Router firstRoute={firstRoute} />
  }
}

AppRegistry.registerComponent('RouterTest', () => RouterTest);

More informative error messages

Hey guys, thanks so much for maintaining this library! Filing this as a note (who knows I'll probably implement it later).

Just did a code refactor so that it's in different ES6 modules. Used the wrong import syntax, so one of my components was undefined. Got an unhelpful error message like so:

Imgur

Would help to know that the component property was undefined.

Go forward by swipe left

Hi there!

I'm trying to load a different view (sending properties as id) by swipe from right to left

Before achieve this by swipe, I'm trying to load this view with a simple button, but neither I'm be able to do it :/

I got this index.js

...

var Story = require('./story');

...

goToIndividualStory: function(id){
    this.props.toRoute({
      name: "Story",
      component: Story,
      passProps: { id: id, toRoute: this.props.toRoute },
    });
  },

...

And then, in story.js is where I'd like to go to another view:

...

var Part = require('./part');

...

goToPart: function(id){
    this.props.toRoute({
      name: "Part",
      component: Part,
      passProps: { id: id },
    });
  },

...

Edit: I also have this to fire the goToPart function:

...

<TouchableHighlight onPress={ this.goToPart.bind(this, story.next_part) } underlayColor="transparent">
    <Text style={ styles.storyFooterPart }>#24</Text>
</TouchableHighlight>

...

I feel like I'm missing something, but I've tried with a lot of different code and I don't achieve it.

I hope you guys can help me out with this.

Thank you :)

Issue with Modules in Webpack / Object Is Not Extensible

Hey everyone!

Trying to use this and I'm wondering if I'm doing something wrong. Here is the error I'm getting.

ERROR in ./~/react-native-simple-router/index.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./styles in /Users/NOT_MY_NAME/Workspace/React/react-native-kit/node_modules/react-native-simple-router
 @ ./~/react-native-simple-router/index.js 23:14-33

I took a look at Index.js and there is style.ios.js and style.android.js but it is only requesting ./styles. Is webpack suppose to figure out if we need ios or android? If so, how do I go about fixing that?

EDIT:
After just hardcoding ios to the styles (will change if answer shows) I begin to get this error, wondered what this meant...

Cannot define property:__navigatorRouteID, object is not extensible.
getRouteID
Navigator.js @ 79:0 // core Navigator class in react native, is this a react native issue?

Update:
Reinstalled, not getting that error with the navigator anymore, but the .ios .android issue is still a thing. Any information on that would be awesome, I cannot seem to figure out why or a solution to it. If anyone needs code of my webpack setup, please let me know.

Configurable width for the navbar title and corner button.

In my app I use not only icons, but also text for the corner buttons and something interesting happens. Here's a screenshot:
screenshot 2016-02-21 15 07 29

The title overlays the corner button. From my understanding that's because the title container has flex: 6 (here) the corners have flex: 1 (here). If, for example, I set the corner flex to 2 everything works as I want.
Could it be possible to make these rules configurable?

Thank you very much for the great work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.