React native: rendering conditional component based on state value change in Modal











up vote
0
down vote

favorite












I have a requirement of showing a tab like behavior inside a react native Modal



I have started by creating a state variable selectedSub which is initialized with value 'from'



Now my modal has 2 TouchableHighlight as below



_availabiltyModal() {
return (
<TouchableHighlight
onPress={() => { this.setState({ selectedSub: 'from' }) }}
activeOpacity={0.9}
style={[styles.tab, this.state.selectedSub == 'from' && styles.active]}>
<RkText rkType="header" style={this.state.selectedSub == 'from' && styles.activeText}>From</RkText>
</TouchableHighlight>
<TouchableHighlight
onPress={() => { this.setState({ selectedSub: 'to' }) }}
activeOpacity={0.9}
style={[styles.tab, this.state.selectedSub == 'to' && styles.active]}>
<RkText rkType="header" style={this.state.selectedSub == 'to' && styles.activeText}>To</RkText>
</TouchableHighlight>
{this._renderPicker()}
)}


These two are responsible to change the state param selectedSub as required.



Based on this state param i am conditionally showing another component i made and imported as below



_renderPicker() {
if (this.state.selectedSub == 'from') {
return <TimePicker screenProps={{ time: this.state.selectedAvailabilty.from }} />
} else {
return <TimePicker screenProps={{ time: this.state.selectedAvailabilty.to }} />
}
}


I have called this function in the Modal below the TouchableHighlight's



Now as per the RN docs when ever the state variable is updated with this.setState() method the component should re-render. Everything else is working fine (TouchableHighlight styles changing) and also the updates to the state are reflecting in the console. But the _renderPicker function does not return the changed view and is always stuck on the view which was set when the parent was initialized as pointed earlier.



Could somebody help me point the problem here which i might have been overlooking. Also on the side note all this calls are actually directly made outside the main render() method. Could that be a possible issue



------update------
here is the complete reference



 render() {
return({this._availabiltyModal()}
<View style={appStyles.tagsWrapper}>
{this.state.week.map((day, i) => {
return (
<TouchableHighlight
key={i}
activeOpacity={0.9}
style={[appStyle.mr10, appStyle.mb10]}
onPress={() => {
this.setModalVisible(true, day);
}}>
<Text style={appStyle.tag}>{day}</Text>
</TouchableHighlight>
)
})}
</View>
)
}









share|improve this question
























  • I think the problem is really with the modal. As just observed if i hide the the modal and then show it again my _renderPicker() method is able to show the updated component view. Does this mean that the modal does not get re-rendered on state changes
    – Somangshu Goswami
    Nov 8 at 11:24










  • Actually if the state is update the functions depending on that will never get recalled. As your case you have a function that returns a view. Every thing in the render function should re render be it Modal
    – Ahsan Sohail
    Nov 8 at 11:41










  • Makes sense! But the problem is even if i put the _renderPicker() content inside the modal which is a part of the main render function the view does not re render as required until the modal is closed and opened again.
    – Somangshu Goswami
    Nov 8 at 13:43










  • I think it has something to do with the implementation of Modal component from react-native.
    – Ahsan Sohail
    Nov 8 at 13:47















up vote
0
down vote

favorite












I have a requirement of showing a tab like behavior inside a react native Modal



I have started by creating a state variable selectedSub which is initialized with value 'from'



Now my modal has 2 TouchableHighlight as below



_availabiltyModal() {
return (
<TouchableHighlight
onPress={() => { this.setState({ selectedSub: 'from' }) }}
activeOpacity={0.9}
style={[styles.tab, this.state.selectedSub == 'from' && styles.active]}>
<RkText rkType="header" style={this.state.selectedSub == 'from' && styles.activeText}>From</RkText>
</TouchableHighlight>
<TouchableHighlight
onPress={() => { this.setState({ selectedSub: 'to' }) }}
activeOpacity={0.9}
style={[styles.tab, this.state.selectedSub == 'to' && styles.active]}>
<RkText rkType="header" style={this.state.selectedSub == 'to' && styles.activeText}>To</RkText>
</TouchableHighlight>
{this._renderPicker()}
)}


These two are responsible to change the state param selectedSub as required.



Based on this state param i am conditionally showing another component i made and imported as below



_renderPicker() {
if (this.state.selectedSub == 'from') {
return <TimePicker screenProps={{ time: this.state.selectedAvailabilty.from }} />
} else {
return <TimePicker screenProps={{ time: this.state.selectedAvailabilty.to }} />
}
}


I have called this function in the Modal below the TouchableHighlight's



Now as per the RN docs when ever the state variable is updated with this.setState() method the component should re-render. Everything else is working fine (TouchableHighlight styles changing) and also the updates to the state are reflecting in the console. But the _renderPicker function does not return the changed view and is always stuck on the view which was set when the parent was initialized as pointed earlier.



Could somebody help me point the problem here which i might have been overlooking. Also on the side note all this calls are actually directly made outside the main render() method. Could that be a possible issue



------update------
here is the complete reference



 render() {
return({this._availabiltyModal()}
<View style={appStyles.tagsWrapper}>
{this.state.week.map((day, i) => {
return (
<TouchableHighlight
key={i}
activeOpacity={0.9}
style={[appStyle.mr10, appStyle.mb10]}
onPress={() => {
this.setModalVisible(true, day);
}}>
<Text style={appStyle.tag}>{day}</Text>
</TouchableHighlight>
)
})}
</View>
)
}









share|improve this question
























  • I think the problem is really with the modal. As just observed if i hide the the modal and then show it again my _renderPicker() method is able to show the updated component view. Does this mean that the modal does not get re-rendered on state changes
    – Somangshu Goswami
    Nov 8 at 11:24










  • Actually if the state is update the functions depending on that will never get recalled. As your case you have a function that returns a view. Every thing in the render function should re render be it Modal
    – Ahsan Sohail
    Nov 8 at 11:41










  • Makes sense! But the problem is even if i put the _renderPicker() content inside the modal which is a part of the main render function the view does not re render as required until the modal is closed and opened again.
    – Somangshu Goswami
    Nov 8 at 13:43










  • I think it has something to do with the implementation of Modal component from react-native.
    – Ahsan Sohail
    Nov 8 at 13:47













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a requirement of showing a tab like behavior inside a react native Modal



I have started by creating a state variable selectedSub which is initialized with value 'from'



Now my modal has 2 TouchableHighlight as below



_availabiltyModal() {
return (
<TouchableHighlight
onPress={() => { this.setState({ selectedSub: 'from' }) }}
activeOpacity={0.9}
style={[styles.tab, this.state.selectedSub == 'from' && styles.active]}>
<RkText rkType="header" style={this.state.selectedSub == 'from' && styles.activeText}>From</RkText>
</TouchableHighlight>
<TouchableHighlight
onPress={() => { this.setState({ selectedSub: 'to' }) }}
activeOpacity={0.9}
style={[styles.tab, this.state.selectedSub == 'to' && styles.active]}>
<RkText rkType="header" style={this.state.selectedSub == 'to' && styles.activeText}>To</RkText>
</TouchableHighlight>
{this._renderPicker()}
)}


These two are responsible to change the state param selectedSub as required.



Based on this state param i am conditionally showing another component i made and imported as below



_renderPicker() {
if (this.state.selectedSub == 'from') {
return <TimePicker screenProps={{ time: this.state.selectedAvailabilty.from }} />
} else {
return <TimePicker screenProps={{ time: this.state.selectedAvailabilty.to }} />
}
}


I have called this function in the Modal below the TouchableHighlight's



Now as per the RN docs when ever the state variable is updated with this.setState() method the component should re-render. Everything else is working fine (TouchableHighlight styles changing) and also the updates to the state are reflecting in the console. But the _renderPicker function does not return the changed view and is always stuck on the view which was set when the parent was initialized as pointed earlier.



Could somebody help me point the problem here which i might have been overlooking. Also on the side note all this calls are actually directly made outside the main render() method. Could that be a possible issue



------update------
here is the complete reference



 render() {
return({this._availabiltyModal()}
<View style={appStyles.tagsWrapper}>
{this.state.week.map((day, i) => {
return (
<TouchableHighlight
key={i}
activeOpacity={0.9}
style={[appStyle.mr10, appStyle.mb10]}
onPress={() => {
this.setModalVisible(true, day);
}}>
<Text style={appStyle.tag}>{day}</Text>
</TouchableHighlight>
)
})}
</View>
)
}









share|improve this question















I have a requirement of showing a tab like behavior inside a react native Modal



I have started by creating a state variable selectedSub which is initialized with value 'from'



Now my modal has 2 TouchableHighlight as below



_availabiltyModal() {
return (
<TouchableHighlight
onPress={() => { this.setState({ selectedSub: 'from' }) }}
activeOpacity={0.9}
style={[styles.tab, this.state.selectedSub == 'from' && styles.active]}>
<RkText rkType="header" style={this.state.selectedSub == 'from' && styles.activeText}>From</RkText>
</TouchableHighlight>
<TouchableHighlight
onPress={() => { this.setState({ selectedSub: 'to' }) }}
activeOpacity={0.9}
style={[styles.tab, this.state.selectedSub == 'to' && styles.active]}>
<RkText rkType="header" style={this.state.selectedSub == 'to' && styles.activeText}>To</RkText>
</TouchableHighlight>
{this._renderPicker()}
)}


These two are responsible to change the state param selectedSub as required.



Based on this state param i am conditionally showing another component i made and imported as below



_renderPicker() {
if (this.state.selectedSub == 'from') {
return <TimePicker screenProps={{ time: this.state.selectedAvailabilty.from }} />
} else {
return <TimePicker screenProps={{ time: this.state.selectedAvailabilty.to }} />
}
}


I have called this function in the Modal below the TouchableHighlight's



Now as per the RN docs when ever the state variable is updated with this.setState() method the component should re-render. Everything else is working fine (TouchableHighlight styles changing) and also the updates to the state are reflecting in the console. But the _renderPicker function does not return the changed view and is always stuck on the view which was set when the parent was initialized as pointed earlier.



Could somebody help me point the problem here which i might have been overlooking. Also on the side note all this calls are actually directly made outside the main render() method. Could that be a possible issue



------update------
here is the complete reference



 render() {
return({this._availabiltyModal()}
<View style={appStyles.tagsWrapper}>
{this.state.week.map((day, i) => {
return (
<TouchableHighlight
key={i}
activeOpacity={0.9}
style={[appStyle.mr10, appStyle.mb10]}
onPress={() => {
this.setModalVisible(true, day);
}}>
<Text style={appStyle.tag}>{day}</Text>
</TouchableHighlight>
)
})}
</View>
)
}






javascript reactjs react-native






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 11:29

























asked Nov 8 at 11:01









Somangshu Goswami

699




699












  • I think the problem is really with the modal. As just observed if i hide the the modal and then show it again my _renderPicker() method is able to show the updated component view. Does this mean that the modal does not get re-rendered on state changes
    – Somangshu Goswami
    Nov 8 at 11:24










  • Actually if the state is update the functions depending on that will never get recalled. As your case you have a function that returns a view. Every thing in the render function should re render be it Modal
    – Ahsan Sohail
    Nov 8 at 11:41










  • Makes sense! But the problem is even if i put the _renderPicker() content inside the modal which is a part of the main render function the view does not re render as required until the modal is closed and opened again.
    – Somangshu Goswami
    Nov 8 at 13:43










  • I think it has something to do with the implementation of Modal component from react-native.
    – Ahsan Sohail
    Nov 8 at 13:47


















  • I think the problem is really with the modal. As just observed if i hide the the modal and then show it again my _renderPicker() method is able to show the updated component view. Does this mean that the modal does not get re-rendered on state changes
    – Somangshu Goswami
    Nov 8 at 11:24










  • Actually if the state is update the functions depending on that will never get recalled. As your case you have a function that returns a view. Every thing in the render function should re render be it Modal
    – Ahsan Sohail
    Nov 8 at 11:41










  • Makes sense! But the problem is even if i put the _renderPicker() content inside the modal which is a part of the main render function the view does not re render as required until the modal is closed and opened again.
    – Somangshu Goswami
    Nov 8 at 13:43










  • I think it has something to do with the implementation of Modal component from react-native.
    – Ahsan Sohail
    Nov 8 at 13:47
















I think the problem is really with the modal. As just observed if i hide the the modal and then show it again my _renderPicker() method is able to show the updated component view. Does this mean that the modal does not get re-rendered on state changes
– Somangshu Goswami
Nov 8 at 11:24




I think the problem is really with the modal. As just observed if i hide the the modal and then show it again my _renderPicker() method is able to show the updated component view. Does this mean that the modal does not get re-rendered on state changes
– Somangshu Goswami
Nov 8 at 11:24












Actually if the state is update the functions depending on that will never get recalled. As your case you have a function that returns a view. Every thing in the render function should re render be it Modal
– Ahsan Sohail
Nov 8 at 11:41




Actually if the state is update the functions depending on that will never get recalled. As your case you have a function that returns a view. Every thing in the render function should re render be it Modal
– Ahsan Sohail
Nov 8 at 11:41












Makes sense! But the problem is even if i put the _renderPicker() content inside the modal which is a part of the main render function the view does not re render as required until the modal is closed and opened again.
– Somangshu Goswami
Nov 8 at 13:43




Makes sense! But the problem is even if i put the _renderPicker() content inside the modal which is a part of the main render function the view does not re render as required until the modal is closed and opened again.
– Somangshu Goswami
Nov 8 at 13:43












I think it has something to do with the implementation of Modal component from react-native.
– Ahsan Sohail
Nov 8 at 13:47




I think it has something to do with the implementation of Modal component from react-native.
– Ahsan Sohail
Nov 8 at 13:47












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










Move the _renderPicker method inside the render() method like...



render() {
...
{this._renderPicker()}
...
}


Looking at the code of the MODAL component from react-native



render(): React.Node {
....
const innerChildren = __DEV__ ? (
<AppContainer rootTag={this.context.rootTag}>
{this.props.children}
</AppContainer>
) : (
this.props.children
);

return (
<RCTModalHostView
....>
<View style={[styles.container, containerStyles]}>
{innerChildren}
</View>
</RCTModalHostView>
);
}


The state you are changing are of the component that use the modal component thats render its children through the upper function.. when the state update it only re render the component whose state is updated.. so somewhere down rendering child inside component it does not get re render until force re render is applied.



Here is an helpful article to further explain how exactly this functions, forcefully re-rendering the child component






share|improve this answer























  • Hey @Ahsan my {this._renderPicker()} has to be a part of the the modal which is already getting inside the render method. Also just for the information putting it in the render method did not really make any update.
    – Somangshu Goswami
    Nov 8 at 11:20












  • Can you update the question and provide complete code of your render method ... or atleast all code related to your problem
    – Ahsan Sohail
    Nov 8 at 11:23










  • hey sorry about that, I have update the code. The render function has the this._availabiltyModal() which has the tow TouchableHighlight's and then follows with the this._renderPicker() method
    – Somangshu Goswami
    Nov 8 at 11:31












  • Just edited the answer... this is my observation after looking the implementation and with the knowledge i have.
    – Ahsan Sohail
    Nov 8 at 14:23










  • You are right, In react a child component in the nested components is never going to re-render until the props of the child component are updated with the help of componentWillReceiveProps() for say. Thanks for the help! :)
    – Somangshu Goswami
    Nov 9 at 10:19











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',
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/3.0/"u003ecc by-sa 3.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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206388%2freact-native-rendering-conditional-component-based-on-state-value-change-in-mod%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








up vote
0
down vote



accepted










Move the _renderPicker method inside the render() method like...



render() {
...
{this._renderPicker()}
...
}


Looking at the code of the MODAL component from react-native



render(): React.Node {
....
const innerChildren = __DEV__ ? (
<AppContainer rootTag={this.context.rootTag}>
{this.props.children}
</AppContainer>
) : (
this.props.children
);

return (
<RCTModalHostView
....>
<View style={[styles.container, containerStyles]}>
{innerChildren}
</View>
</RCTModalHostView>
);
}


The state you are changing are of the component that use the modal component thats render its children through the upper function.. when the state update it only re render the component whose state is updated.. so somewhere down rendering child inside component it does not get re render until force re render is applied.



Here is an helpful article to further explain how exactly this functions, forcefully re-rendering the child component






share|improve this answer























  • Hey @Ahsan my {this._renderPicker()} has to be a part of the the modal which is already getting inside the render method. Also just for the information putting it in the render method did not really make any update.
    – Somangshu Goswami
    Nov 8 at 11:20












  • Can you update the question and provide complete code of your render method ... or atleast all code related to your problem
    – Ahsan Sohail
    Nov 8 at 11:23










  • hey sorry about that, I have update the code. The render function has the this._availabiltyModal() which has the tow TouchableHighlight's and then follows with the this._renderPicker() method
    – Somangshu Goswami
    Nov 8 at 11:31












  • Just edited the answer... this is my observation after looking the implementation and with the knowledge i have.
    – Ahsan Sohail
    Nov 8 at 14:23










  • You are right, In react a child component in the nested components is never going to re-render until the props of the child component are updated with the help of componentWillReceiveProps() for say. Thanks for the help! :)
    – Somangshu Goswami
    Nov 9 at 10:19















up vote
0
down vote



accepted










Move the _renderPicker method inside the render() method like...



render() {
...
{this._renderPicker()}
...
}


Looking at the code of the MODAL component from react-native



render(): React.Node {
....
const innerChildren = __DEV__ ? (
<AppContainer rootTag={this.context.rootTag}>
{this.props.children}
</AppContainer>
) : (
this.props.children
);

return (
<RCTModalHostView
....>
<View style={[styles.container, containerStyles]}>
{innerChildren}
</View>
</RCTModalHostView>
);
}


The state you are changing are of the component that use the modal component thats render its children through the upper function.. when the state update it only re render the component whose state is updated.. so somewhere down rendering child inside component it does not get re render until force re render is applied.



Here is an helpful article to further explain how exactly this functions, forcefully re-rendering the child component






share|improve this answer























  • Hey @Ahsan my {this._renderPicker()} has to be a part of the the modal which is already getting inside the render method. Also just for the information putting it in the render method did not really make any update.
    – Somangshu Goswami
    Nov 8 at 11:20












  • Can you update the question and provide complete code of your render method ... or atleast all code related to your problem
    – Ahsan Sohail
    Nov 8 at 11:23










  • hey sorry about that, I have update the code. The render function has the this._availabiltyModal() which has the tow TouchableHighlight's and then follows with the this._renderPicker() method
    – Somangshu Goswami
    Nov 8 at 11:31












  • Just edited the answer... this is my observation after looking the implementation and with the knowledge i have.
    – Ahsan Sohail
    Nov 8 at 14:23










  • You are right, In react a child component in the nested components is never going to re-render until the props of the child component are updated with the help of componentWillReceiveProps() for say. Thanks for the help! :)
    – Somangshu Goswami
    Nov 9 at 10:19













up vote
0
down vote



accepted







up vote
0
down vote



accepted






Move the _renderPicker method inside the render() method like...



render() {
...
{this._renderPicker()}
...
}


Looking at the code of the MODAL component from react-native



render(): React.Node {
....
const innerChildren = __DEV__ ? (
<AppContainer rootTag={this.context.rootTag}>
{this.props.children}
</AppContainer>
) : (
this.props.children
);

return (
<RCTModalHostView
....>
<View style={[styles.container, containerStyles]}>
{innerChildren}
</View>
</RCTModalHostView>
);
}


The state you are changing are of the component that use the modal component thats render its children through the upper function.. when the state update it only re render the component whose state is updated.. so somewhere down rendering child inside component it does not get re render until force re render is applied.



Here is an helpful article to further explain how exactly this functions, forcefully re-rendering the child component






share|improve this answer














Move the _renderPicker method inside the render() method like...



render() {
...
{this._renderPicker()}
...
}


Looking at the code of the MODAL component from react-native



render(): React.Node {
....
const innerChildren = __DEV__ ? (
<AppContainer rootTag={this.context.rootTag}>
{this.props.children}
</AppContainer>
) : (
this.props.children
);

return (
<RCTModalHostView
....>
<View style={[styles.container, containerStyles]}>
{innerChildren}
</View>
</RCTModalHostView>
);
}


The state you are changing are of the component that use the modal component thats render its children through the upper function.. when the state update it only re render the component whose state is updated.. so somewhere down rendering child inside component it does not get re render until force re render is applied.



Here is an helpful article to further explain how exactly this functions, forcefully re-rendering the child component







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 9 at 10:24









Somangshu Goswami

699




699










answered Nov 8 at 11:10









Ahsan Sohail

399212




399212












  • Hey @Ahsan my {this._renderPicker()} has to be a part of the the modal which is already getting inside the render method. Also just for the information putting it in the render method did not really make any update.
    – Somangshu Goswami
    Nov 8 at 11:20












  • Can you update the question and provide complete code of your render method ... or atleast all code related to your problem
    – Ahsan Sohail
    Nov 8 at 11:23










  • hey sorry about that, I have update the code. The render function has the this._availabiltyModal() which has the tow TouchableHighlight's and then follows with the this._renderPicker() method
    – Somangshu Goswami
    Nov 8 at 11:31












  • Just edited the answer... this is my observation after looking the implementation and with the knowledge i have.
    – Ahsan Sohail
    Nov 8 at 14:23










  • You are right, In react a child component in the nested components is never going to re-render until the props of the child component are updated with the help of componentWillReceiveProps() for say. Thanks for the help! :)
    – Somangshu Goswami
    Nov 9 at 10:19


















  • Hey @Ahsan my {this._renderPicker()} has to be a part of the the modal which is already getting inside the render method. Also just for the information putting it in the render method did not really make any update.
    – Somangshu Goswami
    Nov 8 at 11:20












  • Can you update the question and provide complete code of your render method ... or atleast all code related to your problem
    – Ahsan Sohail
    Nov 8 at 11:23










  • hey sorry about that, I have update the code. The render function has the this._availabiltyModal() which has the tow TouchableHighlight's and then follows with the this._renderPicker() method
    – Somangshu Goswami
    Nov 8 at 11:31












  • Just edited the answer... this is my observation after looking the implementation and with the knowledge i have.
    – Ahsan Sohail
    Nov 8 at 14:23










  • You are right, In react a child component in the nested components is never going to re-render until the props of the child component are updated with the help of componentWillReceiveProps() for say. Thanks for the help! :)
    – Somangshu Goswami
    Nov 9 at 10:19
















Hey @Ahsan my {this._renderPicker()} has to be a part of the the modal which is already getting inside the render method. Also just for the information putting it in the render method did not really make any update.
– Somangshu Goswami
Nov 8 at 11:20






Hey @Ahsan my {this._renderPicker()} has to be a part of the the modal which is already getting inside the render method. Also just for the information putting it in the render method did not really make any update.
– Somangshu Goswami
Nov 8 at 11:20














Can you update the question and provide complete code of your render method ... or atleast all code related to your problem
– Ahsan Sohail
Nov 8 at 11:23




Can you update the question and provide complete code of your render method ... or atleast all code related to your problem
– Ahsan Sohail
Nov 8 at 11:23












hey sorry about that, I have update the code. The render function has the this._availabiltyModal() which has the tow TouchableHighlight's and then follows with the this._renderPicker() method
– Somangshu Goswami
Nov 8 at 11:31






hey sorry about that, I have update the code. The render function has the this._availabiltyModal() which has the tow TouchableHighlight's and then follows with the this._renderPicker() method
– Somangshu Goswami
Nov 8 at 11:31














Just edited the answer... this is my observation after looking the implementation and with the knowledge i have.
– Ahsan Sohail
Nov 8 at 14:23




Just edited the answer... this is my observation after looking the implementation and with the knowledge i have.
– Ahsan Sohail
Nov 8 at 14:23












You are right, In react a child component in the nested components is never going to re-render until the props of the child component are updated with the help of componentWillReceiveProps() for say. Thanks for the help! :)
– Somangshu Goswami
Nov 9 at 10:19




You are right, In react a child component in the nested components is never going to re-render until the props of the child component are updated with the help of componentWillReceiveProps() for say. Thanks for the help! :)
– Somangshu Goswami
Nov 9 at 10:19


















draft saved

draft discarded




















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206388%2freact-native-rendering-conditional-component-based-on-state-value-change-in-mod%23new-answer', 'question_page');
}
);

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







這個網誌中的熱門文章

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Xamarin.form Move up view when keyboard appear

JBPM : POST request for execute process go wrong