-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7156762
Showing
46 changed files
with
2,445 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
|
||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.idea | ||
Screenshots | ||
.gif | ||
|
||
# OSX | ||
# | ||
.DS_Store | ||
|
||
# Xcode | ||
# | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata | ||
*.xccheckout | ||
*.moved-aside | ||
DerivedData | ||
*.hmap | ||
*.ipa | ||
*.xcuserstate | ||
|
||
# node.js | ||
# | ||
node_modules/ | ||
npm-debug.log | ||
examples/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2016 Jia PengHui | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# react-native-easy-toast | ||
A react native module to show toast like android, it works on iOS and Android. | ||
|
||
|
||
## Content | ||
|
||
- [Installation](#installation) | ||
- [Demo](#demo) | ||
- [Getting started](#getting-started) | ||
- [API](#api) | ||
- [Contribution](#contribution) | ||
|
||
## Installation | ||
|
||
* 1.Run `npm i react-native-easy-toast --save` | ||
* 2.`import Toast, {DURATION} from 'react-native-toast-easy'` | ||
|
||
## Demo | ||
* [Examples](https://github.com/crazycodeboy/react-native-easy-toast/tree/master/examples) | ||
|
||
![Screenshots](https://raw.githubusercontent.com/crazycodeboy/react-native-easy-toast/master/examples/Screenshots/react-native-easy-toast-screenshots.gif) | ||
|
||
## Getting started | ||
|
||
Add `react-native-toast-easy` to your js file. | ||
|
||
`import Toast, {DURATION} from 'react-native-toast-easy'` | ||
|
||
Inside your component's render method, use Toast: | ||
|
||
```javascript | ||
render() { | ||
return ( | ||
<View style={styles.container}> | ||
... | ||
<Toast ref="toast"/> | ||
</View> | ||
); | ||
} | ||
``` | ||
|
||
>Note: Add it in the bottom of the root view. | ||
Then you can use it like this: | ||
|
||
```javascript | ||
this.refs.toast.show('hello world!'); | ||
``` | ||
|
||
That's it, you're ready to go! | ||
|
||
|
||
### Basic usage | ||
|
||
```javascript | ||
render() { | ||
return ( | ||
<View style={styles.container}> | ||
<TouchableHighlight | ||
style={{padding: 10}} | ||
onPress={()=>{ | ||
this.refs.toast.show('hello world!'); | ||
}}> | ||
<Text>Press me</Text> | ||
</TouchableHighlight> | ||
<Toast ref="toast"/> | ||
</View> | ||
); | ||
} | ||
``` | ||
|
||
### Custom Toast | ||
|
||
```javascript | ||
render() { | ||
return ( | ||
<View style={styles.container}> | ||
<TouchableHighlight | ||
style={{padding: 10}} | ||
onPress={()=>{ | ||
this.refs.toast.show('hello world!',DURATION.LENGTH_LONG); | ||
}}> | ||
<Text>Press me</Text> | ||
</TouchableHighlight> | ||
<Toast | ||
ref="toast" | ||
style={{backgroundColor:'red'}} | ||
position='top' | ||
/> | ||
</View> | ||
); | ||
} | ||
``` | ||
|
||
**More Usage:** | ||
|
||
[GitHubPopular](https://github.com/crazycodeboy/GitHubPopular/blob/develop/js/page/SearchPage.js) | ||
|
||
|
||
|
||
## API | ||
|
||
|
||
Props | Type | Optional | Default | Description | ||
----------------- | -------- | -------- | ----------- | ----------- | ||
style | View.propTypes.style | true | {backgroundColor: 'black',opacity: OPACITY,borderRadius: 5,padding: 10,} | Custom style toast | ||
position | PropTypes.oneOf(['top','center','bottom',]) |true | 'bottom' | Custom toast position | ||
|
||
|
||
|
||
Method | Type | Optional | Description | ||
----------------- | -------- | -------- | ----------- | ----------- | ||
show(text, duration) | function | false | show a toast | ||
close() | function | true | Close toast early | ||
|
||
|
||
## Contribution | ||
|
||
Issues are welcome. Please add a screenshot of bug and code snippet. Quickest way to solve issue is to reproduce it on one of the examples. | ||
|
||
Pull requests are welcome. If you want to change API or making something big better to create issue and discuss it first. | ||
|
||
--- | ||
|
||
**MIT Licensed** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
[android] | ||
target = Google Inc.:Google APIs:23 | ||
|
||
[maven_repositories] | ||
central = https://repo1.maven.org/maven2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[ignore] | ||
|
||
# We fork some components by platform. | ||
.*/*[.]android.js | ||
|
||
# Ignore templates with `@flow` in header | ||
.*/local-cli/generator.* | ||
|
||
# Ignore malformed json | ||
.*/node_modules/y18n/test/.*\.json | ||
|
||
# Ignore the website subdir | ||
<PROJECT_ROOT>/website/.* | ||
|
||
# Ignore BUCK generated dirs | ||
<PROJECT_ROOT>/\.buckd/ | ||
|
||
# Ignore unexpected extra @providesModule | ||
.*/node_modules/commoner/test/source/widget/share.js | ||
|
||
# Ignore duplicate module providers | ||
# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root | ||
.*/Libraries/react-native/React.js | ||
.*/Libraries/react-native/ReactNative.js | ||
.*/node_modules/jest-runtime/build/__tests__/.* | ||
|
||
[include] | ||
|
||
[libs] | ||
node_modules/react-native/Libraries/react-native/react-native-interface.js | ||
node_modules/react-native/flow | ||
flow/ | ||
|
||
[options] | ||
module.system=haste | ||
|
||
esproposal.class_static_fields=enable | ||
esproposal.class_instance_fields=enable | ||
|
||
experimental.strict_type_args=true | ||
|
||
munge_underscores=true | ||
|
||
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' | ||
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\)$' -> 'RelativeImageStub' | ||
|
||
suppress_type=$FlowIssue | ||
suppress_type=$FlowFixMe | ||
suppress_type=$FixMe | ||
|
||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(30\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) | ||
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(30\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ | ||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy | ||
|
||
unsafe.enable_getters_and_setters=true | ||
|
||
[version] | ||
^0.30.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# OSX | ||
# | ||
.DS_Store | ||
|
||
# Xcode | ||
# | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata | ||
*.xccheckout | ||
*.moved-aside | ||
DerivedData | ||
*.hmap | ||
*.ipa | ||
*.xcuserstate | ||
project.xcworkspace | ||
|
||
# Android/IJ | ||
# | ||
*.iml | ||
.idea | ||
.gradle | ||
local.properties | ||
|
||
# node.js | ||
# | ||
node_modules/ | ||
npm-debug.log | ||
|
||
# BUCK | ||
buck-out/ | ||
\.buckd/ | ||
android/app/libs | ||
android/keystores/debug.keystore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.