Skip to content

haxe-react/react-native-navigation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

react-native-navigation

Haxe externs for wix's react-native-navigation v2

react-native-navigation v1 is not supported by this lib, please PR on a v1 branch if needed.

Installation

Install the haxelib:

haxelib git https://github.com/haxe-react/react-native-navigation.git

Add this option to you .hxml file(s):

-lib react-native-navigation

Usage

import react.native.navigation.Navigation;

// register your screens
Navigation.registerComponent('myapp.Login', function(){ return myapp.screen.Login; });
// or with redux
Navigation.registerComponentWithRedux('myapp.Home', function(){ return myapp.screen.Home; }, Provider, store);

// ...

// launch the app
Navigation.events().registerAppLaunchedListener(
    function(){
        Navigation.setRoot(
            {
                root: {
                    stack: {
                        children: [
                            {
                                component: {
                                    name: 'myapp.Login',
                                    options: {
                                        topBar: { visible: false }
                                    }
                                }
                            }
                        ],
                        options: {
                            layout: { orientation: [Portrait] },
                        }
                    }
                }
            }
        );
        reactnative.splashscreen.SplashScreen.hide();
    }
);

// ...

// then in your screen components, do:
Navigation.push(
    props.componentId,
    {
        component: {
            name: 'myapp.Home',
            passProps: { username: 'Thomas' },
            options: {
                topBar: {
                    title: { text: 'Welcome Thomas!' },
                }
            }
        }
    }
);

Platforms specific

Android and iOS specific options are enabled with the -D android and -D ios compilation flags (in you .hxml file(s)).

About

Haxe externs for wix's react-native-navigation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •