https://github.com/facebook/react-native/issues/7762
我正在尝试在Android上使用React-Native构建自定义键盘.它们是用InputMethodService实现的,因此很难提供一个rnplay.我已经跟踪了DialogModule.class文件中的以下代码
public void onHostResume() {
this.mIsInForeground = true;
DialogModule.FragmentManagerHelper fragmentManagerHelper = this.getFragmentManagerHelper();
Assertions.assertNotNull(fragmentManagerHelper, "Attached DialogModule to host with pending alert but no FragmentManager (not attached to an Activity).");
fragmentManagerHelper.showPendingAlert();
}
@Nullable
private DialogModule.FragmentManagerHelper getFragmentManagerHelper() {
Activity activity = this.getCurrentActivity();
return activity == null?null:(activity instanceof FragmentActivity?new DialogModule.FragmentManagerHelper(((FragmentActivity)activity).getSupportFragmentManager()):new DialogModule.FragmentManagerHelper(activity.getFragmentManager()));
}
Run Code Online (Sandbox Code Playgroud)
以下是我如何设置SimpleIME
package com.customKeyboard;
import android.content.Context;
import android.inputmethodservice.InputMethodService;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.KeyboardView;
import android.media.AudioManager;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
import com.facebook.react.LifecycleState;
import com.facebook.react.ReactInstanceManager; …Run Code Online (Sandbox Code Playgroud) android android-input-method react-native react-native-android
我正在编写自己的ViewManager,它需要获取活动实例.在版本0.29之前它是直接的,但在RN@0.29 突破变化后我找不到办法.
谢谢.
我想在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实现
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编程,我正在尝试将http://react-native-material-design.github.io/installation整合到材料设计中.
我想在我的应用程序中使用这个http://react-native-material-design.github.io/components/toolbar视图,因为没有关于如何使用它的文档.
任何人都可以帮助我如何在我的应用程序中使用此视图.提前致谢.
PS:我不想使用这个https://facebook.github.io/react-native/docs/toolbarandroid.html
我需要从本地反应的另一个页面访问函数.
示例:
validateEmail = (email) => {
// ---- Code ----
}
Run Code Online (Sandbox Code Playgroud)
我需要在login.js和registration.js中访问该函数
在使用NativeBase构建的iOS版本的本机应用程序中,除非给出特定的宽度,否则一切都太瘦了.见下图.我给页眉和页脚的宽度为100%,所以它很好,但我没有为输入做到这一点,他们太瘦了.当没有宽度时,页眉和页脚是瘦的.
码:
import React from 'react'
import {
Container,
Header,
Form,
Item,
Input,
Label,
Content,
Footer,
FooterTab,
Button,
Left,
Right,
Body
} from 'native-base'
import { Text, Image } from 'react-native'
export const Volcalc = () => {
return (
<Container style={styles.container}>
<Header style={styles.header}>
<Left>
<Image resizeMode={Image.resizeMode.contain} style={styles.thumbnail} source={require('./img/logo_red_nowords.png')} />
</Left>
<Body>
</Body>
<Right />
</Header>
<Content>
<Form>
<Item stackedLabel bordered >
<Label>height</Label>
<Input />
</Item>
<Item stackedLabel >
<Label>width</Label>
<Input />
</Item>
</Form>
</Content>
<Footer >
<FooterTab style={styles.footer}>
<Button …Run Code Online (Sandbox Code Playgroud) react-native react-native-android native-base react-native-ios
我的state名字中有一个数组Categories.
这些是它的价值观:['Food', 'Home', 'Savings'].
我的目标是我需要将它们渲染Picker.items为我的用户选择.
怎么可能?
我尝试ListView在Picker对象内部使用,但是当我导航到该页面时,
AppName停止工作
提示.
我有我的Android应用程序(react-native为基础)和深度链接第一次当我运行它而应用程序没有在后台运行时效果很好,但当应用程序在后台运行时我点击深层链接它甚至没有打开应用程序...我不确定从哪里开始这个错误我console.logs在生命周期事件中尝试了一些,但他们甚至没有运行.
请指导我在哪里寻找问题以及如何解决它,谢谢!
我将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