标签: react-native-android

我在 react native 中遇到错误 - fontFamily“ionicons”不是系统字体

我在 react native 中遇到以下错误 - fontFamily“ionicons”不是系统字体,还没有通过 Font.loadAsync 加载。

  • 如果您打算使用系统字体,请确保您输入的名称正确并且您的设备操作系统支持它。

我正在尝试导入博览会矢量图标。

import { Ionicons } from '@expo/vector-icons';
Run Code Online (Sandbox Code Playgroud)

并使用图标

<Button transparent>
            <Ionicons name="md-checkmark-circle" size={32} color="green" />
        </Button>
Run Code Online (Sandbox Code Playgroud)

但得到上述错误。

react-native react-native-android

5
推荐指数
2
解决办法
1万
查看次数

在 React Native Android 中未指定 compileSdkVersion 错误

当我尝试在 React Native 项目中构建 Android 应用程序时出现构建错误。

当我运行时react-native run-android,它说:

> Configure project :react-native-os
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

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':react-native-os'.
> compileSdkVersion is not specified.
Run Code Online (Sandbox Code Playgroud)

在 Android Studio 中,我可以看到它说的是同样的话: Cause: compileSdkVersion is not specified.

所以我在 Android Studio 中编辑了 build.gradle(Module: app) 文件,但问题仍然存在,错误信息没有改变。

android { …
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin react-native react-native-android

5
推荐指数
2
解决办法
2万
查看次数

如何使用 React-Native 在移动应用中实现类似 youtube 播放器的 Mini View

我想在 React-Native 中实现一个迷你视图或浮动视图,在我们关闭它之前应该保持或打开它,如果我们导航到其他屏幕,它应该保持打开状态吗? 在此处输入图片说明

reactjs react-native react-native-android react-native-ios react-navigation

5
推荐指数
1
解决办法
3426
查看次数

在 React Native 中生成多个 APK?

我在 Android 中生成 APK 时遇到一些问题,我正在使用此命令在我的本机项目中生成一个版本

./gradlew assembleRelease
Run Code Online (Sandbox Code Playgroud)

发布后我得到了不止一个APK,

APK

那是什么?哪一个是对的!

我试图在我的真实设备上运行它,但每一个都崩溃了!

版本反应原生:“0.59.8”

在这里文件app/build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations …
Run Code Online (Sandbox Code Playgroud)

javascript android android-studio react-native react-native-android

5
推荐指数
1
解决办法
2833
查看次数

反应原生构建错误:无法确定当前字符,它不是字符串、数字、数组或对象

这是我得到的错误:

FAILURE: Build failed with an exception.

* Where:
Script 'D:\Mobile Projects\XXX\XXX\XXX\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 191

* What went wrong:
A problem occurred evaluating settings 'XXX'.
> Unable to determine the current character, it is not a string, number, array, or object

  The current character read is 'E' with an int value of 69
  Unable to determine the current character, it is not a string, number, array, or object
  line number 1
  index number 0
  Error: Attribute without valueLine: 26Column: 41Char: i …
Run Code Online (Sandbox Code Playgroud)

javascript react-native react-native-android

5
推荐指数
3
解决办法
7738
查看次数

在bottomTab 配置中设置图标大小 react-native-navigation

我正在用 react native 开发一个应用程序,并使用 react-native-navigation 库来创建一个底部选项卡。

在这里,我无法提供底部图标的大小。我现在正在使用大小为 25*25 的图标,这在高分辨率设备中是模糊的。当我使用较大的图标(例如 30*30)时,图标仅在 ios 中相互重叠。

react-native-navigation 库链接 - https://wix.github.io/react-native-navigation/#

以下是我浏览过的链接:-

https://github.com/wix/react-native-navigation/issues/3527#

https://github.com/wix/react-native-navigation/issues/4420

Navigation.setRoot({
        root: {
            bottomTabs: {
                children: [

                    {

                        stack: {
                            id: Stackid.Stackid2,
                            children: [
                                {
                                    component: {
                                        name: ScreenId.Screen1Stack,

                                    }
                                },
                            ],

                            options: {

                                bottomTab: {
                                    text: 'Tab1',
                                    fontSize: 12,
                                    icon: require('../assets/firstImage.png'), 
                                    iconColor:'red',
                                    currentTabId: Stackid.Screen1,
                                    selectedIconColor: 'green',
                                    textColor: 'white',
                                    selectedTextColor: 'green',


                                },
                                topBar: {
                                    drawBehind: true,
                                    visible: false,
                                    animate: false,
                                },
                                statusBar: {
                                    visible: true,
                                    backgroundColor: 'grey',
                                    drawBehind: false,
                                    style: "light" …
Run Code Online (Sandbox Code Playgroud)

javascript react-native react-native-android react-native-ios wix-react-native-navigation

5
推荐指数
1
解决办法
4028
查看次数

EISDIR:对目录的非法操作,在 React Native 文件系统中读取

我正在尝试使用以下代码将文件复制到另一个外部文件夹的简单代码:

RNFS.copyFile(sourcePath, destinationPath)
.then(result => {
  console.log('file copied:', result);
})
.catch(err => {
  console.log('error: ', err.message, err.code);
});
Run Code Online (Sandbox Code Playgroud)

我已经授予Android.Permission在外部目录中进行读写的权限,但它仍然返回此错误:

error:  EISDIR: illegal operation on a directory, read '/storage/emulated/0/' EISDIR
Run Code Online (Sandbox Code Playgroud)

这是依赖项:

"react": "16.9.0",
"react-native": "0.61.2",
"react-native-fs": "^2.15.2"
Run Code Online (Sandbox Code Playgroud)

顺便说一句,我请求正确的许可吗?

PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE 
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
Run Code Online (Sandbox Code Playgroud)

提前感谢您的帮助

android react-native react-native-android react-native-fs

5
推荐指数
1
解决办法
7994
查看次数

如何在 React-Native 中渲染 svg 图像?

请尝试帮助我!我需要在 android 和 ios 视图上从我的文件夹“project/assest/images/test.svg”渲染 svg 图像。

我试过了 :

解决方案1: <Image source={imagePath}></Image>

解决方案2:

import SvgUri from 'react-native-svg-uri';
 <View>
    <SvgUri
      width="200"
      height="200"
      source={{uri:'http://thenewcode.com/assets/images/thumbnails/homer-simpson.svg'}}
    />
  </View>
Run Code Online (Sandbox Code Playgroud)

解决方案 3:首先,我应该将 svg 文件转换为 png、jpeg,然后渲染简单的图像,但这种方式非常奇怪

请帮忙,我在这方面做错了什么。

reactjs react-native react-redux react-native-android react-native-navigation

5
推荐指数
1
解决办法
9452
查看次数

如何从 React Native 中“从现在开始”的自定义日期和时间获得周/天/小时/分钟前?

我有一个日期和时间格式:2019-11-25 09:49:19. 我们如何将其与当前日期和时间进行比较,并且可以显示如下:3 days ago或weeks/ hours/ min ago

reactjs react-native react-native-android

5
推荐指数
2
解决办法
3294
查看次数

在 Focus React Native Paper 上更改 TextInput 样式

首先,我研究了其他帖子并找到了很多解决方案,但在 React Native Paper 中没有任何效果?

我需要在 React Native Paper 中更改 TextInput Style on Focus

android reactjs react-native react-native-android react-native-paper

5
推荐指数
1
解决办法
5623
查看次数