Skip to content

Commit 0a16675

Browse files
authored
Merge pull request #20 from ui-ninja/adding-example-app
Adding demo folder
2 parents d842c85 + 86daffe commit 0a16675

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+20034
-1
lines changed

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ node_modules
99
tmp
1010

1111
# Examples (If applicable to your project)
12-
examples
12+
demo

.vscode/settings.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"activityBar.activeBackground": "#3444a9",
4+
"activityBar.activeBorder": "#310f14",
5+
"activityBar.background": "#3444a9",
6+
"activityBar.foreground": "#e7e7e7",
7+
"activityBar.inactiveForeground": "#e7e7e799",
8+
"activityBarBadge.background": "#310f14",
9+
"activityBarBadge.foreground": "#e7e7e7",
10+
"statusBar.background": "#283482",
11+
"statusBar.border": "#283482",
12+
"statusBar.foreground": "#e7e7e7",
13+
"statusBarItem.hoverBackground": "#3444a9",
14+
"titleBar.activeBackground": "#283482",
15+
"titleBar.activeForeground": "#e7e7e7",
16+
"titleBar.border": "#283482",
17+
"titleBar.inactiveBackground": "#28348299",
18+
"titleBar.inactiveForeground": "#e7e7e799"
19+
},
20+
"peacock.color": "#283482"
21+
}

demo/.buckconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2

demo/.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};

demo/.flowconfig

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
[ignore]
2+
; We fork some components by platform
3+
.*/*[.]android.js
4+
5+
; Ignore "BUCK" generated dirs
6+
<PROJECT_ROOT>/\.buckd/
7+
8+
; Ignore polyfills
9+
node_modules/react-native/Libraries/polyfills/.*
10+
11+
; These should not be required directly
12+
; require from fbjs/lib instead: require('fbjs/lib/warning')
13+
node_modules/warning/.*
14+
15+
; Flow doesn't support platforms
16+
.*/Libraries/Utilities/LoadingView.js
17+
18+
[untyped]
19+
.*/node_modules/@react-native-community/cli/.*/.*
20+
21+
[include]
22+
23+
[libs]
24+
node_modules/react-native/interface.js
25+
node_modules/react-native/flow/
26+
27+
[options]
28+
emoji=true
29+
30+
esproposal.optional_chaining=enable
31+
esproposal.nullish_coalescing=enable
32+
33+
module.file_ext=.js
34+
module.file_ext=.json
35+
module.file_ext=.ios.js
36+
37+
munge_underscores=true
38+
39+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
40+
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
41+
42+
suppress_type=$FlowIssue
43+
suppress_type=$FlowFixMe
44+
suppress_type=$FlowFixMeProps
45+
suppress_type=$FlowFixMeState
46+
47+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
48+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
49+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
50+
51+
[lints]
52+
sketchy-null-number=warn
53+
sketchy-null-mixed=warn
54+
sketchy-number=warn
55+
untyped-type-import=warn
56+
nonstrict-import=warn
57+
deprecated-type=warn
58+
unsafe-getters-setters=warn
59+
unnecessary-invariant=warn
60+
signature-verification-failure=warn
61+
deprecated-utility=error
62+
63+
[strict]
64+
deprecated-type
65+
nonstrict-import
66+
sketchy-null
67+
unclear-type
68+
unsafe-getters-setters
69+
untyped-import
70+
untyped-type-import
71+
72+
[version]
73+
^0.122.0

demo/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

demo/.gitignore

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
24+
# Android/IntelliJ
25+
#
26+
build/
27+
.idea
28+
.gradle
29+
local.properties
30+
*.iml
31+
32+
# node.js
33+
#
34+
node_modules/
35+
npm-debug.log
36+
yarn-error.log
37+
38+
# BUCK
39+
buck-out/
40+
\.buckd/
41+
*.keystore
42+
!debug.keystore
43+
44+
# fastlane
45+
#
46+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47+
# screenshots whenever they are needed.
48+
# For more information about the recommended setup visit:
49+
# https://docs.fastlane.tools/best-practices/source-control/
50+
51+
*/fastlane/report.xml
52+
*/fastlane/Preview.html
53+
*/fastlane/screenshots
54+
55+
# Bundle artifact
56+
*.jsbundle
57+
58+
# CocoaPods
59+
/ios/Pods/

demo/.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
bracketSpacing: false,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
};

demo/.watchmanconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

demo/App.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import React, {useState} from 'react';
2+
import { StyleSheet, View, Text } from 'react-native';
3+
import { Rating } from 'react-native-rating-element';
4+
5+
const App = () => {
6+
const [rating, setRating] = useState(0);
7+
const [imageRating, setImageRating] = useState(0);
8+
9+
return (
10+
<View style={styles.body}>
11+
<View style={styles.card}>
12+
<Text style={{fontSize: 16}}>
13+
RTL direction (4.5/5, direction="row-reverse")
14+
</Text>
15+
<View accessible accessibilityLabel={"rated 4.5 out of 5"}>
16+
<Rating
17+
rated={4.5}
18+
totalCount={5}
19+
ratingColor="#f1c644"
20+
ratingBackgroundColor="#d4d4d4"
21+
size={42}
22+
readonly
23+
icon="ios-star"
24+
direction="row-reverse"
25+
/>
26+
</View>
27+
</View>
28+
29+
<View style={styles.card}>
30+
<Text style={{fontSize: 16}}>
31+
Interactive Rating (3/5, direction="column-reverse")
32+
</Text>
33+
<Rating
34+
rated={rating}
35+
totalCount={5}
36+
ratingColor="#f1c644"
37+
ratingBackgroundColor="#d4d4d4"
38+
size={32}
39+
icon="add-circle"
40+
direction="column-reverse"
41+
onIconTap={pos => setRating(pos)}
42+
/>
43+
<Text accessibilityLiveRegion="polite" accessibilityLabel={`Rating selected ${rating} out of 5`}>{rating}/5 (200)</Text>
44+
</View>
45+
46+
<View style={styles.card}>
47+
<Text style={{fontSize: 16}}>
48+
Custom Images Rating
49+
</Text>
50+
<Rating
51+
rated={imageRating}
52+
totalCount={5}
53+
size={48}
54+
direction="row"
55+
type="custom"
56+
onIconTap={pos => setImageRating(pos)}
57+
selectedIconImage={require('./assets/filled.png')}
58+
emptyIconImage={require('./assets/empty.png')}
59+
/>
60+
<Text accessibilityLiveRegion="polite" accessibilityLabel={`Rating selected ${imageRating} out of 5`}>{imageRating}/5 (100)</Text>
61+
</View>
62+
63+
</View>
64+
);
65+
};
66+
67+
const styles = StyleSheet.create({
68+
body: {
69+
backgroundColor: '#fff',
70+
flex: 1,
71+
alignItems: 'center',
72+
justifyContent: 'center',
73+
},
74+
card: {
75+
padding: 10,
76+
borderWidth: 1,
77+
borderColor: '#eee',
78+
marginBottom: 20,
79+
},
80+
});
81+
82+
export default App;

0 commit comments

Comments
 (0)