33 * https://github.com/facebook/react-native
44 *
55 * @format
6- * @flow
6+ * @flow strict-local
77 */
88
9- import React , { Component } from 'react' ;
9+ import React , { Component } from 'react' ;
1010import {
1111 Platform ,
1212 StyleSheet ,
@@ -16,15 +16,15 @@ import {
1616 Alert ,
1717 TextInput ,
1818 StatusBar ,
19- Linking
19+ Linking ,
2020} from 'react-native' ;
2121import InAppBrowser from 'react-native-inappbrowser-reborn' ;
2222
2323const instructions = Platform . select ( {
2424 ios : 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu' ,
2525 android :
2626 'Double tap R on your keyboard to reload,\n' +
27- 'Shake or press menu button for dev menu'
27+ 'Shake or press menu button for dev menu' ,
2828} ) ;
2929
3030export default class App extends Component {
@@ -33,16 +33,16 @@ export default class App extends Component {
3333
3434 this . state = {
3535 url : 'https://www.google.com' ,
36- statusBarStyle : 'dark-content'
36+ statusBarStyle : 'dark-content' ,
3737 } ;
3838 }
3939
4040 sleep ( timeout ) {
41- return new Promise ( resolve => setTimeout ( resolve , timeout ) ) ;
41+ return new Promise ( ( resolve ) => setTimeout ( resolve , timeout ) ) ;
4242 }
4343
4444 async openLink ( ) {
45- const { url, statusBarStyle } = this . state ;
45+ const { url, statusBarStyle} = this . state ;
4646 try {
4747 if ( await InAppBrowser . isAvailable ( ) ) {
4848 // A delay to change the StatusBar when the browser is opened
@@ -73,11 +73,11 @@ export default class App extends Component {
7373 startEnter : 'slide_in_right' ,
7474 startExit : 'slide_out_left' ,
7575 endEnter : 'slide_in_left' ,
76- endExit : 'slide_out_right'
76+ endExit : 'slide_out_right' ,
7777 } ,
7878 headers : {
79- 'my-custom-header' : 'my custom header value'
80- }
79+ 'my-custom-header' : 'my custom header value' ,
80+ } ,
8181 } ) ;
8282 // A delay to show an alert when the browser is closed
8383 await this . sleep ( 800 ) ;
@@ -107,13 +107,13 @@ export default class App extends Component {
107107 try {
108108 if ( await InAppBrowser . isAvailable ( ) ) {
109109 const result = await InAppBrowser . openAuth ( url , redirectUrl , {
110- showTitle : true ,
111- toolbarColor : '#6200EE' ,
112- secondaryToolbarColor : 'black' ,
110+ // iOS Properties
111+ ephemeralWebSession : false ,
112+ // Android Properties
113+ showTitle : false ,
113114 enableUrlBarHiding : true ,
114- enableDefaultShare : true
115+ enableDefaultShare : false ,
115116 } ) ;
116- await this . sleep ( 800 ) ;
117117 Alert . alert ( 'Response' , JSON . stringify ( result ) ) ;
118118 } else {
119119 Alert . alert ( 'InAppBrowser is not supported :/' ) ;
@@ -124,7 +124,7 @@ export default class App extends Component {
124124 }
125125
126126 render ( ) {
127- const { statusBarStyle } = this . state ;
127+ const { statusBarStyle} = this . state ;
128128 return (
129129 < View style = { styles . container } >
130130 < StatusBar barStyle = { statusBarStyle } />
@@ -134,7 +134,7 @@ export default class App extends Component {
134134 < Text style = { styles . instructions } > Type the url</ Text >
135135 < TextInput
136136 style = { styles . urlInput }
137- onChangeText = { text => this . setState ( { url : text } ) }
137+ onChangeText = { ( text ) => this . setState ( { url : text } ) }
138138 value = { this . state . url }
139139 />
140140 < View style = { styles . openButton } >
@@ -158,26 +158,26 @@ const styles = StyleSheet.create({
158158 justifyContent : 'center' ,
159159 alignItems : 'center' ,
160160 backgroundColor : '#F5FCFF' ,
161- padding : 30
161+ padding : 30 ,
162162 } ,
163163 welcome : {
164164 fontSize : 20 ,
165165 textAlign : 'center' ,
166- margin : 10
166+ margin : 10 ,
167167 } ,
168168 instructions : {
169169 textAlign : 'center' ,
170170 color : '#333333' ,
171- marginBottom : 5
171+ marginBottom : 5 ,
172172 } ,
173173 urlInput : {
174174 height : 40 ,
175175 width : '100%' ,
176176 borderColor : 'gray' ,
177- borderWidth : 1
177+ borderWidth : 1 ,
178178 } ,
179179 openButton : {
180180 paddingTop : Platform . OS === 'ios' ? 0 : 20 ,
181- paddingBottom : Platform . OS === 'ios' ? 0 : 20
182- }
181+ paddingBottom : Platform . OS === 'ios' ? 0 : 20 ,
182+ } ,
183183} ) ;
0 commit comments