Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't wrap Scene or ConnectedRouter in a View #2106

Closed
isAlmogK opened this issue Jul 25, 2017 · 5 comments
Closed

Can't wrap Scene or ConnectedRouter in a View #2106

isAlmogK opened this issue Jul 25, 2017 · 5 comments

Comments

@isAlmogK
Copy link

Using the latest version. I would like to wrap my entire scenes/routing in a view component so I can load other components like an error or alert message component but this can't be done once you I add the view routing is not loading correctly.

<Provider store={store}>
                <ConnectedRouter>
                    <Scene key="root" hideNavBar hideTabBar>
                        <Scene key="public">
                            <Scene key="login" component={Login} initial={true} title={'Login'} />
                            <Scene key="ResetPassword" component={ResetPassword} title={'Reset Password'} />
                        </Scene>
                        <Scene key="tabBar" tabs lazy>
                            <Scene key="tab1" title="Home" tabBarLabel="Home" icon={HomeTabIcon}>
                                <Scene key='Home' component={Home} title='Home' initial={true}  panHandlers={null}/>
                                <Scene key='Teams' component={Teams} title='Teams' initial={false} />
                            </Scene>
                            <Scene key="tab2" title="Photos" tabBarLabel="Photos" icon={PhotosTabIcon}>
                                <Scene key='Photos' component={Photos} title='Photos' back backTitle='Back' initial={false} />
                                <Scene key='SinglePhoto' component={SinglePhoto} title='' back backTitle='Back' initial={false} />
                            </Scene>
                            <Scene key="tab3" title="Site Diary" tabBarLabel="Site Diary" icon={SiteDiaryTabIcon}>
                                <Scene key='SiteDiary' component={SiteDiary} title='SiteDiary' initial={false} />
                            </Scene>
                        </Scene>
                    </Scene>
                </ConnectedRouter>
            </Provider>
@isAlmogK
Copy link
Author

Closing this just need to make sure the view had a container style

@badaz
Copy link

badaz commented Jul 30, 2017

I've got the same pb, what was your solution ? which view should have a containerStyle ?

@isAlmogK
Copy link
Author

@badaz I did the following

render() {
        return (
            <View style={styles.container}>
                <Provider store={store}>
                    <ConnectedRouter>
                        <Scene key="root" hideNavBar hideTabBar>
                            <Scene key="public">
                                <Scene key="login" component={Login} initial={true} title={'Login'} />
                                <Scene key="ResetPassword" component={ResetPassword} title={'Reset Password'} />
                            </Scene>
                            <Scene key="tabBar" tabs lazy>
                                <Scene key="tab1" title="Home" tabBarLabel="Home" icon={HomeTabIcon}>
                                    <Scene key='Home' component={Home} title='Home' initial={true}  panHandlers={null}/>
                                    <Scene key='Teams' component={Teams} title='Teams' initial={false} />
                                </Scene>
                                <Scene key="tab2" title="Photos" tabBarLabel="Photos" icon={PhotosTabIcon}>
                                    <Scene key='Photos' component={Photos} title='Photos' back backTitle='Back' initial={false} />
                                    <Scene key='SinglePhoto' component={SinglePhoto} title='' back backTitle='Back' initial={false} />
                                </Scene>
                                <Scene key="tab3" title="Site Diary" tabBarLabel="Site Diary" icon={SiteDiaryTabIcon}>
                                    <Scene key='SiteDiary' component={SiteDiary} title='SiteDiary' initial={false} />
                                </Scene>
                            </Scene>
                        </Scene>
                    </ConnectedRouter>
                </Provider>
                <MessageBar/>
            </View>
        );
    }
const styles = StyleSheet.create({
    container: {
        padding: 0,
        flex: 1,
        flexDirection: 'column'
    },
})

You need the container style

@badaz
Copy link

badaz commented Jul 31, 2017

OK, thanks, definitely not the problem I had. What my problem was is that when migrating from v3 to 4 I hadn't realized that: 1 - the way to connect the router to redux had changed, 2 - the actions sent by the router had changed too.

@aksonov
Copy link
Owner

aksonov commented Jul 31, 2017

Check latest master, it has full redux support now (v3 didn't have it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants