Closed lwestenberg closed 1 year ago
Hi @lwestenberg
Is that really possible with Native Android WebView component? Is that works with RN core implementation?
To be honest with you, that way that are you trying to reach some post never passed in my mind.
Hi, yes that works normally. Question: in the documentation you describe this:
getInitialState: function() { return { url: SITE_URL, // OR // you can use a source object like React Native Webview. // source {uri: string, method: string, headers: object, body: string}, {html: string, baseUrl: string} // Loads static html or a uri (with optional headers) in the WebView. <Just like React Native's version> // source: { // uri: SITE_URL, // headers: { // ... // }, // },
Are you able to have initialState working with method POST and a body?
Did you try the Native Webview from Rect Native core? The Native webview can do that?
I never see that thing of loading some body contene with POST method before.
Em dom, 3 de dez de 2017 às 20:55, lwestenberg notifications@github.com escreveu:
Hi, yes that works normally. Question: in the documentation you describe this:
getInitialState: function() { return { url: SITE_URL, // OR // you can use a source object like React Native Webview. // source {uri: string, method: string, headers: object, body: string}, {html: string, baseUrl: string} // Loads static html or a uri (with optional headers) in the WebView. <Just like React Native's version> // source: { // uri: SITE_URL, // headers: { // ... // }, // },
Are you able to have initialState working with method POST and a body?
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/lucasferreira/react-native-webview-android/issues/87#issuecomment-348824811, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOT_6PbEHzagzN9xZ_vAjNmx03bqxCYks5s8ybEgaJpZM4QzdQg .
-- Sent from Gmail Mobile
React Native Webview has method POST with body, as described in the docs object: {uri: string,method: string,headers: object,body: string}, ,object: {html: string,baseUrl: string}, ,number
. Post is working here, like this:
componentDidMount() {
this.setState({ source: { uri: LOGIN_URL, method: 'POST', body: 'param1=test¶m2=test2' } });
}
and
<WebView source={this.state.source} onNavigationStateChange={this.onNavigationStateChange} />
Any idea what needs to be done to make this work with react-native-webview-android?
Yes @lwestenberg,
You are right, I've found in RN source https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java#L472
So I will try to work on that and when it done, I will warn you ;)
Try 'post' instead of 'POST'. It solved my issue with custom headers not being sent on android.
@mondunet can you show me your whole webview code ? i tried using 'post' but i got a "OOPS SOMETHING WENT ERROR PAGE"
I was also a similar problem. Have any way to solve this problem yet?
Try 'post' instead of 'POST'. It solved my issue with custom headers not being sent on android.
Lol +1
React Native Webview has method POST with body, as described in the docs
object: {uri: string,method: string,headers: object,body: string}, ,object: {html: string,baseUrl: string}, ,number
. Post is working here, like this:componentDidMount() {
this.setState({ source: { uri: LOGIN_URL, method: 'POST', body: 'param1=test¶m2=test2' } });
}and
<WebView source={this.state.source} onNavigationStateChange={this.onNavigationStateChange} />
Any idea what needs to be done to make this work with react-native-webview-android?
Work for me! Many thanks 💯
"react-native-webview-android": "^1.1.14", "react-native": "^0.50.4",
On Android in componentDidMount I'm calling setState({ source: { uri: URL, method: 'POST', body: 'field1=value&field2=value' } })
This is connected to the android webview with source={this.state.source}
It works with GET (no body) but not with POST. As a result it opens the webpage without posting the data.
Any idea what could be the issue?