我是React Native的新手.如何通过调用返回到它之前刷新/重新加载以前的屏幕goBack()?
可以说我们有3个屏幕A,B,C:
A -> B -> C
Run Code Online (Sandbox Code Playgroud)
当我们goBack()从屏幕C 运行时,它返回到屏幕B但是具有旧的状态/数据.我们怎样刷新它?第二次没有调用构造函数.
react-router react-native react-native-android react-native-ios react-native-navigation
我试图在我的系统上安装 React Native,但发现它无法安装该模板错误所需的 CocoaPods 依赖项。
sudo arch -x86_64 gem install ffi修复了这个问题,但最终出现event-config.h" file not found错误。
我将 pod 文件中的更改后的鳍状肢版本更改为use_flipper!({'Flipper'=>'0.76.0'}),然后我遇到了上面提到的错误。对此问题的任何帮助将不胜感激。
node version : 15.10.0
react-native version: 0.63.4
Xcode version: 12.4
Run Code Online (Sandbox Code Playgroud)
错误说明如下:
Showing Recent Messages
Could not find or use auto-linked library 'swiftCoreGraphics'
Could not find or use auto-linked library 'swiftUIKit'
Could not find or use auto-linked library 'swiftDarwin'
Could not find or use auto-linked library 'swiftFoundation'
Could not find or use auto-linked library 'swiftMetal'
Could not find or …Run Code Online (Sandbox Code Playgroud) 对于Android我知道我可以使用,StatusBar.currentHeight 但我不知道如何为iOS做到这一点.
如何在Swift(本机)中检索大小的答案已经得到了解答,但我需要在本机应用程序中使用它.
我试图在webweb中显示加载指示符如下.正在显示加载指示器,但页面加载后会显示白色背景.如果我将startInLoadingState更改为false,则会显示Web内容,但不会显示加载指示符.它正在ios中"反应原生":"0.46.3"
renderLoadingView() {
return (
<ActivityIndicator
animating = {this.state.visible}
color = '#bc2b78'
size = "large"
style = {styles.activityIndicator}
hidesWhenStopped={true}
/>
);
Run Code Online (Sandbox Code Playgroud)
}
<WebView
source={source}
renderLoading={this.renderLoadingView} startInLoadingState={true} />
Run Code Online (Sandbox Code Playgroud) 当我尝试$ react-native run-androidAndroid模拟器时,我收到此错误:
:app:compileDebugJavaWithJavac
/home/user/app/android/app/src/main/java/com/package/MainApplication.java:8: error: a type with the same simple name is already defined by the single-type-import of RNAWSCognitoPackage
import com.airlabsinc.RNAWSCognitoPackage;
^
1 error
Incremental compilation of 1 classes completed in 0.448 secs.
:app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug …Run Code Online (Sandbox Code Playgroud) 在ios /目录中的我的react-native项目(react-native@0.60)中,我运行pod install并得到以下错误:
[!] Invalid `Podfile` file: no implicit conversion of nil into String.
# from /Users/coryrobinson/projects/hhs2/ios/Podfile:37
# -------------------------------------------
#
> use_native_modules!
# end
# -------------------------------------------
Run Code Online (Sandbox Code Playgroud)
我没有在此Podfile中添加或更改任何内容-它们都是react-native生成的。(我没有iOS开发经验,所以这可能是一个简单的解决方法,我只是不知道要寻找什么:-|)感谢您的帮助!
这是我的Podfile
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'hhs2' do
# Pods for hhs2
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/React'
pod 'React-DevSupport', :path => '../node_modules/react-native/React'
pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path …Run Code Online (Sandbox Code Playgroud) 当我尝试为“任何 iOS 设备”进行归档构建时,我收到此错误:
找不到构建输入文件:'/Users/.../Library/Developer/Xcode/DerivedData/[app]-czrkuohjfzuzzxfobfoyptxhyoyo/Build/Intermediates.noindex/ArchiveIntermediates/[app]/InstallationBuildProductsLocation/Applications/[产品名称]。应用程序/[产品名称]'
我在为 iOS 模拟器构建时收到了同样的错误,但这篇文章修复了它 -升级到 Xcode 12:ld 后的问题:为 iOS 模拟器构建,但在为 iOS 构建的 dylib 中链接,架构 arm64。
我还收到有关可能与错误相关或不相关的架构的警告:
ARCHS (arm64) 中的架构均无效。考虑将 ARCHS 设置为 $(ARCHS_STANDARD) 或更新它以包含至少一个来自 VALID_ARCHS (arm64, armv7s, armv7) 的值,该值不在 EXCLUDED_ARCHS (arm64) 中。
正如标题所示,我正在开发一个具有输入文本的应用程序,当我尝试粘贴剪贴板上的文本时,它不会执行任何操作,但它显示新通知说“剪贴板中的文本是评估”。
之后,我安装@react-native-community/clipboard并尝试手动将某些内容发送到剪贴板:
Clipboard.setString('https://google.com');
const text = await Clipboard.getString();
console.log('clipboard', { text });
Run Code Online (Sandbox Code Playgroud)
它总是空的......但是:如果我切换到不同的应用程序,它会粘贴我发送的 URL;如果我在设备上运行该应用程序,它就会工作。
现在,有关环境的一些信息:
我已经尝试过的东西:
@react-navigation/native)我不知道还要测试什么。
我试图在我的react-native应用程序中使用react-native-fbsdk.它一直很好,直到昨天.但是,今天它给出了一个奇怪的错误,说明RCTJSONStringify()遇到以下错误:JSON写入(NSURL)中的类型无效.
RN v0.42.0
这是我的代码:
_fbAuth(error, result) {
if (error) {
console.log("error");
alert("login has error: " + result.error);
} else if (result.isCancelled) {
console.log("login cancelled");
alert("login is cancelled.");
} else {
AccessToken.getCurrentAccessToken().then((data) => {
console.log("login success");
console.log(data.accessToken.toString());
let accessToken = data.accessToken;
alert(data.accessToken.toString());
const responseInfoCallback = (error, result) => {
if (error) {
console.log(error);
} else {
console.log(result);
}
}
const infoRequest = new GraphRequest(
'/me',
{
accessToken: accessToken,
parameters: {
fields: {
string: 'email,name,first_name,middle_name,last_name'
}
}
},
responseInfoCallback …Run Code Online (Sandbox Code Playgroud) 是否可以只向一个方向滚动?我有一个功能,可以检测用户滚动的方向.
但我无法弄清楚如何设置一个标志,如果用户没有回答问题,它将不允许他向右滚动?
谢谢
react-native react-native-scrollview react-native-android react-native-ios
react-native-ios ×10
react-native ×9
ios ×5
android ×1
cocoapods ×1
react-router ×1
reactjs ×1
swift ×1
xcode ×1
xcode12 ×1