Skip to content

[WebView] WebView types missing #13662

Description

@Kingles

Description

WebView has no proper flowtypes.

Reproduction Steps and Sample Code

Environment

  • react-native: 0.43.4
  • flow-bin: 0.40.0
  1. import WebView
  2. use it
  3. attempt to access props or exposed functions
  4. observe that props and exposed methods (injectJavaScript, for example) are not covered by flow.
// @flowimportReact,{PureComponent}from'react';import{WebView,View,Button}from'react-native';importhtmlTemplatefrom'./template.html';exportdefaultclassTestComponentextendsPureComponent{webview: ?WebView=null;handlePress=()=>{const{webview}=this;if(webview){constscript="alert('sup :3')";webview.injectJavaScript(script);}};render(){<View><ButtononPress={this.handlePress}>
Press me!
</Button><WebViewref={(webview: WebView)=>{this.webview=webview;}}source={htmlTemplate}/></View>;}}

Solution

Add missing flowtypes to WebView.

Additional Information

  • React Native version: 0.43.4
  • Platform: both
  • Development Operating System: MacOS
  • Dev tools: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions