Skip to content

Commit 8b73104

Browse files
committed
chore: update readme, example and format files
1 parent 467af04 commit 8b73104

File tree

12 files changed

+110
-287
lines changed

12 files changed

+110
-287
lines changed

.prettierrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true,
6+
"trailingComma": "all",
7+
"useTabs": false,
8+
"overrides": [
9+
{
10+
"files": "*.json",
11+
"options": { "printWidth": 200 }
12+
}
13+
]
14+
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"javascript.preferences.quoteStyle": "single",
3-
"editor.formatOnSave": false,
3+
"editor.formatOnSave": true,
44
"java.configuration.updateBuildConfiguration": "disabled"
55
}

README.md

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
21
# react-native-firebaseui
32

43
## Requirements
4+
55
We assume you already have firebase sdk installed and configured.
66
We're using this great library:
7-
https://github.com/invertase/react-native-firebase
7+
[react-native-firebase](https://github.com/invertase/react-native-firebase)
88

99
## Getting started
1010

@@ -15,15 +15,18 @@ https://github.com/invertase/react-native-firebase
1515
`$ react-native link react-native-firebaseui`
1616

1717
For iOS add the following pod to your podfile:
18-
```
18+
19+
```pod
1920
pod 'SDWebImage', '~> 4.0'
2021
```
22+
2123
and run pod install.
2224

2325
## Android Additional step for PhotoView Library
2426

2527
Add this in your root build.gradle file (usually under `android/build.gradle`):
26-
```
28+
29+
```gradle
2730
allprojects {
2831
repositories {
2932
...
@@ -34,7 +37,6 @@ allprojects {
3437

3538
### Manual installation
3639

37-
3840
#### iOS
3941

4042
1. In XCode, in the project navigator, right click `Libraries``Add Files to [your project's name]`
@@ -45,62 +47,67 @@ allprojects {
4547
#### Android
4648

4749
1. Open up `android/app/src/main/java/[...]/MainApplication.java`
48-
- Add `import io.rumors.reactnativefirebaseui.RNFirebaseUiPackage;` to the imports at the top of the file
49-
- Add `new RNFirebaseUiPackage()` to the list returned by the `getPackages()` method
50+
51+
- Add `import io.rumors.reactnativefirebaseui.RNFirebaseUiPackage;` to the imports at the top of the file
52+
- Add `new RNFirebaseUiPackage()` to the list returned by the `getPackages()` method
53+
5054
2. Append the following lines to `android/settings.gradle`:
51-
```
52-
include ':react-native-firebase-ui'
53-
project(':react-native-firebase-ui').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase-ui/android')
54-
```
55+
56+
```gradle
57+
include ':react-native-firebase-ui'
58+
project(':react-native-firebase-ui').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase-ui/android')
59+
```
60+
5561
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
56-
```
57-
compile project(':react-native-firebase-ui')
58-
```
5962

63+
```gradle
64+
compile project(':react-native-firebase-ui')
65+
```
6066

6167
## Usage
68+
6269
```javascript
63-
import { ImageView, PhotoView } from 'react-native-firebaseui'
70+
import { ImageView, PhotoView } from 'react-native-firebaseui';
6471

6572
//no zoom support
6673
export class MyFirebaseImageView extends Component<void, void, void> {
67-
constructor(props){
68-
super(props)
74+
constructor(props) {
75+
super(props);
6976
}
7077

7178
render() {
72-
let imageProps = this.props
79+
let imageProps = this.props;
7380

7481
return (
7582
<ImageView
7683
{...imageProps}
77-
path='firebase/storage/path'
84+
path="firebase/storage/path"
7885
defaultSource={require('./placeholder.png')} // optional, show placeholder until image is loaded
7986
timestamp={0} //optional, can be used to specify last modified time for same storage path
80-
resizeMode='cover' //'cover', 'contain', 'stretch'
87+
resizeMode="cover" //'cover', 'contain', 'stretch', 'center'
8188
/>
82-
)
89+
);
8390
}
8491
}
8592

8693
//zoom support (android only). On iOS just wrap the ImageView with a scroll view
8794
export class MyFirebasePhotoView extends Component<void, void, void> {
88-
constructor(props){
89-
super(props)
95+
constructor(props) {
96+
super(props);
9097
}
9198

9299
render() {
93-
let imageProps = this.props
100+
let imageProps = this.props;
94101

95102
return (
96103
<PhotoView
97104
{...imageProps}
98-
path='firebase/storage/path'
105+
path="firebase/storage/path"
99106
defaultSource={require('./placeholder.png')} // optional, show placeholder until image is loaded
100107
timestamp={0} //optional, can be used to specify last modified time for same storage path
101-
resizeMode='cover' //'cover', 'contain', 'stretch'
108+
resizeMode="cover" //'cover', 'contain', 'stretch', 'center'
102109
/>
103-
)
110+
);
104111
}
105112
}
106113
```

android/src/main/java/io/rumors/reactnativefirebaseui/storage/FirebasePhotoViewManager.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,11 @@ public void setResizeMode(ExtendedPhotoView imageView, @Nullable String resizeMo
5050
scaleType = ScaleType.CENTER_CROP;
5151
} else if ("contain".equals(resizeMode)) {
5252
scaleType = ScaleType.CENTER_INSIDE;
53+
} else if ("stretch".equals(resizeMode)) {
54+
scaleType = ScaleType.FIT_XY;
55+
} else if ("center".equals(resizeMode)) {
56+
scaleType = ScaleType.CENTER;
5357
}
54-
5558
imageView.setScaleType(scaleType);
5659
}
5760

example/App.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class MyFirebaseImageView extends Component {
1717
path="images/firebase_logo.png"
1818
defaultSource={require('./assets/placeholder.png')}
1919
timestamp={1000} //optional, can be used to specify last modified time for same storage path
20-
resizeMode="cover" //'cover', 'contain', 'stretch'
20+
resizeMode="cover" //'cover', 'contain', 'stretch', 'center'
2121
/>
2222
);
2323
}
@@ -34,7 +34,7 @@ class MyFirebasePhotoView extends Component {
3434
path="images/firebase_logo.png"
3535
defaultSource={require('./assets/placeholder.png')}
3636
timestamp={1000} //optional, can be used to specify last modified time for same storage path
37-
resizeMode="cover" //'cover', 'contain', 'stretch'
37+
resizeMode="cover" //'cover', 'contain', 'stretch', 'center'
3838
/>
3939
);
4040
}
@@ -56,9 +56,11 @@ const styles = StyleSheet.create({
5656
flex: 1,
5757
justifyContent: 'center',
5858
alignItems: 'center',
59+
backgroundColor: 'black',
5960
},
6061
image: {
6162
width: 100,
6263
height: 100,
64+
borderRadius: 10,
6365
},
6466
});

0 commit comments

Comments
 (0)