我是 React Native 的新手,我想在关闭我的应用程序后知道 AsyncStorage 是否清晰。AsyncStorage 是否有任何替代方案。
我编写了一个混合应用程序,它使用react-native-svg在 react-native 视图中渲染 svg 图像。一切正常。今天,当我为我的应用程序创建发布 apk 并将其部署到模拟器时,它因错误而崩溃:
E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.example.packagname, PID: 8574
java.lang.IllegalStateException: java.lang.NoSuchFieldException: mFill
at com.horcrux.svg.q.a(Unknown Source:78)
at com.horcrux.svg.i$1.a(Unknown Source:9)
at com.horcrux.svg.aa.a(Unknown Source:22)
at com.horcrux.svg.i.b(Unknown Source:14)
at com.horcrux.svg.i.a(Unknown Source:10)
at com.horcrux.svg.t.a(Unknown Source:104)
at com.horcrux.svg.t.c(Unknown Source:25)
at com.horcrux.svg.t.a(Unknown Source:7)
at com.facebook.react.uimanager.u.a(Unknown Source:5)
at com.facebook.react.uimanager.ag.a(Unknown Source:56)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34) …Run Code Online (Sandbox Code Playgroud) 我读
但这些不是react-native-firebase的解决方案。
我正在react-native-firebase用来处理通知。在前台,一切正常。我坚持使用后台状态。
我正在做一个聊天项目并制作一对一通话功能。当客户有电话时,我会向他们推送数据通知。在 iOS 中,我在客户端收到通知时使用了 CallKit,它运行良好。但是在 Android 中我有一个问题:我可以显示 ConnectionService UI 进行调用,但无法连接到我的 Web 套接字服务器,因为它在 Headless JS 服务上运行。所以我尝试自动打开应用程序。我想将呼叫屏幕显示为 Skype,并接受/拒绝呼叫。(Skype 可以在我有电话时启动该应用程序)
总结,成功步骤:
卡在这里:
TL;DR - 如何从 Headless JS 服务启动/运行/打开 Android 应用程序?
我深入研究 react-native-firebase,它捕获通知onMessageReceived并将通知消息发送到 Headless JS 服务。
// If the app is in the background we send it to the Headless JS Service
Intent headlessIntent = new Intent(
this.getApplicationContext(),
RNFirebaseBackgroundMessagingService.class …
我在一加 6 上打开相机时遇到了 react-native-image-picker 和 react-native-image-crop-picker 的问题。使用打开相机时,打开相机的后台应用程序(我的应用程序)崩溃。它进入白屏并重新启动应用程序。此外,react-native log-android 中没有日志。我确实设法使用 android studio 和 logcat 发现一旦相机打开应用程序就会立即崩溃并留下一个死的进程。问题是我找不到任何实际的崩溃日志。尽管事先我收到了很多“访问被拒绝找到属性“vendor.debug.egl.swapinterval””,但经过一些研究,这些信息似乎并不相关。
目前这个问题只发生在我的一加 6T 上。这些问题不会发生在模拟器或 IOS 上。即使不是在我试过的 xiamoi 设备上。
我已经尝试了从在图像裁剪选择器中压缩图像(代码一)到尝试压缩图像并在 react-native-image-picker(代码二)中使用 noData 标志的所有方法。另外,100%有权限,甚至可以在应用权限=>{我的应用}中的android系统权限中看到它此外,我尝试清理我的一加6t相机的缓存,卸载-重新安装我的应用,并将开发者选项重置为默认。
我基本上已经解决了 github 中两个库的所有问题,但没有任何效果。
ImagePicker.openCamera({
width: 800,
height: 600,
compressImageMaxWidth: 640,
compressImageMaxHeight: 480,
compressImageQuality: 0.8
}).then(image => {
console.log(image);
}).catch(e => console.log(e));
Run Code Online (Sandbox Code Playgroud)
ImagePicker.launchCamera({noData: true, maxWidth: 800, maxHeight: 600, quality: 0.8}, (response) => {
console.log('Response = ', response);
if (response.didCancel) {
console.log('User cancelled image picker');
} else if (response.error) {
console.log('ImagePicker Error: ', response.error);
} else if …Run Code Online (Sandbox Code Playgroud) 执行时出现此错误
react-native run-android
Run Code Online (Sandbox Code Playgroud)
我尝试将 tools.jar 文件复制到 JRE 安装位置,重新安装 JDK 和 JRE,检查路径的环境变量。没有任何效果。
它返回以下异常
info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details
> Task :app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that C:\Program Files (x86)\Java\jre1.8.0_211 contains a valid JDK installation …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Android 上实现类似于谷歌地图“探索”的 UI 布局,(参见gif)在 React Native 中。
在我的 UI 设计中,我在屏幕底部有应用程序导航选项卡,具有完整的页面地图背景,覆盖有来自选项卡上方的“底部工作表”,以及顶部的搜索框组件。请参阅下面的 UI 草图。
我发现了各种看起来很有用的 react-native ui 组件,但我无法弄清楚将它们排列在我想要的布局中的样式。
我正在查看的几个底部组件,例如 rn-bottom-drawer 显示的 gifs 类似于我尝试创建的内容,例如这个动画,但我找不到该 UI 的实际代码示例创建。例如,同一个库示例仅在空屏幕上显示底部抽屉。
什么样的包装元素和样式组合可以让我创建所描述的布局?我来自 XAML 背景,这种布局很容易创建,但我无法理解如何在 React Native 中做到这一点。
react-native bottom-sheet react-native-android react-native-flexbox
我们最近发布了一个 ReactNative 应用程序,但我们收到了许多关于 android 的崩溃报告,其中包含java.lang.RuntimeExceptionBinder.java android.os.TransactionTooLargeException: data parcel size X(between 400k to 750k) bytes.
在我们的应用程序中,我们有一个无限滚动列表(Flatlist),它可以变得非常大(2k + 记录),这被怀疑是导致此问题的原因。我已经看到https://github.com/facebook/react-native/issues/19458打开了,但没有解决方案。还使用建议的工具(TooLargeTool)在那里指出在进入后台时会保存 0 个字节。
有没有人解决过这个问题或对如何解决它有任何意见?
谢谢
android react-native react-native-android transactiontoolargeexception
我正在尝试在 React Native android 应用程序中显示下拉菜单。我为此目的使用了 React Native Picker,但它在样式和下拉菜单定位方面似乎非常有限。我无法让菜单在carret(向下箭头按钮)位置下方弹出。
我尝试设置边距,希望将菜单向下推,但无济于事。
<Picker
// selectedValue={stateValue}
style={{
height: 36,
width: 261,
}}
onValueChange={itemValue => {
console.log('item value ', itemValue);
}}
>
<Picker.Item key={-1} label={'Search By...'} value="first" />
{this.searchCategory.map((item, index) => (
<Picker.Item key={index} label={item} value={item} />
))}
</Picker>
</View>
Run Code Online (Sandbox Code Playgroud)
菜单始终覆盖 Picker 组件。我希望它出现在选择器下方。
实际行为:
我的 AndroidManifest 是
在我写的索引中
AppRegistry.registerHeadlessTask('RNFirebaseBackgroundMessage', () => firebaseBackgroundMessage);
这firebaseBackgroundMessage是一个功能如下
export async function firebaseBackgroundMessage(message: RemoteMessage) {
let notif=message['data']; console.log(notif); return Promise.resolve();}
Run Code Online (Sandbox Code Playgroud)
我在后台和前台状态收到 fcm 消息,但是
在关闭状态没有收到任何 fcm 消息,在控制台日志中我有这个错误
No task registered for key RNFirebaseBackgroundMessage
Run Code Online (Sandbox Code Playgroud)
任何解决方案?非常感谢您的帮助...
尝试react-native run-ios从 xcode运行或构建 RN 项目,一旦 Metro bundler 启动,终端中就会出现此错误:
Loading dependency graph...jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
Usually this happens when watchman isn't running. Create an empty `.watchmanconfig` file in your project's root folder or initialize a git or hg repository in your project.
Error: Watchman error: resolve_projpath: path `/Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA`: open: /Users/vorousjames/Desktop/Development/TicTacWHOA/app/TicTacWHOA: Operation not permitted. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html.
events.js:183
throw er; // Unhandled 'error' event
^
Error: resolve_projpath: path …Run Code Online (Sandbox Code Playgroud) terminal watchman react-native react-native-android react-native-ios
react-native ×10
android ×2
asyncstorage ×1
bottom-sheet ×1
reactjs ×1
svg ×1
terminal ×1
transactiontoolargeexception ×1
watchman ×1