11// @flow
22import React , { Component } from "react" ;
3- import { View , Platform , findNodeHandle } from "react-native" ;
3+ import { View , Platform , findNodeHandle , StyleProp } from "react-native" ;
44import RNViewShot from "./RNViewShot" ;
55import type { ViewStyleProp } from "react-native/Libraries/StyleSheet/StyleSheet" ;
66import type { LayoutEvent } from "react-native/Libraries/Types/CoreEventTypes" ;
@@ -14,7 +14,7 @@ type Options = {
1414 quality : number ,
1515 result : "tmpfile" | "base64" | "data-uri" | "zip-base64" ,
1616 snapshotContentContainer : boolean ,
17- handleGLSurfaceViewOnAndroid : boolean
17+ handleGLSurfaceViewOnAndroid : boolean ,
1818} ;
1919
2020if ( ! RNViewShot ) {
@@ -36,16 +36,17 @@ const defaultOptions = {
3636 quality : 1 ,
3737 result : "tmpfile" ,
3838 snapshotContentContainer : false ,
39- handleGLSurfaceViewOnAndroid : false
39+ handleGLSurfaceViewOnAndroid : false ,
4040} ;
4141
4242// validate and coerce options
43- function validateOptions (
44- input : ?$Shape < Options >
45- ) : { options : Options , errors : Array < string > } {
43+ function validateOptions ( input : ?$Shape < Options > ) : {
44+ options : Options ,
45+ errors : Array < string > ,
46+ } {
4647 const options : Options = {
4748 ...defaultOptions ,
48- ...input
49+ ...input ,
4950 } ;
5051 const errors = [ ] ;
5152 if (
@@ -136,7 +137,7 @@ export function captureRef<T: React$ElementType>(
136137 if ( __DEV__ && errors . length > 0 ) {
137138 console . warn (
138139 "react-native-view-shot: bad options:\n" +
139- errors . map ( e => `- ${ e } ` ) . join ( "\n" )
140+ errors . map ( ( e ) => `- ${ e } ` ) . join ( "\n" )
140141 ) ;
141142 }
142143 return RNViewShot . captureRef ( view , options ) ;
@@ -158,7 +159,7 @@ export function captureScreen(optionsObject?: Options): Promise<string> {
158159 if ( __DEV__ && errors . length > 0 ) {
159160 console . warn (
160161 "react-native-view-shot: bad options:\n" +
161- errors . map ( e => `- ${ e } ` ) . join ( "\n" )
162+ errors . map ( ( e ) => `- ${ e } ` ) . join ( "\n" )
162163 ) ;
163164 }
164165 return RNViewShot . captureScreen ( options ) ;
@@ -171,7 +172,7 @@ type Props = {
171172 onLayout ?: ( e : * ) => void ,
172173 onCapture ?: ( uri : string ) => void ,
173174 onCaptureFailure ?: ( e : Error ) => void ,
174- style ?: ViewStyleProp
175+ style ?: StyleProp < ViewStyleProp > ,
175176} ;
176177
177178function checkCompatibleProps ( props : Props ) {
@@ -204,7 +205,7 @@ export default class ViewShot extends Component<Props> {
204205 lastCapturedURI : ?string ;
205206
206207 resolveFirstLayout : ( layout : Object ) => void ;
207- firstLayoutPromise : Promise < Object > = new Promise ( resolve => {
208+ firstLayoutPromise : Promise < Object > = new Promise ( ( resolve ) => {
208209 this . resolveFirstLayout = resolve ;
209210 } ) ;
210211
0 commit comments