我正在尝试将facebook登录集成在react-native中.我用这个文件React Native FDSK,我收到了这个错误
我是新来的原生反应,我正在尝试安装反应本机Facebook SDK,以便我可以使用我的应用程序进行Facebook登录.
我按照此处列出的步骤操作:https://tylermcginnis.com/installing-the-facebook-sdk-into-a-react-native-android-and-ios-app/
问题是,当我运行react-native run-android时,应用程序会立即崩溃.如何调试此崩溃?我不知道在哪里寻找崩溃日志.运行react-native log-android并没有向我展示任何有用的东西.
编辑:
我知道这是一个Java问题而不是JS问题.如何查找Java崩溃日志?
当我试图为每次按下按钮时设置计数时,我面临上述错误.
export default class ViewIdeas extends Component{
get InitialState(){
return {
count : 0
}
}
render(){
return(
.......
<Button transparent>
<Icon name='ios-thumbs-up-outline' style={{fontSize:21}}
onPress={() => this.setState({count: ++this.state.count})}/>
<Text>{'Like' + this.state.count}</Text>
</Button>
Run Code Online (Sandbox Code Playgroud) 我在尝试构建时突然开始出现此错误.几周前这一切都在运作,我所知道的没有任何变化.这个问题似乎与此有关react-native-fbsdk,但通过它的build.gradle查看它没有列出support.appcompat-v7.25.x.有什么建议?
A problem occurred configuring project ':app'.
> A problem occurred configuring project ':react-native-fbsdk'.
> Could not resolve all dependencies for configuration ':react-native-fbsdk:_debugCompile'.
> Could not find com.android.support:appcompat-v7:25.3.1.
Searched in the following locations:
file:/Users/a/.m2/repository/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.pom
file:/Users/a/.m2/repository/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.jar
https://jcenter.bintray.com/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.jar
Run Code Online (Sandbox Code Playgroud)
的build.gradle
apply plugin: "com.android.application"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
import com.android.build.OutputFile
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "___"
minSdkVersion 16
targetSdkVersion 23 …Run Code Online (Sandbox Code Playgroud) <Button
onPress={{() => Alert.alert(
'Alert Title',
'alertMessage',
[
{text: 'Cancel', onPress: () => console.log('Cancel Pressed!')},
{text: 'OK', onPress: () => {this.onDeleteBTN}},
],
{ cancelable: false }
)}}
>
<Text> Delete Record </Text>
</Button>
Run Code Online (Sandbox Code Playgroud)
在Alert Dialog上按OK按钮后我需要打电话
onDeleteBTN = () => {
alert(' OnDelete');
}
Run Code Online (Sandbox Code Playgroud)
{text: 'OK', onPress: () => {this.onDeleteBTN.bind(this)}},
{text: 'OK', onPress: () => {this.onDeleteBTN}},
Run Code Online (Sandbox Code Playgroud)
这不行
javascript reactjs react-native react-native-android react-native-ios
我试图加载自定义Android WebView,以便能够使用html文件输入上传文件(默认情况下,Android webview不能使用输入文件).我使用这个代码,唯一的区别是我使用expo工具包,所以我的MainApplication.java是不同的(默认情况下继承自另一个类):
public class MainApplication extends MultiDexApplication {
// Needed for `react-native link`
public List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new CustomWebViewPackage()
);
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
Run Code Online (Sandbox Code Playgroud)
基本上git代码所做的是覆盖默认的反应本机webview以使其使用Android中的CustomWebView.java,使用requireNativeComponent和此代码(这在CustomWebView.android.js上):
var RCTWebView = requireNativeComponent('CustomWebView', WebView, {
nativeOnly: {
messagingEnabled: PropTypes.bool,
},
Run Code Online (Sandbox Code Playgroud)
});
但是当我使用exp start运行应用程序并导航到具有CustomWebView的屏幕时,我收到此错误:
总结问题是React Native没有读取我的自定义本机组件.有谁可以帮助我吗?
我创建了一个屏幕,我显示一个包含FlatList的组件.出于某种原因,我无法滚动列表.谁能发现我的错误并指出我正确的方向?
我的屏幕文件中的渲染功能和样式:
render() {
return (
<View style={styles.container}>
<SearchBar />
<ActivityList style={styles.list} data={this.state.data} />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
overflow: 'hidden',
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'flex-start',
},
list: {
flex: 1,
overflow: 'hidden',
},
});
Run Code Online (Sandbox Code Playgroud)
从我的listitem组件渲染函数和样式:
export default class CardItem extends React.PureComponent {
render() {
return (
<View style={styles.cardview}>
<View style={styles.imagecontainer}>
<Image
resizeMode="cover"
style={styles.cardimage}
source={{
uri: this.props.image,
}}
/>
</View>
<View style={styles.cardinfo}>
<Text style={styles.cardtitle}>{this.props.title}</Text>
<View style={styles.cardtext}>
<Text style={styles.textdate}>{this.props.date}</Text>
<Text style={styles.texthour}>{this.props.hour}</Text>
</View>
</View> …Run Code Online (Sandbox Code Playgroud) 我是使用React-native进行应用程序开发的新手.虽然用命令创建项目react-native init appname的index.js同时在项目文件夹内创建文件.今天,我了解到有一种比安装Android模拟器更好的方法来测试反应原生项目,这是世博会.要创建expo项目,我需要使用create-react-native-app appname命令创建react-native项目.但是,index.js使用这种方式创建项目时不会创建该文件.即使我手动创建了index.js文件,它也无法正常工作.
还有一个问题:什么是目的App.js和index.js?
如何在AndroidManifest.xml中使用'adjustPan'和'adjustResize'响应原生app.
我的导航是在ReactNavigation上使用StackNavigator和TabNavigator进行的.我有一个文本框,用户可以在其中键入任何数据.执行此操作时,标签栏显示在键盘顶部.为了阻止这个我使用'adjustPan',它工作正常.
在另一个屏幕上,我有一个注册多个文本框.除非您点击键盘上的"勾选"或手动点击系统后退按钮,否则我无法滚动整个屏幕.为了解决这个问题,我发现'KeyboardAvoidingView'工作正常.但要激活这个需要将'windowSoftInputMode'更改为'adjustResize'.
在文档中,发现这两个属性完全不同,我不能同时在一起.有人可以帮我吗?
参考文献:https://medium.freecodecamp.org/how-to-make-your-react-native-app-respond-gracefully-when-the-keyboard-pops-up-7442c1535580
我正在尝试将道具传递给已通过调用create...Navigator调用包裹的组件,即
// Search.js
const Navigator = createMaterialTopTabNavigator({
Wines,
Stores,
Vineyards,
Restaurants
});
// Somewhere in render()...
<Navigator />
Run Code Online (Sandbox Code Playgroud)
我试图找出如何将参数传递到Wines/ Stores从/等的部件.Search组分(上文).我已经阅读了文档,显然这可以navigation.navigate通过传入一个对象轻松完成,但我不知道如何使用这个特定的方法.有人可以帮忙吗?
javascript reactjs react-native react-native-android react-navigation