Skip to content

Commit 6ee48b9

Browse files
committed
day25 complete
1 parent 6b57a52 commit 6ee48b9

File tree

5 files changed

+80
-1
lines changed

5 files changed

+80
-1
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,13 @@ Reference: https://github.com/brentvatne/react-native-scrollable-tab-view
160160

161161
![day24](https://raw.githubusercontent.com/fangwei716/ThirtyDaysOfReactNative/master/screenshot/day24.gif)
162162

163+
## Day 25
164+
Custome in-app browser
165+
166+
Reference: https://github.com/d-a-n/react-native-webbrowser
167+
168+
![day25](https://raw.githubusercontent.com/fangwei716/ThirtyDaysOfReactNative/master/screenshot/day25.gif)
169+
163170
## License
164171

165172
ThirtyDaysOfReactNative is under the MIT license.

index.ios.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import Day21 from './view/day21';
3333
import Day22 from './view/day22';
3434
import Day23 from './view/day23';
3535
import Day24 from './view/day24';
36+
import Day25 from './view/day25';
3637

3738
class MainView extends Component {
3839
constructor() {
@@ -254,6 +255,15 @@ class MainView extends Component {
254255
size:50,
255256
color:"#e32524",
256257
hideNav: true,
258+
},{
259+
key:24,
260+
title:"custome in-app browser",
261+
component: Day25,
262+
isFA: false,
263+
icon: "ios-world",
264+
size:50,
265+
color:"#00ab6b",
266+
hideNav: true,
257267
}]
258268
}
259269
}
@@ -318,7 +328,7 @@ class ThirtyDaysOfReactNative extends Component{
318328
title:"30 Days of RN",
319329
// title:"Time Picker",
320330
component: MainView,
321-
// component: Day24,
331+
// component: Day25,
322332
// titleTextColor:"#ff6b6b",
323333
backButtonTitle: 'back',
324334
shadowHidden: true,

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"react-native-touch-id": "^1.2.4",
2323
"react-native-vector-icons": "^1.3.2",
2424
"react-native-video": "^0.7.1",
25+
"react-native-webbrowser": "0.0.6",
2526
"react-timer-mixin": "^0.13.3"
2627
}
2728
}

screenshot/day25.gif

957 KB
Loading

view/day25.js

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* Day 25
3+
* custom refresh control
4+
*/
5+
'use strict';
6+
7+
import React,{
8+
Component,
9+
Image,
10+
StyleSheet,
11+
Text,
12+
TouchableHighlight,
13+
ActionSheetIOS,
14+
View
15+
} from 'react-native';
16+
import Util from './utils';
17+
import Webbrowser from 'react-native-webbrowser';
18+
import Icon from 'react-native-vector-icons/Ionicons';
19+
20+
export default class extends Component{
21+
_showShareActionSheet() {
22+
console.log(this.refs.browser.state.status);
23+
ActionSheetIOS.showShareActionSheetWithOptions({
24+
url: this.refs.browser.state.currentUrl,
25+
message: this.refs.browser.state.status,
26+
},
27+
(error) => console.log(error),
28+
(success, method) => {
29+
});
30+
}
31+
32+
render() {
33+
return (
34+
<View style={{paddingTop:20,flex:1,backgroundColor:"#00ab6b"}}>
35+
<Webbrowser
36+
ref="browser"
37+
url="https://github.com"
38+
hideHomeButton={true}
39+
hideToolbar={false}
40+
hideAddressBar={false}
41+
hideStatusBar={true}
42+
hideActivityIndicator={true}
43+
foregroundColor={'#555'}
44+
backgroundColor={'#00ab6b'}
45+
/>
46+
<TouchableHighlight underlayColor="transparent" onPress={() => this._showShareActionSheet()}>
47+
<Icon name="ios-upload-outline" style={styles.shareIcon} color="#268260" size={30}/>
48+
</TouchableHighlight>
49+
</View>
50+
);
51+
}
52+
}
53+
54+
const styles = StyleSheet.create({
55+
shareIcon:{
56+
position:"absolute",
57+
bottom:0,
58+
left: 170,
59+
}
60+
});
61+

0 commit comments

Comments
 (0)