Get state from multi screen to one screen?How to get the browser to navigate to URL in JavaScriptResetting the navigation stack for the home screen (React Navigation and React Native)react native navigator:Undefined is not an object(evaluating this.props.navigation.navigate)React Native navigation - undefined is not an objectReact Navigation: 'navigation.state.params' is always undefined in 'static navigationOptions'Navigate to another screen from Flat list item getting pressedNot able to navigate to other page in react nativeModalFilterPicker load more on scrollnavigate from another screen on click navigationDrawerLayout menuUnable to pass params successfully to another .js file/screen
Would an object shot from earth fall into the sun?
Population of post-Soviet states. Why decreasing?
Convert a string of digits from words to an integer
Whaling ship logistics
what organs or modifications would be needed to have hairy fish?
What in my code changed between MacTeX 2017 and MacTex 2019?
I transpose the source code, you transpose the input!
Installation of ImageMagick software fails with "configure: error: libltdl is required"
What are examples of EU policies that are beneficial for one EU country, disadvantagious for another?
String whitespaces
Another student has been assigned the same MSc thesis as mine (and already defended)
How to prevent pickpocketing in busy bars?
Are fuzzy sets appreciated by OR community?
Assembly of PCBs containing a mix of SMT and thru-hole parts?
Why is a road bike faster than a city bike with the same effort? How much faster it can be?
Is population size a parameter, or sample size a statistic?
Top off gas with old oil, is that bad?
Does variance make sense in a fully immutable language?
Why does Captain Marvel in the MCU not have her sash?
How do we know neutrons have no charge?
I reverse the source code, you reverse the input!
Is there no "respectively" in german language when listing (enumerating) something?
What would influence an alien race to map their planet in a way other than the traditional map of the Earth
What happens to a net with the Returning Weapon artificer infusion after it hits?
Get state from multi screen to one screen?
How to get the browser to navigate to URL in JavaScriptResetting the navigation stack for the home screen (React Navigation and React Native)react native navigator:Undefined is not an object(evaluating this.props.navigation.navigate)React Native navigation - undefined is not an objectReact Navigation: 'navigation.state.params' is always undefined in 'static navigationOptions'Navigate to another screen from Flat list item getting pressedNot able to navigate to other page in react nativeModalFilterPicker load more on scrollnavigate from another screen on click navigationDrawerLayout menuUnable to pass params successfully to another .js file/screen
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm quite new with React native. I want to set information include Add, Edit and Show detail on one screen, so I set state for each event when it's called.
When adding, I set isAdding, when editing, I set isEditing and when show details I set isShowDetail and navigate them, like this.
Screen A:
this.props.navigation.navigate(ROUTE_INVOICE_DETAIL_NAME, invoice, isEditing: true );
and Screen B (Details):
constructor(props) {
super(props);
this.isShowDetail = props.navigation.getParam("isShowDetail");
console.log(this.isShowDetail);
this.isAdding = props.navigation.getParam("isAdding")
this.isEditing = props.navigation.getParam("isEditing");
const params = = this.props.navigation.state;
const invoice = = params;
const paid = 0, incurred = 0, transportFee = 0, id = invoice;
this.state =
id,
invoice,
isShowTicketDetail: false,
customer: ,
paid,
incurred,
transportFee,
details: ,
;
I don't know how to get isEditing and isAdding value, it returns undefined.
ROUTE_INVOICE_DETAIL_NAME is declared and I'm sure that it goes to Detail.
react-native navigation
add a comment
|
I'm quite new with React native. I want to set information include Add, Edit and Show detail on one screen, so I set state for each event when it's called.
When adding, I set isAdding, when editing, I set isEditing and when show details I set isShowDetail and navigate them, like this.
Screen A:
this.props.navigation.navigate(ROUTE_INVOICE_DETAIL_NAME, invoice, isEditing: true );
and Screen B (Details):
constructor(props) {
super(props);
this.isShowDetail = props.navigation.getParam("isShowDetail");
console.log(this.isShowDetail);
this.isAdding = props.navigation.getParam("isAdding")
this.isEditing = props.navigation.getParam("isEditing");
const params = = this.props.navigation.state;
const invoice = = params;
const paid = 0, incurred = 0, transportFee = 0, id = invoice;
this.state =
id,
invoice,
isShowTicketDetail: false,
customer: ,
paid,
incurred,
transportFee,
details: ,
;
I don't know how to get isEditing and isAdding value, it returns undefined.
ROUTE_INVOICE_DETAIL_NAME is declared and I'm sure that it goes to Detail.
react-native navigation
It looks like you're using react-navigation? I'd expect props.navigation.getParam("isEditing") to get you what you want. The getParam method is a helper, and you can also see all navigation params from props.navigation.state.params -- you might try to console.log(props.navigation.state.params) and see if what you expect is there.
– Michael Marvick
Mar 28 at 18:37
Also, this is a style detail for you: But it looks like you sometimes setisEditing, sometimes setisAdding, and sometimes setisShowDetail. It wouldn't ever make sense for none of these to be set, and it wouldn't ever make sense for two or three of them to be set. I'd probably have a string param calledmodeor something, and set it toSHOW_DETAIL,CREATE, andEDIT. Then you don't need to check 3 different booleans, but can just check for 3 different cases of the one field.
– Michael Marvick
Mar 28 at 18:39
add a comment
|
I'm quite new with React native. I want to set information include Add, Edit and Show detail on one screen, so I set state for each event when it's called.
When adding, I set isAdding, when editing, I set isEditing and when show details I set isShowDetail and navigate them, like this.
Screen A:
this.props.navigation.navigate(ROUTE_INVOICE_DETAIL_NAME, invoice, isEditing: true );
and Screen B (Details):
constructor(props) {
super(props);
this.isShowDetail = props.navigation.getParam("isShowDetail");
console.log(this.isShowDetail);
this.isAdding = props.navigation.getParam("isAdding")
this.isEditing = props.navigation.getParam("isEditing");
const params = = this.props.navigation.state;
const invoice = = params;
const paid = 0, incurred = 0, transportFee = 0, id = invoice;
this.state =
id,
invoice,
isShowTicketDetail: false,
customer: ,
paid,
incurred,
transportFee,
details: ,
;
I don't know how to get isEditing and isAdding value, it returns undefined.
ROUTE_INVOICE_DETAIL_NAME is declared and I'm sure that it goes to Detail.
react-native navigation
I'm quite new with React native. I want to set information include Add, Edit and Show detail on one screen, so I set state for each event when it's called.
When adding, I set isAdding, when editing, I set isEditing and when show details I set isShowDetail and navigate them, like this.
Screen A:
this.props.navigation.navigate(ROUTE_INVOICE_DETAIL_NAME, invoice, isEditing: true );
and Screen B (Details):
constructor(props) {
super(props);
this.isShowDetail = props.navigation.getParam("isShowDetail");
console.log(this.isShowDetail);
this.isAdding = props.navigation.getParam("isAdding")
this.isEditing = props.navigation.getParam("isEditing");
const params = = this.props.navigation.state;
const invoice = = params;
const paid = 0, incurred = 0, transportFee = 0, id = invoice;
this.state =
id,
invoice,
isShowTicketDetail: false,
customer: ,
paid,
incurred,
transportFee,
details: ,
;
I don't know how to get isEditing and isAdding value, it returns undefined.
ROUTE_INVOICE_DETAIL_NAME is declared and I'm sure that it goes to Detail.
react-native navigation
react-native navigation
edited Mar 30 at 16:40
halfer
15.3k7 gold badges63 silver badges129 bronze badges
15.3k7 gold badges63 silver badges129 bronze badges
asked Mar 28 at 18:26
Huệ VũHuệ Vũ
115 bronze badges
115 bronze badges
It looks like you're using react-navigation? I'd expect props.navigation.getParam("isEditing") to get you what you want. The getParam method is a helper, and you can also see all navigation params from props.navigation.state.params -- you might try to console.log(props.navigation.state.params) and see if what you expect is there.
– Michael Marvick
Mar 28 at 18:37
Also, this is a style detail for you: But it looks like you sometimes setisEditing, sometimes setisAdding, and sometimes setisShowDetail. It wouldn't ever make sense for none of these to be set, and it wouldn't ever make sense for two or three of them to be set. I'd probably have a string param calledmodeor something, and set it toSHOW_DETAIL,CREATE, andEDIT. Then you don't need to check 3 different booleans, but can just check for 3 different cases of the one field.
– Michael Marvick
Mar 28 at 18:39
add a comment
|
It looks like you're using react-navigation? I'd expect props.navigation.getParam("isEditing") to get you what you want. The getParam method is a helper, and you can also see all navigation params from props.navigation.state.params -- you might try to console.log(props.navigation.state.params) and see if what you expect is there.
– Michael Marvick
Mar 28 at 18:37
Also, this is a style detail for you: But it looks like you sometimes setisEditing, sometimes setisAdding, and sometimes setisShowDetail. It wouldn't ever make sense for none of these to be set, and it wouldn't ever make sense for two or three of them to be set. I'd probably have a string param calledmodeor something, and set it toSHOW_DETAIL,CREATE, andEDIT. Then you don't need to check 3 different booleans, but can just check for 3 different cases of the one field.
– Michael Marvick
Mar 28 at 18:39
It looks like you're using react-navigation? I'd expect props.navigation.getParam("isEditing") to get you what you want. The getParam method is a helper, and you can also see all navigation params from props.navigation.state.params -- you might try to console.log(props.navigation.state.params) and see if what you expect is there.
– Michael Marvick
Mar 28 at 18:37
It looks like you're using react-navigation? I'd expect props.navigation.getParam("isEditing") to get you what you want. The getParam method is a helper, and you can also see all navigation params from props.navigation.state.params -- you might try to console.log(props.navigation.state.params) and see if what you expect is there.
– Michael Marvick
Mar 28 at 18:37
Also, this is a style detail for you: But it looks like you sometimes set
isEditing, sometimes set isAdding, and sometimes set isShowDetail. It wouldn't ever make sense for none of these to be set, and it wouldn't ever make sense for two or three of them to be set. I'd probably have a string param called mode or something, and set it to SHOW_DETAIL, CREATE, and EDIT. Then you don't need to check 3 different booleans, but can just check for 3 different cases of the one field.– Michael Marvick
Mar 28 at 18:39
Also, this is a style detail for you: But it looks like you sometimes set
isEditing, sometimes set isAdding, and sometimes set isShowDetail. It wouldn't ever make sense for none of these to be set, and it wouldn't ever make sense for two or three of them to be set. I'd probably have a string param called mode or something, and set it to SHOW_DETAIL, CREATE, and EDIT. Then you don't need to check 3 different booleans, but can just check for 3 different cases of the one field.– Michael Marvick
Mar 28 at 18:39
add a comment
|
1 Answer
1
active
oldest
votes
On Screen A:
this.props.navigation.navigate(ROUTE_INVOICE_DETAIL_NAME,
invoice_data: invoice ,
isEditing: true
)
On Screen B you can get data like this :
let invoice_data = this.props.navigation.state.params.invoice_data
let isEditing = this.props.navigation.state.params.isEditing
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55404541%2fget-state-from-multi-screen-to-one-screen%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
On Screen A:
this.props.navigation.navigate(ROUTE_INVOICE_DETAIL_NAME,
invoice_data: invoice ,
isEditing: true
)
On Screen B you can get data like this :
let invoice_data = this.props.navigation.state.params.invoice_data
let isEditing = this.props.navigation.state.params.isEditing
add a comment
|
On Screen A:
this.props.navigation.navigate(ROUTE_INVOICE_DETAIL_NAME,
invoice_data: invoice ,
isEditing: true
)
On Screen B you can get data like this :
let invoice_data = this.props.navigation.state.params.invoice_data
let isEditing = this.props.navigation.state.params.isEditing
add a comment
|
On Screen A:
this.props.navigation.navigate(ROUTE_INVOICE_DETAIL_NAME,
invoice_data: invoice ,
isEditing: true
)
On Screen B you can get data like this :
let invoice_data = this.props.navigation.state.params.invoice_data
let isEditing = this.props.navigation.state.params.isEditing
On Screen A:
this.props.navigation.navigate(ROUTE_INVOICE_DETAIL_NAME,
invoice_data: invoice ,
isEditing: true
)
On Screen B you can get data like this :
let invoice_data = this.props.navigation.state.params.invoice_data
let isEditing = this.props.navigation.state.params.isEditing
answered Mar 28 at 19:02
Muhammad IqbalMuhammad Iqbal
742 silver badges12 bronze badges
742 silver badges12 bronze badges
add a comment
|
add a comment
|
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55404541%2fget-state-from-multi-screen-to-one-screen%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It looks like you're using react-navigation? I'd expect props.navigation.getParam("isEditing") to get you what you want. The getParam method is a helper, and you can also see all navigation params from props.navigation.state.params -- you might try to console.log(props.navigation.state.params) and see if what you expect is there.
– Michael Marvick
Mar 28 at 18:37
Also, this is a style detail for you: But it looks like you sometimes set
isEditing, sometimes setisAdding, and sometimes setisShowDetail. It wouldn't ever make sense for none of these to be set, and it wouldn't ever make sense for two or three of them to be set. I'd probably have a string param calledmodeor something, and set it toSHOW_DETAIL,CREATE, andEDIT. Then you don't need to check 3 different booleans, but can just check for 3 different cases of the one field.– Michael Marvick
Mar 28 at 18:39