我在 react-native 应用程序中使用纵向模式。但我想捕获屏幕的旋转事件。有没有办法做到这一点?
谢谢...
我正在尝试使用 FormidableLab 的react-native-app-auth库在我的 react native android 应用程序中实现 Google OAuth 2 登录,如下所示:
googleLoginPressed = async () => {
const config = {
serviceConfiguration: {
authorizationEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth', tokenEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth',
},
clientId: app_params.GOOGLE_CLIENT_ID, redirectUrl: 'https://<my_domain>/oauth/google',
scopes: ['openid', 'profile', 'email'], additionalParameters: { 'response-type': 'code' },
};
try {
const result = await authorize(config);
} catch (error) {
console.log(error);
}
}
Run Code Online (Sandbox Code Playgroud)
这会使用 Google 的登录页面调用 Web 视图,我可以成功验证自己的身份。然后 Google 正确地重定向到我的 oauth 回调端点,并code像它应该的那样在重定向 url 中填充 oauth 。在这一点上,我希望react-native-app-auth将控制权从 webview 恢复到应用程序。相反,Web 视图在重定向 url 页面上保持打开状态。 …
在 React Native 应用程序的生产中,从 firebase 的 crashlytics 获取 Android 上的错误:
Fatal exception: com.facebook.react.uimanager.IllegalViewOperationException.
Trying to update non-existent view with tag 85273.
Run Code Online (Sandbox Code Playgroud)
并且没有崩溃的情况,因此无法检测到它。我在模拟器和真正的 Android 设备上检查了很多次。
我们从这次事故中发现了什么?
public void updateView(int tag, String className, ReadableMap props) {
ViewManager viewManager = mViewManagers.get(className);
if (viewManager == null) {
throw new IllegalViewOperationException("Got unknown view type: " + className);
}
ReactShadowNode cssNode = mShadowNodeRegistry.getNode(tag);
if (cssNode == null) {
throw new IllegalViewOperationException("Trying to update non-existent view with tag " + tag);
}
if …Run Code Online (Sandbox Code Playgroud) debugging crash-reports crashlytics react-native react-native-android
我知道以前有人问过这种问题,但它们与第三方库有关,我的与 requireNativeComponent
我已经React Native从本地iOS组件创建了一个组件
这是我的iOS代码
CanvasView 文件
class CanvasView: UIView {
var lines = [[CGPoint]]()
override init(frame: CGRect) {
super.init(frame:frame)
backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 0)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func draw(_ rect: CGRect) {
super.draw(rect)
guard let context = UIGraphicsGetCurrentContext() else {
return
}
context.setStrokeColor(#colorLiteral(red: 0.9529411793, green: 0.6862745285, blue: 0.1333333403, alpha: 1))
context.setLineWidth(10)
context.setLineCap(.butt)
lines.forEach { (line) in
for(i,p) in line.enumerated() …Run Code Online (Sandbox Code Playgroud) react-native react-native-android react-native-ios react-native-native-module
我已经更新了 package.json 中的模块,现在出现错误“无法从 node_modules\uuidv4\build\lib\uuidv4.js 解析模块 util:在项目中找不到 util。”
在下面的步骤中,我已经完成了#2。我没有为 #1 使用 watchman,我在 #3 中使用的是 npm 而不是 yarn,我不知道 #4 指的是什么路径。这是我的完整输出。
PS C:\Dev\myProj> react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --资产目标 android/app/src/main/res/
(节点:16148)警告:访问循环依赖中模块导出的不存在的属性“padLevels”(node --trace-warnings ...用于显示警告的创建位置)欢迎使用 React Native!一次学习,随处书写
错误无法util从node_modules\uuidv4\build\lib\uuidv4.js以下位置解析模块:在项目中找不到 util。
如果您确定该模块存在,请尝试以下步骤:
util从node_modules\uuidv4\build\lib\uuidv4.js以下位置解析模块:在项目中找不到 util。如果您确定该模块存在,请尝试以下步骤:
当更新版本提交到 Google Play 商店时,我们被要求对我们的 React Native 应用程序进行更改。突出显示的问题是“意图重定向”漏洞。这是遗留代码,但尽管如此,迟到总比不到好。
Google 帮助指南中建议的方法之一是:
选项 2:确保提取的 Intent 来自可信赖的来源。
您可以使用 >getCallingActivity 之类的方法来验证是否可以信任发起的 Activity。例如:
// check if the originating Activity is from trusted package
if (getCallingActivity().getPackageName().equals(“known”)) {
Intent intent = getIntent();
// extract the nested Intent
Intent forward = (Intent) intent.getParcelableExtra(“key”);
// redirect the nested Intent
startActivity(forward);
}
Run Code Online (Sandbox Code Playgroud)
根据本指南更改代码时,构建显示了getCallingActivity一个未知符号的错误。代码已经使用getCurrentActivity和getApplicationContext。
我们在 React Native 应用程序中纠正本机 Java 代码中的这个漏洞的最佳方法是什么?
将深深感谢您在这里的快速支持。谢谢!
android google-play react-native android-security react-native-android
我刚刚升级到 React Native 0.63.3..... 我也升级了 Android studio4.1.1和 gradle 插件到4.1.0. 当我尝试构建时
出现错误cannot find symbol class ReactInstanceManager。
错误在文件中MainApplication.java......请参阅下面的代码。
出现错误是与行initializeFlipper(this,getReactNativeHost().getReactInstanceManager());。似乎是说我提供com.facebook.react.ReactInstanceManager....但是程序想要的是ReactInstanceManager.
它说Get the current ReactInstanceManager instance, or create one.
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context …Run Code Online (Sandbox Code Playgroud) 我有一个一般性问题和两个更具体的问题.
所有关于忽略特定警告的React-Native文档都说:
"通过使用console.disableYellowBox = true;可以在开发期间禁用YellowBoxes.通过设置应忽略的前缀数组,可以以编程方式忽略特定警告:console.ignoredYellowBox = ['Warning:...'] ;."
所以React-Native提供了这段代码,但我不知道如何指定警告的名称:
console.ignoredYellowBox = ['Warning: ReactNative.createElement'];
Run Code Online (Sandbox Code Playgroud) javascript reactjs react-native react-native-android react-native-ios
我是React Native的新手。我正在开发一个应用程序,以接收共享URL的YouTube共享中的共享URL。
我添加了代码来像这样在xml中注册接收活动
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
但是在我的App.js代码中,我如何接收数据并进行进一步处理。
react-native ×10
android ×2
appauth ×1
crashlytics ×1
debugging ×1
google-play ×1
javascript ×1
oauth-2.0 ×1
reactjs ×1