Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 1c96439

Browse files
authored
Merge pull request #8 from react-native-toolkit/docs-update
Updated dependencies
2 parents 9715856 + 9744736 commit 1c96439

File tree

8 files changed

+5764
-6128
lines changed

8 files changed

+5764
-6128
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ jobs:
8383
runs-on: ubuntu-latest
8484
steps:
8585
- uses: actions/checkout@v2
86+
with:
87+
fetch-depth: 0
8688
- uses: actions/setup-node@v1
8789
with:
8890
node-version: 12.x

.github/workflows/review.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ jobs:
5050
runs-on: ubuntu-latest
5151
steps:
5252
- uses: actions/checkout@v2
53+
with:
54+
fetch-depth: 0
5355
- uses: actions/setup-node@v1
5456
with:
5557
node-version: 12.x

example/assets/place-holder.png

3.42 KB
Loading

example/package.json

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-native-better-image-example",
33
"description": "Example app for react-native-better-image",
4-
"version": "0.0.1",
4+
"version": "0.0.2",
55
"private": true,
66
"main": "index",
77
"scripts": {
@@ -11,39 +11,31 @@
1111
"start": "expo start",
1212
"test": "jest",
1313
"storybook": "start-storybook -p 6006",
14-
"build-storybook": "build-storybook -s public --no-dll",
15-
"deploy-storybook": "storybook-to-ghpages",
14+
"build-storybook": "build-storybook",
1615
"chromatic": "npx chromatic"
1716
},
1817
"dependencies": {
19-
"expo": "^38.0.0",
20-
"expo-splash-screen": "^0.3.1",
21-
"react": "16.11.0",
22-
"react-dom": "16.11.0",
23-
"react-native": "0.62.2",
24-
"react-native-unimodules": "~0.10.1",
25-
"react-native-web": "^0.12.3"
18+
"expo": "40.0.0",
19+
"expo-splash-screen": "0.8.1",
20+
"react": "17.0.1",
21+
"react-dom": "17.0.1",
22+
"react-native": "https://github.com/expo/react-native/archive/sdk-40.0.0.tar.gz",
23+
"react-native-unimodules": "0.12.0",
24+
"react-native-web": "^0.14.9"
2625
},
2726
"devDependencies": {
2827
"@babel/core": "^7.9.6",
2928
"@babel/runtime": "^7.9.6",
3029
"@expo/webpack-config": "^0.12.27",
31-
"@storybook/addon-actions": "^6.0.20",
32-
"@storybook/addon-essentials": "^6.0.20",
33-
"@storybook/addon-links": "^6.0.20",
34-
"@storybook/react": "^6.0.20",
35-
"@storybook/storybook-deployer": "^2.8.6",
30+
"@storybook/addon-actions": "^6.1.14",
31+
"@storybook/addon-essentials": "^6.1.14",
32+
"@storybook/addon-links": "^6.1.14",
33+
"@storybook/react": "^6.1.14",
3634
"babel-loader": "^8.1.0",
3735
"babel-plugin-module-resolver": "^4.0.0",
3836
"babel-preset-expo": "^8.2.3",
3937
"chromatic": "^5.1.0",
40-
"expo-cli": "^3.21.12",
41-
"react-is": "^16.13.1"
42-
},
43-
"homepage": "https://react-native-toolkit.github.io/react-native-better-image",
44-
"storybook-deployer": {
45-
"gitUsername": "DaniAkash",
46-
"gitEmail": "s.daniakash@gmail.com",
47-
"commitMessage": "Deploying Storybook"
38+
"expo-cli": "4.0.17",
39+
"react-is": "17.0.1"
4840
}
4941
}

example/src/App.tsx

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useRef, useEffect } from 'react';
2-
import { View, Text, StyleSheet } from 'react-native';
2+
import { View, Text, StyleSheet, Linking } from 'react-native';
33
import BetterImage from 'react-native-better-image';
44

55
const styles = StyleSheet.create({
@@ -9,6 +9,9 @@ const styles = StyleSheet.create({
99
justifyContent: 'center',
1010
alignItems: 'center',
1111
},
12+
titleStyle: {
13+
fontWeight: 'bold',
14+
},
1215
});
1316

1417
function useInterval(callback: () => unknown, delay: number) {
@@ -32,31 +35,29 @@ function useInterval(callback: () => unknown, delay: number) {
3235
}, [delay]);
3336
}
3437

38+
const ImageUrl = `https://images.unsplash.com/photo-1610746334198-e7525c63509c?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&h=900`;
39+
const ThumbnailUrl = `https://images.unsplash.com/photo-1610746334198-e7525c63509c?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&h=90`;
40+
const placeholderUrl = `https://unsplash.com/a/img/empty-states/photos.png`;
41+
3542
const validSource = {
3643
title: 'Valid Image & Thumbnail',
37-
image: () =>
38-
`https://pyt-images.imgix.net/images/app/pretrip/australia.png?h=346.5&w=252&crop=fit&dpr=3&auto=format,compress,enhance&q=10&bust=${Math.random()}`,
39-
thumbnail: () =>
40-
`https://pyt-images.imgix.net/images/app/pretrip/australia.png?h=346.5&w=252&crop=fit&dpr=0.1&auto=format,compress,enhance&q=10&bust=${Math.random()}`,
41-
placeholder: () => `https://pyt-images.imgix.net/images/place-holder.png`,
44+
image: () => `${ImageUrl}&bust=${Math.random()}`,
45+
thumbnail: () => `${ThumbnailUrl}&bust=${Math.random()}`,
46+
placeholder: () => placeholderUrl,
4247
};
4348

4449
const inValidSource = {
4550
title: 'Invalid Image & Thumbnail',
46-
image: () =>
47-
`https://pyt-images.imgix.net/images/app/pretrip/nowheretobefound.png?h=346.5&w=252&crop=fit&dpr=0.3&auto=format,compress,enhance&q=10&bust=${Math.random()}`,
48-
thumbnail: () =>
49-
`https://pyt-images.imgix.net/images/app/pretrip/nowheretobefound.png?h=346.5&w=252&crop=fit&dpr=0.1&auto=format,compress,enhance&q=10&bust=${Math.random()}`,
50-
placeholder: () => `https://pyt-images.imgix.net/images/place-holder.png`,
51+
image: () => `not found`,
52+
thumbnail: () => `not found`,
53+
placeholder: () => placeholderUrl,
5154
};
5255

5356
const invalidImageOnlySource = {
5457
title: 'Invalid Image & Valid Thumbnail',
55-
image: () =>
56-
`https://pyt-images.imgix.net/images/app/pretrip/nowheretobefound.png?h=346.5&w=252&crop=fit&dpr=0.3&auto=format,compress,enhance&q=10&bust=${Math.random()}`,
57-
thumbnail: () =>
58-
`https://pyt-images.imgix.net/images/app/pretrip/australia.png?h=346.5&w=252&crop=fit&dpr=0.1&auto=format,compress,enhance&q=10&bust=${Math.random()}`,
59-
placeholder: () => `https://pyt-images.imgix.net/images/place-holder.png`,
58+
image: () => `not found`,
59+
thumbnail: () => `${ThumbnailUrl}&bust=${Math.random()}`,
60+
placeholder: () => placeholderUrl,
6061
};
6162

6263
const sources = [validSource, inValidSource, invalidImageOnlySource];
@@ -82,7 +83,10 @@ function App() {
8283

8384
return (
8485
<View style={styles.container}>
85-
<Text>{imageSource.title}</Text>
86+
<Text>Various scenarios will change every 5 seconds</Text>
87+
<Text>
88+
Scenario: <Text style={styles.titleStyle}>{imageSource.title}</Text>
89+
</Text>
8690
<BetterImage
8791
viewStyle={style}
8892
source={{
@@ -96,6 +100,30 @@ function App() {
96100
}}
97101
resizeMode={'cover'}
98102
/>
103+
<Text>
104+
Photo by{' '}
105+
<Text
106+
style={styles.titleStyle}
107+
onPress={() =>
108+
Linking.openURL(
109+
'https://unsplash.com/@vovcarrot?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText'
110+
)
111+
}
112+
>
113+
Vladimir Gladkov
114+
</Text>{' '}
115+
on{' '}
116+
<Text
117+
style={styles.titleStyle}
118+
onPress={() =>
119+
Linking.openURL(
120+
'https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText'
121+
)
122+
}
123+
>
124+
Unsplash
125+
</Text>
126+
</Text>
99127
</View>
100128
);
101129
}

0 commit comments

Comments
 (0)