所以我刚刚使用该命令创建了一个react本机项目
react-native init "project-name"
我进入应用程序级build.gradle连接firebase,我有一个错误说无法解析符号'android'就行了
import com.android.build.OutputFile
然而它弹出说"在项目中检测到android框架点击配置"所以我做了这个,但后来它说不能解决同一行上的符号'build',我不知道为什么它说这是因为我做了项目同样的方式,从来没有这个问题,任何想法?
我正在关注react-native的教程,但是他们正在为IOS做这件事,有一部分他们使用AlertIOS.prompt,如下所示
AlertIOS.prompt(
'Add New Item',
null,
[
{text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
{
text: 'Add',
onPress: (text) => {
this.itemsRef.push({ title: text })
}
},
],
'plain-text'
);
Run Code Online (Sandbox Code Playgroud)
我正在尝试为 android 重新制作它,但无法让它工作,我确实找到了这个https://www.npmjs.com/package/react-native-prompt
import Prompt from 'react-native-prompt';
<Prompt
title="Say something"
placeholder="Start typing"
defaultValue="Hello"
visible={ this.state.promptVisible }
onCancel={ () => this.setState({
promptVisible: false,
message: "You cancelled"
}) }
onSubmit={ (value) => this.setState({
promptVisible: false,
message: `You said "${value}"`
}) }/>
Run Code Online (Sandbox Code Playgroud)
但是我也无法让它工作,当我按下按钮但什么也没有发生时,它应该显示提示。
这是 AlertIOS 的完整原始代码
'use strict';
import React, …Run Code Online (Sandbox Code Playgroud)