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

adding refs for navBar and footer #18

Closed
wants to merge 1 commit into from
Closed

adding refs for navBar and footer #18

wants to merge 1 commit into from

Conversation

FaridSafi
Copy link

This way we can access to the navbar from an action using : this.props.navigator.refs.navBar

This way we can access to the navbar from an action using : this.props.navigator.refs.navBar
@aksonov
Copy link
Owner

aksonov commented Oct 12, 2015

Still don't see how it could be accessed via name 'navBar'? Also why you need it?

@FaridSafi
Copy link
Author

Thank you for your answer.

By clicking on the "Next" button of the navbar, I want to retrieve the values of the switches of the page (see attached screenshot).
Since the navbar is created before the switches, I can not pass an onNext event containing the switches references when calling the action.

The only working way I found is to access this.props.navigator.refs.navBar inside the action.
Do you think I should use another way?

simulator screen shot 12 oct 2015 19 22 41

@aksonov
Copy link
Owner

aksonov commented Oct 12, 2015

Your idea doesn't follow flux principles. All UI layer should do is just calling actions, UI should not have any logic.
You should define actions for each field (or one action with array data value - list of boolean) and store which will listen them and change its state. "Next" will call some another action as well and that store will listen it and process it without problems - that store will have all values already, right?

@aksonov aksonov closed this Oct 12, 2015
@FaridSafi
Copy link
Author

Ok I understand now, thank you
I followed demo https://github.com/mrblueblue/react-native-alt-demo to store the values of the fields

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

Successfully merging this pull request may close these issues.

2 participants