标签: 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
查看次数

使用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
查看次数

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

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

谢谢.

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

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

React native如何每隔x分钟从api获取一次

我想在android上每隔x分钟运行一次fetch(使用React native)

function getMoviesFromApiAsync() { 
    return fetch('https://facebook.github.io/react-native/movies.json').then((response) => response.json()) .then((responseJson) => { 
  return responseJson.movies; }) .catch((error) => { console.error(error); }); 
}
Run Code Online (Sandbox Code Playgroud)

我开始使用documentaion中的示例,因为我还不确定如何进行此类提取.

我不知道我应该怎么开始这个(做一个Android本机处理程序可能?).我只找到了一个组件,但这是用于ios iOS后台获取API实现

android react-native-android

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

onContentSizeChange在Android上没有触发高度变化(react-native)

onContentSizeChange在Android上似乎无法正常启动.事件被触发mount,但不会在text height更改时触发.相同的代码适用于iOS:

<TextInput
  editable = {true}
  multiline = {true}
  [...]
  onContentSizeChange={(event) => {
  this.setState({height: event.nativeEvent.contentSize.height});
  }}
  style={{height: Math.max(35, this.state.height)}}
/>
Run Code Online (Sandbox Code Playgroud)

react-native react-native-android

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

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
查看次数

如何将Rerink-native使用收缩器(R8)

我将react-native版本更新为0.60.4,但是当我尝试构建发行版时,我陷入了Task:app:transformClassesAndResourcesWithR8ForRelease

我试图禁用R8并可以正常工作,但apk却大了3倍

R8 is the new Android code shrinker. If you experience any issues, please file a bug at
https://issuetracker.google.com, using 'Shrinker (R8)' as component name. You can
disable R8 by updating gradle.properties with 'android.enableR8=false'.
Current version is: 1.4.94 (build 3904928f0db9c3bf128ce3bbfb160 from go/r8bot (luci-r8-ci-archive-0-5g74)).


D8: The rule `-keep class * extends com.facebook.react.bridge.JavaScriptModule {
  *;
}` uses extends but actually matches implements.
D8: The rule `-keep class * extends com.facebook.react.bridge.NativeModule {
  *;
}` uses extends but actually matches implements.
D8: The …
Run Code Online (Sandbox Code Playgroud)

android react-native react-native-android react-native-fbsdk

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