Giter VIP home page Giter VIP logo

rndrawer-implemented-rnrouter's Introduction

Deprecated - This repo uses obsolete versions of react-native-router-flux and react-native-drawer. I update the repo for now. But I may not update on someday.
Recommendation - Try react-navigation module. It uses pure react-native components as much as possible.

rndrawer-implemented-rnrouter

An example for react-native-drawer and react-native-router-flux. The example has been developed by using react-native-drawer 1.X and react-native-router-flux 2.X. The new versions of the libraries are not stable yet (2016-04-24). You might try to contribute them! Both of them welcome the new PR.

With this scaffolding you can create side menu (drawer) and navigate between your screens (pages) easily.

For the sake of example the screens below have been created;

  • Login
  • Register
  • Home
  • Screen 1
  • Screen 2

The scenarios of the example;

  • The user opens the app
  • The user logins or registers
  • The user navigates the screens by using drawer menu
  • The user logs out

The example has been shaped like an Android app. Actually, it is an cross-platform app and you could give shape like an IOS app.

launch

Installation

Because of some breaking changes that've been made in React-Native in the past, some node_modules files must be changed with their originals.

iOS

  1. Run the command of react-native init reactNativeRouterFluxSample & cd reactNativeRouterFluxSample
  2. Then npm i --save [email protected] & npm i --save [email protected] & npm i --save [email protected]
  3. Then copy src folder and index.ios.js file of rndrawer-implemented-rnrouter into the new initiated project.
  4. Finally, official site says that; "Open ios/reactNativeRouterFluxSample.xcodeproj and hit run in Xcode".

Android

  1. Run the command of react-native init reactNativeRouterFluxSample & cd reactNativeRouterFluxSample
  2. Then npm i --save [email protected] & npm i --save [email protected] & npm i --save [email protected]
  3. Then copy src folder and index.android.js file of rndrawer-implemented-rnrouter into the new initiated project.
  4. Finally, run the command of react-native run-android & react-native start and then click to the Reload button on the red screen.

rndrawer-implemented-rnrouter's People

Contributors

efkan avatar salbito 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

Watchers

 avatar  avatar  avatar  avatar

rndrawer-implemented-rnrouter's Issues

Only one default export allowed per module

i run react-native run-android command then i got this error

/node_modules.@exponent/react-native-navigator/ExRouteRenderer.js: Only one default export allowed per module

How know what component is presented?

Im trying to add style bold the Drawer selected option.

But i dont know how can acces in "SideDrawerContent" to Navigator or how can obtain what component is presented in that moment

Can you help me?

Problem when click "Drawer" button.

Hi, i am developing my project with your template. I always run it on emulator and it run perfec. But now i try to run on real device (Android&iOS) and when i press button on drawer, it have a few secs of lag before new View load.

Maybe some dependencie version cause conflict with drawer or react-native-router-flux?

My dependencies:
"dependencies": {
"react": "^0.14.8",
"react-native": "^0.25.1",
"react-native-button": "^1.4.2",
"react-native-calendar-picker": "^2.4.0",
"react-native-datepicker": "^1.1.0",
"react-native-drawer": "^1.16.7",
"react-native-lightbox": "^0.5.1",
"react-native-router-flux": "^2.2.7",
"react-native-scrollable-tab-view": "^0.4.1",
"react-native-simple-radio-button": "^2.0.1",
"react-redux": "^4.4.0",
"redux": "^3.3.1",
"redux-thunk": "^2.0.1"
},
"devDependencies": {
"babel-eslint": "^4.1.8",
"eslint": "^1.10.3",
"eslint-plugin-react": "^3.16.1",
"eslint-plugin-react-native": "^0.5.0"
}

Thanks!

I can't do code run

Hi,

Your example is perfect for my project.

But i do:

  1. git clone (repo link)
  2. npm install (on project route)

And when i open ios project on Xcode and run:
captura de pantalla 2016-04-26 a las 18 18 32

Thanks!

Unhandled JS Exception: [react-native-router-flux] unique key should be defined

I am getting "[react-native-router-flux] unique key should be defined error." and in console "Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of Example.
[react-native-router-flux] unique key should be defined
Unhandled JS Exception: [react-native-router-flux] unique key should be defined "

I have followed exact below steps:
1.Run the command of react-native init reactNativeRouterFluxSample & cd reactNativeRouterFluxSample
2.Then npm i --save [email protected] & npm i --save [email protected] & npm i --save [email protected]
3.Then copy src folder and index.ios.js file of rndrawer-implemented-rnrouter into the new initiated project.
4.Finally, official site says that; "Open ios/reactNativeRouterFluxSample.xcodeproj and hit run in Xcode".

Below is the render method in Example.js

render() { return ( <Router name='root'> <Schema name='boot' sceneConfig={Navigator.SceneConfigs.FloatFromRight} hideNavBar type='replace' // When type='replace' is existing Actions.pop never work /> <Route name='Login' component={Login} schema='boot' initial title="Welcome"/> <Route name='Register' component={Register} hideNavBar title="Register Screen"/> <Route name='Drawer' hideNavBar type='reset'> <SideDrawer ref={c => { c ? this.drawer = c.drawer : this.drawer }}> {/*Nested Routes are used for to manage the navbar cases (Route[Home] \ Router \ Route[Home_] ) React-Native-Reouter-Flux actions use the route names.*/} <Router name='drawerRoot' sceneStyle={styles.routerScene} navigationBarStyle={styles.navBar} titleStyle={styles.navTitle}> <Schema name='home' sceneConfig={Navigator.SceneConfigs.FloatFromRight} hideNavBar={false} renderLeftButton={this.renderMenuButton}/> <Schema name='interior' sceneConfig={Navigator.SceneConfigs.FloatFromRight} hideNavBar={false} renderLeftButton={this.renderBackButton}/> <Route name='Home' component={ScreenHome} schema='home' title='Home'/> <Route name='Screen1' component={Screen1} schema='interior' title='Screen1'/> <Route name='Screen2' component={Screen2} schema='interior' title='Screen2'/> </Router> </SideDrawer> </Route> </Router> ); }

Failed to install the requested application

Hello,
I'm a react-native beginner and was trying to build the project to understand how the Side menu and Navigation work together in the app.
I downloaded the project
made npm install in the terminal
then when I tried to run on the iOS, I got error

** BUILD FAILED **


The following commands produced analyzer issues:
	Analyze RCTLocationObserver.m

(1 command with analyzer issues)

The following build commands failed:
	CompileC /Users/mohammedelgohary/Downloads/rndrawer-implemented-rnrouter-master\ 2/ios/build/Build/Intermediates/RCTSettings.build/Debug-iphonesimulator/RCTSettings.build/Objects-normal/x86_64/RCTSettingsManager.o RCTSettingsManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/reactNativeRouterFluxSample.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/reactNativeRouterFluxSample.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Help?

in the Drawer you did like this?
React.Children.map(
React.Children.map(this.props.children, c => React.cloneElement(c, {route:this.props.route})
)
can you explain why ?

Auto change screens using componentDidMount ?

Hi there,

May I know if it is possible to navigate without using
onPress ?

For example, in Login.js, we use render() this:
<Button onPress={Actions.Drawer}>Login</Button>
and that in order to go to the Drawer screen we need to
tap on the button

Is there a way to navigate to the Drawer screen when the Login screen loads?
For example navigate to Drawer programmatically via componentDidMount ?

Cheers.

Center NavBar Image on Android

Im trying to center navBar image. on iOS image render center perfect, but on android i cant do it.

My image code:

renderNavigatorTitleImage = () => {
        return (
            <View style={{
                flex: 1,
                alignItems: 'center',
                justifyContent: 'center',
            }}>
                <Image
                    source={require('./Resources/logo2.png')}
                    style={{ height: 30, width: 76}}
                    resizeMode="cover"
                />
            </View>
        )
    };

and in set on element, on "renderTitle" prop.

navBar style:

    navBar: {
        flex: 1,
        flexDirection: 'row',
        alignItems: 'center',
        backgroundColor: '#E12518',
    },

Image always appear on top left. I try to use Dimensions, etc but i cant set on the mid.
Some idea?

Undefined is not an object evaluating _this2.drawer.open

I tried to implement the drawer according to the example. In fact I copied the main bits exactly SideDrawer and SideDrawerContent.

The Router is also nearly the same as the example

            <SideDrawer 
              ref={c => { c ? this.drawer = c.drawer : this.drawer }}
            >
              <Router name="drawerRoot" hideNavBar={true} footer={TabBar} tabBarStyle={style.tabBar} navigationBarStyle={style.navigationBar}>
(some routes here)
              </Router>
            </SideDrawer>

but I keep getting an error of Undefined is not an object.

Connect with Redux

Hi, im trying to implement Redux on my project.

When i uncomment Redux Section, i comment line:
import { Router, Route, Schema, Actions, } from 'react-native-router-flux'

But terminal:

Could not find "store" in either the context or props of "Connect(Router)". Either wrap the root component in a , or explicitly pass "store" as a prop to "Connect(Router)".

Can you help me?

Override/finding taptoclose event outside drawer

Hi,

When user tap on outside drawer, drawer will closed with line of code "tapToClose={true}",
In the same time I need to trigger method here, because PFA screen shot as per screen shot I need to change back arrow button to menu button.

simulator screen shot 15-feb-2017 2 26 58 pm

Using image in title ?

Hi good day!

Firstly, AWESOME job with this example! Really solved major headaches!

I was just wondering if it is possible to use an image for the title?

For example:

<Route name='Home' component={ScreenHome} schema='home' title={this.renderLogo} />

and renderLogo looks like this:

renderLogo = () => { return ( <Image source={require('../images/icons/logo.png')} style={{height: 24, width: 24}} /> ) };

I've tried the above out, but on Home screen, I do not see any logo rendered. I did not receive any errors too.

I was wondering if you have any insights as to how to use images in titles?

Cheers and thanks again!

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.