小编mat*_*ttd的帖子

从私有存储库全局安装 NPM 包

我有以下包:react-native-rename

该项目位于package.json内,有一个启动 index.js 文件的别名。

我分叉了存储库并上传到我的私人 GitLab。

现在,我想在我的环境中全局安装它。如果我做:

npm install -g react-native-rename
Run Code Online (Sandbox Code Playgroud)

它工作得很好,我可以从命令行调用react-native-rename。我可以在全局 npm 文件夹中看到正确安装的包。

如果我做:

npm install -g git+ssh://git@git.company.info:mobile/react-native-rename.git
Run Code Online (Sandbox Code Playgroud)

没有任何作用。软件包未安装,无法调用脚本。此外,由于某些未知原因,如果没有全局选项,则无法安装此软件包。

有解决这个问题的想法吗?

谢谢!

node.js npm reactjs react-native

9
推荐指数
0
解决办法
1441
查看次数

在Android上调用本机Linking.getInitialUrl总是调用

我有一个带有以下代码的React-Native应用程序(这里是App.js,应用程序入口点),用于管理Android上的深层链接。

Linking.getInitialURL().then((deepLinkUrl) => {
  if (deepLinkUrl) {
    manageDeepLink(deepLinkUrl);
  } else {
    Navigation.startSingleScreenApp('rootScreen');
  }
});
Run Code Online (Sandbox Code Playgroud)

这里的问题是,每次我从深度链接或正常情况下启动我的应用程序时,都会调用getInitialURL,并且每次它包含deepLinkUrl参数为空时都会调用它。我已经在AndroidManifest中注册了我的意图,如下所示:

<application
    android:name=".MainApplication"
    android:allowBackup="true"
    android:launchMode="singleTask"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:windowSoftInputMode="adjustResize">
        <!-- deeplink -->
        <intent-filter android:label="@string/app_name">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="myapp" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
Run Code Online (Sandbox Code Playgroud)

更新 我正在使用本机导航来注册屏幕,如果这可能有用的话。

android deep-linking react-native react-native-android react-native-navigation

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

根据用户输入更改按钮行为

我正在Android中编写一个简单的应用程序.

我遇到过这个问题:我有两个EditText和一个Button.一个EditText的值必须是另一个EditText的倍数.

当用户在第一个EditText中插入一个值然后按下按钮时,另一个EditText应该显示用用户输入计算的值.这在其他经文中也应该是可能的.

像一个简单的单位转换器.当我value1在EditText1中插入并按转换时,应用程序必须在EditText2中显示转换后的值,但如果我value2在EditText2中插入一个并按下转换按钮,应用程序必须在EditText1中显示转换后的值.我的问题是:如何识别最后一个用户输入的EditText?

public void convert(View view) {
    EditText textInEuro = (EditText) findViewById(R.id.euroNumber);
    EditText textInDollar = (EditText) findViewById(R.id.dollarNumber);
    if (toDollar) {
        String valueInEuro = textInEuro.getText().toString();
        float numberInEuro = Float.parseFloat(valueInEuro);
        // Here the conversione between the two currents
        float convertedToDollar = unit * numberInEuro;
        // set the relative value in dollars
        textInDollar.setText(Float.toString(convertedToDollar));
    }

    if (toEuro) {
        String valueInDollar = textInDollar.getText().toString();
        float numberInDollar = Float.parseFloat(valueInDollar);
        //Here the conversione between the two currents
        float convertedToEuro = numberInDollar / …
Run Code Online (Sandbox Code Playgroud)

java android converter android-edittext android-button

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

使用枚举值进行 MySQL 查询

我在 MySQL 5.6.19 中有以下结构。

CREATE TABLE `metadata` (
`md5` char(32) NOT NULL,
`match` enum('none','md5','similarity') DEFAULT NULL
) 
Run Code Online (Sandbox Code Playgroud)

我在执行这样的查询时遇到错误:

select * from metadata where match = 'md5';
Run Code Online (Sandbox Code Playgroud)

错误是:

ERROR 1064 (42000):您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 1 行 '= 'md5'' 附近使用的正确语法

表中有多个条目和行可以与查询匹配。但MySQL拒绝这样做。知道原因吗?谢谢!

mysql sql enums reserved-words

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