标签: react-native-android

在react-native中调试本机java代码

有没有办法调试使用的Android应用程序的本机java代码react-native.具体来说,我想调试我在我的react-native应用程序中使用的第三方Android软件包.有关如何调试js代码的博客帖子和stackoverflow问题,但我没有找到任何描述如何调试本机java代码的帖子.我试图将第三方Android软件包导入Android Studio,并试图在调试器中运行它,但没有发生任何我想到的事情.

请告诉我是否以及如何实现.谢谢!

android react-native react-native-android

8
推荐指数
1
解决办法
4284
查看次数

由于尚未附加催化剂实例,因此无法将触摸分派给 JS

我正在使用react-native-share-extension来共享图库中的图像。所以我使用两个活动(MainActivity 和 ShareActivity)。

但是当 ShareActivity 完成时,主应用程序没有任何反应。所有 UI 组件都已停止。

Android 监视器消息显示“由于尚未附加催化剂实例,因此无法将触摸分派到 JS”

我的代码如下。

AndroidManifest.xml

<activity
    android:noHistory="true"
    android:name=".share.MyShareActivity"
    android:configChanges="orientation"
    android:label="@string/title_activity_share"
    android:screenOrientation="portrait"
    android:launchMode="standard"
    android:theme="@style/Theme.Share.Transparent" >
   <intent-filter>
     <action android:name="android.intent.action.SEND" />
     <category android:name="android.intent.category.DEFAULT" />
     <data android:mimeType="*/*" />
   </intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)

MyShareActivity.java

package com.mobileopenalm.share;

import android.app.Activity;
import android.os.Bundle;

import com.facebook.react.ReactActivity;
import com.github.alinz.reactNativeShareExtension.ShareExActivity;
import com.mobileopenalm.BuildConfig;


public class MyShareActivity extends ReactActivity {
    static MyShareActivity myActivity = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        myActivity = this;
    }

    @Override
    protected String getMainComponentName() {
        return "MyShareEx";
    }

    @Override …
Run Code Online (Sandbox Code Playgroud)

reactjs react-native react-native-android

8
推荐指数
0
解决办法
2598
查看次数

使用React-Native在图像周围环绕文本

我尝试创建一个带有图像的视图和一个包裹Image组件的Text组件.

我的造型:

  textContainer: {
    flexDirection: 'row',
  },
  text: {
    flex: 10,
  },
  image: {
    flex:1,
    height: 180,
    width: 150,    
    margin: 10,
    borderColor: '#ccc',
    borderWidth: 1,
  }
Run Code Online (Sandbox Code Playgroud)

我的组件:

<ScrollView style={styles.contentContainer} >
   {this.props.content.title_1 ? <Text style={styles.title}>{this.props.content.title_1}</Text> : null}
   <View style={styles.textContainer}>
      {this.props.content.text_1 ? <Text style={styles.text}>{this.props.content.text_1}</Text> : null}
      {this.props.content.image_1 ? <Image width={null} height={null} style={styles.image} source={this.props.content.image_1} /> : null}
   </View>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

这就是结果:(根本没有包装哈哈)

在此输入图像描述

在这里的图片中,我很快将小图片刻录到文本中.但我无法将文字包裹起来..

例

我希望任何人都可以帮助我朝着正确的方向前进!

word-wrap react-native react-native-android

8
推荐指数
1
解决办法
3698
查看次数

"不幸的是,app已停止"在Android上构建React Native项目时出错

我正在尝试运行用React Native编写的项目,应用程序崩溃:

错误图片

此线程上声明的解决方案无关紧要,因为enableProguardInReleaseBuilds变量已配置为false.

我也有RCT视频的问题,用这个线程解决了所以它可能是相关的.

提前致谢.

react-native react-native-android

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

如何使用React-Native的APK扩展文件

即时通过使用大尺寸的声音文件构建应用程序.所以我的apk文件比100Mb限制大得多的问题,我需要使用APK扩展文件.我试着在互联网上搜索如何处理这个问题,但一无所获.也许你们中的一些人已经面临这个问题,现在如何解决它.

谢谢.

android apk-expansion-files react-native react-native-android

8
推荐指数
0
解决办法
499
查看次数

在 react-native 项目中包含 scss?

有没有办法在本机应用程序中使用 scss 文件?我只是好奇并且对 react-native 应用程序架构没有太多了解,但是我想使用我当前的项目 scss 文件来处理我们计划构建的新 react-native-android 项目。

反应原生版本:“0.46.4”

反应版本:“16.0.0-alpha.12”

BABEL-PRESET-REACT-NATIVE:“2.1.0”

更新 :

我搜索了一点发现css-to-react-native这有点让我将我的 css 转换为 react-native 样式表对象,对我来说有点解决方法。

谢谢。

react-native react-native-android

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

ios键盘覆盖了位于屏幕底部的输入

ios键盘覆盖了位于屏幕底部的输入。如何解决这个问题?

这是代码。

 <Content style={styles.content}>

            <Form>
              <Item style={{borderBottomColor:'#42e8f4'}}>
                <Icon active name='mail' style={{color: '#42e8f4'}} />
                <Input placeholder='Email'placeholderTextColor= '#42e8f4' style={{color:'#0dc49d'}}/>
              </Item>
              <Item style={{ borderBottomColor:'#42e8f4'}}>
                <Icon active name='lock' style={{color: '#42e8f4'}} />
                <Input secureTextEntry={true} placeholder='Password'placeholderTextColor= '#42e8f4' style={{color:'#42e8f4'}}/>
              </Item>
            </Form>
            <ListItem style={{borderBottomWidth:0,borderTopWidth:0,borderBottomColor:'#42e8f4'}}>
              <Button transparent onPress={() => this.props.navigation.navigate("Signup")}>
                <Text style={{color:'#42e8f4'}}>Create Account</Text>
              </Button>
            <Button transparent onPress={() => this.props.navigation.navigate("Forgetpass")}>
              <Text  style={{color:'#42e8f4'}}>Forget Password</Text>
            </Button>
            </ListItem>
            <Button full
              style={{backgroundColor:'#42e8f4'}}
              onPress={() => this.props.navigation.navigate("Welcome")}>
              <Text style={{color: '#FFF'}}>Sign In</Text>
            </Button>
          </Content>

const styles = {
  content:{
    position:'absolute',
    bottom:10,
    left:0,
    right:0
  },
}
Run Code Online (Sandbox Code Playgroud)

我正在使用Native-Base。如何解决这个问题?

react-native react-native-android native-base react-native-ios

8
推荐指数
2
解决办法
5764
查看次数

响应本机Web视图中的推送通知

我有一个具有通知功能的网站.有什么办法可以在React Native的Web视图应用程序中实现推送通知吗?

webview android-webview react-native react-native-android

8
推荐指数
0
解决办法
781
查看次数

期望动态类型为"double",但是类型为"null"(在索引1处为Timing.createTimer构造参数)

Expected dynamic type `double', but had type `null' (Constructing arguments for Timing.createTimer at index 1)当我运行react-native android时,我一直收到这个错误.当我尝试定位Timing.createTimer时,我发现它在3个地方使用node_modules/react-native/Libraries/Core/Timers/JSTimers.js:

1

setTimeout: function(
func: Function,
duration: number,
...args?: any
): number {
    if (__DEV__ && IS_ANDROID && duration > MAX_TIMER_DURATION_MS) {
      console.warn(
        ANDROID_LONG_TIMER_MESSAGE +
          '\n' +
          '(Saw setTimeout with duration ' +
          duration +
          'ms)',
      );
    }
    const id = _allocateCallback(
      () => func.apply(undefined, args),
      'setTimeout',
    );
    Timing.createTimer(id, duration || 0, Date.now(), /* recurring */ false);
    return id;
  }
Run Code Online (Sandbox Code Playgroud)

2

setInterval: …
Run Code Online (Sandbox Code Playgroud)

android react-native react-native-android

8
推荐指数
1
解决办法
422
查看次数

任务':react-native-camera:compileDebugJavaWithJavac'的执行失败

我正在使用React-Native创建应用程序,并在Android设备上对其进行测试。添加react-native-camera模块后,发生以下错误:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':react-native-camera:compileDebugJavaWithJavac'. 在“构建->运行任务”(Android Studio)中。

关于Java编译器,大约有20-30错误,所有这些都显示以下内容:error: package android.support.annotation does not exist,error: package android.support.v4.util does not exist,error: package android.support.media does not exist,等,或error: cannot find symbol class SparseArrayCompat,error: package Pools does not exist,error: cannot find symbol variable ExifInterface,这在错误文件检查时有做import android.support.v4.util.ArrayMap;-import样的语句。

我的android / build.gradle文件:

buildscript {
    ext {
        minSdkVersion = 26
        compileSdkVersion = 28
        targetSdkVersion = 27
        supportLibVersion = 28
    }
    repositories {
        google() …
Run Code Online (Sandbox Code Playgroud)

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

8
推荐指数
1
解决办法
1721
查看次数