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

Jump from the native page to the specified RN page #2974

Closed
liweijieok opened this issue Mar 30, 2018 · 3 comments
Closed

Jump from the native page to the specified RN page #2974

liweijieok opened this issue Mar 30, 2018 · 3 comments

Comments

@liweijieok
Copy link

Version

  • react-native-router-flux v4.0.0-beta.28
  • react-native v0.54.2

Expected behaviour

Hello,My requirement is to jump from the native page to the specified RN page(may not initial=true ).

Actual behaviour

I tried several ways, but I still couldn't fulfill my needs.

  1. Register multiple entries
//index.android.js
AppRegistry.registerComponent("FoundationHome", () => FoundationHome);
AppRegistry.registerComponent("FoundationPersonal", () => FoundationPersonal);
//Component
export class FoundationHome extends Component {
    static defaultProps = {
        entrance: "FoundationPage"
    };

    render() {
        return (
            <Provider store={store}>
                {FHRouters(this.props)}
            </Provider>
        );
    }
}

export class FoundationPersonal extends Component {
    static defaultProps = {
        entrance: "FoundationPage"
    };

    render() {
        return (
            <Provider store={store}>
                {FPRouters(this.props)}
            </Provider>
        );
    }
}

// MyRouter
export const FHRouters = (props) => {
    return (
        <Router
            getSceneStyle={() => {
                return styles.routerStyle;
            }}
        >
            <Lightbox>
                <Scene key={"root"}
                       header={null}
                >
                    <Scene key={"FoundationPage"} component={FoundationPage}
                           initial={true}{...props}/>
                    <Scene key={"PersonalDetailPage"} component={PersonalDetailPage}/>
                </Scene>

            </Lightbox>

        </Router>
    );
};

export const FPRouters = (props) => {
    return (
        <Router
            getSceneStyle={() => {
                return styles.routerStyle;
            }}
        >
            <Lightbox>
                <Scene key={"root"}
                       header={null}
                >
                    <Scene key={"PersonalDetailPage"} initial={true} component={PersonalDetailPage} {...props}
                    />
                    <Scene key={"FoundationPage"} component={FoundationPage}
                    />
                </Scene>

            </Lightbox>

        </Router>
    );
};

when id use

    ....
    Intent start = new Intent(mContext, FoundationReactActivity.class);//FoundationHome
    mContext.startActivity(start);

is the same page opened as below

 ...
 Intent start = new Intent(mContext, FoundationPersonalReactActivity.class); //FoundationPersonal
 mContext.startActivity(start);
  1. I use the same entrance(One Activity but not the same props)
export const FHRouters = (entrance) => {
    return (
        <Router
            getSceneStyle={() => {
                return styles.routerStyle;
            }}
        >
            <Lightbox>
                <Scene key={"root"}
                       header={null}
                >
                    <Scene key={"FoundationPage"} component={FoundationPage}
                           initial={entrance === "FoundationPage"} />
                    <Scene key={"PersonalDetailPage"} component={PersonalDetailPage}
                           initial={entrance === "PersonalDetailPage"}
                    />
                 
                </Scene>

            </Lightbox>

        </Router>
    );
};

But neither method works. it looks like the reason for the cache。Because I have two different parameters to open the specified page or the same page.

What should i do!

Thanks.

@asciifaceman
Copy link
Contributor

This is a little over my head, so sorry if this isn't helpful, but maybe? https://facebook.github.io/react-native/docs/communication-ios.html

@liweijieok
Copy link
Author

liweijieok commented Apr 3, 2018

@asciifaceman thank you for your advice, but it doesn't seem to work, the proplem is that i try to use double router to different page(purpose for native to RN page),but they opened the same page.It will display normal when I manually refresh by double R.

@liweijieok
Copy link
Author

I use ReactNative Navigation instead of RNRF to solve this problem.

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

2 participants