remobile / react-native-toast Goto Github PK
View Code? Open in Web Editor NEWA android like toast for android and ios, android use native toast, ios use UIView+Toast
License: MIT License
A android like toast for android and ios, android use native toast, ios use UIView+Toast
License: MIT License
react-native: 0.34.1
I followed the instructions, rebuilt and tried to trigger it on the app, but no Toaster. I can't seem to find anything on the logs either.
因为ios没有 toast 才用,本来android也想用,但提示的位置太偏下了,不知道怎么调整(ios的位置可以直接在UIView.m里面调,很方便)。
很奇怪为什么1.0.6不行,1.0.5就可以,而且1.0.5不用去调 Header Search Paths,1.0.6调了也没用。
感谢
在安卓上报这个错,在Toast.java中重写canOverrideExistingModule
方法解决了这个问题,我用的是rn0.37
@Override
public boolean canOverrideExistingModule() {
return true;
}
android的 暴露的module名称与javascript引用不一致。 Toast.java里面写的
@OverRide
public String getName() {
return "RCTToast";
}
与index.js 里面的 var RCTToast= NativeModules.Toast; 对应不上。
应该改为 var RCTToast= NativeModules.RCTToast;
libCRTToast.a not exists
when i import this component, project will be fail with ' "RCTLog.h" cannot be found'!
this is cause by wrong head search path in this project, should replace "$(SRCROOT)/../../../react-native/React" to "$(SRCROOT)/../../react-native/React"
iOS需要使用下面的方式安装
方式一: npm install react-native-toast --save
使用: var Toast = require('react-native-toast');
或者: import Toast from 'react-native-toast';
方式二: npm install @remobile/react-native-toast --save
使用: var Toast = require('@remobile/react-native-toast');
或者: import Toast from '@remobile/react-native-toast';
package.json
"dependencies": {
"@remobile/react-native-toast": "^1.0.5",
}
use
import Toast from '@remobile/react-native-toast';
render() {
return (
<TouchableOpacity onPress={Toast.showShortTop.bind(null, "this is a message")}>
Hello fffworld!
)
}
error:
undefined is not an object(evaluating 'RECTToast.show')
cannot read property 'show' of undefined
May I ask what is the reason?
'RCTLog.h' file not found
I can not run on RN 0.65, manual configuration is not working.
System:
OS: macOS 10.15.2
CPU: (4) x64 Intel(R) Core(TM) i5-5675R CPU @ 3.10GHz
Memory: 657.49 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.12.0 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 24, 27, 28
Build Tools: 27.0.3, 28.0.3
System Images: android-25 | Google Play Intel x86 Atom
IDEs:
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
npmGlobalPackages:
react-native-git-upgrade: 0.2.7
When I compile this with new RN 0.57 I get the following errors:
The project name '@remobile/react-native-toast' contains at least one of the following characters: [ , /, \, :, <, >, ", ?, *, |]. This has been deprecated and is scheduled to be removed in Gradle 5.0. Set the 'rootProject.name' or adjust the 'include' statement (see https://docs.gradle.org/4.4/dsl/org.gradle.api.initialization.Settings.html#org.gradle.api.initialization.Settings:include(java.lang.String[]) for more details).
> Configure project :@remobile/react-native-toast
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.4.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
and
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
/home/mieszko4/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/2894229df102aba6e62f0ed03c56206b/res/values-v26/values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.
/home/mieszko4/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/2894229df102aba6e62f0ed03c56206b/res/values-v26/values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.
/home/mieszko4/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/2894229df102aba6e62f0ed03c56206b/res/values-v26/values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
/home/mieszko4/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/2894229df102aba6e62f0ed03c56206b/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/fontStyle not found.
/home/mieszko4/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/2894229df102aba6e62f0ed03c56206b/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/font not found.
/home/mieszko4/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/2894229df102aba6e62f0ed03c56206b/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/fontWeight not found.
error: failed linking references.
This happens when I run for release (for debug it works ok)
I am using com.android.tools.build:gradle:3.1.4
As a workaround the following helps:
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
Merge #34 for a fix
If not then this should be added as a feature request.
如果modal关闭后 toast就不显示了。 还有一点问题是在底部显示时会被输入法给遮盖住。
作者可以考虑下下?Consider it ?
Error:A problem occurred configuring project ':app'.
A problem occurred configuring project ':react-native-device-info'.
Could not resolve all dependencies for configuration ':react-native-device-info:_debugCompile'.
> Could not find any matches for com.google.android.gms:play-services-gcm:+ as no versions of com.google.android.gms:play-services-gcm are available.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/android/gms/play-services-gcm/maven-metadata.xml
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/android/gms/play-services-gcm/
https://jitpack.io/com/google/android/gms/play-services-gcm/maven-metadata.xml
https://jitpack.io/com/google/android/gms/play-services-gcm/
file:/Users/jq/.m2/repository/com/google/android/gms/play-services-gcm/maven-metadata.xml
file:/Users/jq/.m2/repository/com/google/android/gms/play-services-gcm/
https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/maven-metadata.xml
https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/
file:/Volumes/JQ/ecfs/EcfsCreateCase/node_modules/react-native/android/com/google/android/gms/play-services-gcm/maven-metadata.xml
file:/Volumes/JQ/ecfs/EcfsCreateCase/node_modules/react-native/android/com/google/android/gms/play-services-gcm/
file:/Volumes/Transcend/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-gcm/maven-metadata.xml
file:/Volumes/Transcend/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-gcm/
file:/Volumes/Transcend/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-gcm/maven-metadata.xml
file:/Volumes/Transcend/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-gcm/
Required by:
EcfsCreateCase:react-native-device-info:unspecified
can i change color and backgroundColor
Hi, I'm new to Xcode and try to install your toast module.
First it would be helpful to describe the steps more details. Especially I do not fully get the last point...
Look for Header Search Paths and make sure it contains both $(SRCROOT)/../../../react-native/React as recursive.
What should be exactly defined as HEADER_SEARCH_PATHS?
Within React JS file I tried...
import Toast from '@remobile/react-native-toast';
Toast.showLongCenter.bind(null, "this is a message");
But no error and no Toast. Any idea?
Adding a small sample project might be quite helpful.
final String message = options.getString("message");
System.out.println("-----" + message);
这是 传递过来的 message.假设 message 为 “Hello world”.
iOS 显示为 Hello world,
android 显示为 项目名:Hello world.
我也做安卓,然而是在不明白这是为什么啊?
编译报错:
Unable to find module with Gradle path ':@remobile/react-native-toast' (needed by module 'app'.)
settings.gradle
include ':@remobile/react-native-toast'
project(':@remobile/react-native-toast').projectDir = new File(rootProject.projectDir, '../node_modules/@remobile/react-native-toast/android')
app 中 build.gradle
compile project(':@remobile/react-native-toast')
请问有人遇到过同样的问题吗?
Could not resolve all dependencies for configuration ':@remobile/react-native-toast:debugCompileClasspath'.
请问这是我的项目哪里配置不对吗?
Update Readme Example to be
var Toast = require('@remobile/react-native-toast');
This sorted my issue
Hi,
In our project we use react-navigation
and we want to display a toast after a a page change.
We first set a delay of 200ms to wait for the user to be on the new page but it was not working and we were forced to wait for 1s.
Here is a part of our saga :
yield put(
NavigationActions.reset({
index: 0,
actions: [NavigationActions.reset({ routeName: 'getStarted' })],
key: null,
})
);
yield put(setLoading('saveAndExit', false));
yield call(delay, 1000);
Toast.showLongBottom(I18n.t('saveAndExitModal.successToast'));
We think it's because it's conflicting with the animation of the page change. Do you have a clue on how to fix this ?
(It's working well on Android with 200ms)
thanks
Have successfully linked lib with Xcode, but toast is not showing on button click.
var Toast = require('@remobile/react-native-toast');
onChipSelected(id,dataArr){
Toast.show.bind(null, "this is a message");
}
example bug
should change var Toast = require('react-native-toast');
to var Toast = require('@remobile/react-native-toast');
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.