小编Kri*_*oka的帖子

React Native无法运行stacktrace

我正在尝试使用Mac上的React Native启动并运行测试项目(osx 10.12).如果我跑:

react-native run-android --stacktrace

我收到以下错误:

error: unknown option '--stacktrace'

我安装了:

  • 节点守望者
  • Java JDK
  • Android SDK
  • React Native CLI
  • Genymotion

当我运行该命令时,模拟器正在运行.

谁能告诉我为什么会这样?提前谢谢了.

java macos android react-native

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

函数声明与定义C

我有一个简单的代码,我的函数在main函数之前声明:

int function1();
int function2();

int main() {
   /* ... */
   function1(x,y);
   function2(x,y);
   /* .... */
}

int function1(int x, float y) { /* ... */ }
int function2(int x, float y) { /* ... */ }
Run Code Online (Sandbox Code Playgroud)

在我的主要功能之后,我有函数的定义:

当我在main之前声明函数时,有什么不同吗?

int function1(int x, float y);
int function2(int x, float y);

int main() {
   /* ... */
   function1(x,y);
   function2(x,y);
   /* .... */
}

int function1(int x, float y) { /* ... */ }
int function2(int x, float y) { /* ... */ …
Run Code Online (Sandbox Code Playgroud)

c prototype declaration function definition

13
推荐指数
3
解决办法
3160
查看次数

react-native (expo) 中的 AuthSession 不会返回到应用程序 Android

我有一个用 React Native 代码编写的应用程序。我有这个功能的组件:

handleLogin = async () => {
    let redirectUrl = AuthSession.getRedirectUrl();
    let results = await AuthSession.startAsync({
        authUrl: `https://exampleurl.com/?uid=${CLIENT_ID}&redirect_uri=${encodeURIComponent(redirectUrl)}`
    });

    if (results.type !== 'success') {
        this.setState({ didError: true });
    } else {

        if(results.params.token != undefined) {
            let user = {
                name: results.params.uname,
                surname: results.params.surname,
                token: results.params.token
            }
            this.setState({ userInfo: user});
            this.props.loginUser(this.state.userInfo);
        }
    }
};
Run Code Online (Sandbox Code Playgroud)

问题是,当我在 Expo 中运行它们时,它运行良好,打开适当的 URL,我登录然后服务器成功返回我到 redirect_uri 和 app hide webapp modal 并显示我需要的内容。

但是,当我将应用程序导出到 android 并在我的手机中安装此 apk 时,它仍然可以正常工作,单击打开 webview,我以用户身份登录并返回。但它停留在“返回应用程序”步骤。它永远不会返回应用程序。我还在 app.json 中定义了架构:

    {
  "expo": {
    "name": "MyNewApp", …
Run Code Online (Sandbox Code Playgroud)

react-native expo

5
推荐指数
1
解决办法
1394
查看次数

执行托管 bean 操作方法后显示 alert()

我有一个命令链接:

<h:commandLink value="Delete"
    onclick="return confirm('Are you sure?');" 
    action="#{bean.deleteDestination(destination, '/destination/show')}" />
Run Code Online (Sandbox Code Playgroud)

它调用此托管 bean 操作方法:

public String deleteDestination(Destination selected, String action) {
    List<Flight> flights = getEjbFlightFacade().findFlightWithDestination(selected);

    if (flights.isEmpty()) {
        getEjbDestinationFacade().remove(selected);
        setDestinations(getEjbDestinationFacade().findAll());
    }
    else {
        // Here need to show an alert() that user can't remove the item.
    }

    return action;
}
Run Code Online (Sandbox Code Playgroud)

如评论所示,我想表明alert()最终用户无法删除该项目。我怎样才能做到这一点?

jsf alert facelets

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

标签 统计

react-native ×2

alert ×1

android ×1

c ×1

declaration ×1

definition ×1

expo ×1

facelets ×1

function ×1

java ×1

jsf ×1

macos ×1

prototype ×1