CRAlpha / CRAlpha/react-native-wkwebview

postMessage from HTML file to react-native results in app crash

Open
#203 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Objective-C
Stars
637
Forks
263
PR merge metrics
No merged PRs in 30d

Description

`“react-native-wkwebview-reborn”: “1.22.0",`

```
{
this.webview = wbref;
}}
style={{ backgroundColor: 'red' }}
source={require('../../../../../../ios/3dView/car.html')}
onLoadStart={this.onLoadStart}
onLoad={this.onLoad}
onLoadEnd={this.onLoadEnd}
onError={this.onError}
renderError={this.renderError}
onMessage={this.handleMessageFromBuilder}
cacheEnabled={false}
cookiesEnabled={false}
scalesPageToFit
bounces={false}
scrollEnabled={false}
/>
```

When i postMessage from html file to react-native it crashes.
```
window.postMessage(JSON.stringify({
type: ‘READY_TO_RENDER’
}), ‘*’);
```

Additional info
```

Environment:
OS: macOS High Sierra 10.13.6
Node: 9.6.1
Yarn: Not Found
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 10.0 Build version 10A255
Android Studio: 3.1 AI-173.4819257

Packages: (wanted => installed)
react: v16.3.2 => 16.3.2
react-native: 0.53 => 0.53.3
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with ios/3dView/car.html and the WKWebView usage shown in the issue, then trace the onMessage handler handleMessageFromBuilder. Reproduce the crash using the provided window.postMessage payload and inspect the native React Native WebView path; done means the message is delivered without crashing under the stated environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, objective-c, react-native
Domain
frontend, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.