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>
)
}
javascript reactjs react-native
add a comment |
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>
)
}
javascript reactjs react-native
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
add a comment |
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>
)
}
javascript reactjs react-native
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
javascript reactjs react-native
edited Nov 8 at 11:29
asked Nov 8 at 11:01
Somangshu Goswami
599
599
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
add a comment |
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
add a comment |
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
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
add a comment |
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
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
add a comment |
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
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
add a comment |
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
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
edited Nov 9 at 10:24
Somangshu Goswami
599
599
answered Nov 8 at 11:10
Ahsan Sohail
368110
368110
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
add a comment |
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
add a comment |
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%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
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
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