首先,我运行一个新项目
react-native init AwesomeProject --version 0.58.6
Run Code Online (Sandbox Code Playgroud)
(0.59.1有一个错误,但我对此进行了测试)
与react-native run-android我可以运行它。
在android studio中,当我同步它时,出现错误:
app / build.gradle:
import com.android.build.OutputFile
Run Code Online (Sandbox Code Playgroud)
错误:无法解析符号“ build”
我使用以下版本:
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Run Code Online (Sandbox Code Playgroud) android android-gradle-plugin react-native react-native-android
如何使用 React Native 中的 react-navigation 在 Android 中使用向下滚动操作自动隐藏标题并使用向上滚动操作显示标题?
const HomeStack = createStackNavigator({
Home: {
screen: HomeIndexScreen,
},
Details: {
screen: HomeItemScreen,
}
},{
headerLayoutPreset : 'center',
headerMode: 'float'
});
Run Code Online (Sandbox Code Playgroud) 第1步:在控制台/终端中。
npm install --save sweetalert2
Run Code Online (Sandbox Code Playgroud)
第2步:在app.scss中添加此行...
@import '~sweetalert2/src/sweetalert2.scss';
Run Code Online (Sandbox Code Playgroud)
第3步:在app.js中添加此行...
const swal = require('sweetalert2');
Run Code Online (Sandbox Code Playgroud)
STEP4:在webpack.min.js中...
mix.setPublicPath('public');
mix.js('resources/js/app.js', 'js');
mix.sass('resources/sass/app.scss', 'css');
Run Code Online (Sandbox Code Playgroud)
第5步: npm run dev
步骤6:将app.js和app.css添加到HTML文档
我收到此错误:
未捕获的ReferenceError:未定义swal
缺少的步骤是什么?
laravel-5.7/mysql\nRun Code Online (Sandbox Code Playgroud)\n\n在我的数据库中,我有一个如下所示的 json 格式字段:
\n\n字段名称:特征:
\n\n[\n {"id": 1, "url": null, "name": "A"}, \n {"id": 2, "url": null, "name": "B"}\n]\nRun Code Online (Sandbox Code Playgroud)\n\n同样在它的模型中,我写了这个
\n\n protected $casts = [\n \'features\' => \'array\'\n ];\nRun Code Online (Sandbox Code Playgroud)\n\n现在我创建一个数组:
\n\n$features = array();\n\ntemp = array();\ntemp[\'id\'] = 1;\ntemp[\'url\'] = null;\ntemp[\'name\'] = A;\n$features[] = temp;\n\ntemp = array();\ntemp[\'id\'] = 2;\ntemp[\'url\'] = null;\ntemp[\'name\'] = B;\n$features[] = temp;\nRun Code Online (Sandbox Code Playgroud)\n\n如何$features array 与features field 数据库中的进行比较?
\xd9\x91我检查了这些:
\n\n$fff = \\App\\Cart::whereFeatures($features)->get()->first();\nRun Code Online (Sandbox Code Playgroud)\n\n或者
\n\n$fff = …Run Code Online (Sandbox Code Playgroud) 在我的 laravel 项目中,我想为每个新创建的记录设置一个随机默认值。
根据这篇文档,我尝试这样做:
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Model;
class User extends Authenticatable
{
protected $fillable = [
'access_token'
];
protected $attributes = [
'access_token' => str::uuid()
];
}
Run Code Online (Sandbox Code Playgroud)
protected $attributes但我收到线路错误
"Constant expression contains invalid operations"
Run Code Online (Sandbox Code Playgroud) 表结构:
users: id - email - active
Run Code Online (Sandbox Code Playgroud)
active我只想在 0时检查重复的电子邮件。
对于所有电子邮件,我这样做:
'email' => 'required|unique:users|email',
Run Code Online (Sandbox Code Playgroud)
是否可以在验证中定义条件?
如何延迟 5 秒运行此功能?
export default class Splash extends React.PureComponent {
constructor() {
super();
this._bootstrapAsync();
}
bootstrapAsync = async () => {
//await Task.Delay(5);
//await timeout(5000)
//await sleep(5000);
const userToken = await AsyncStorage.getItem('userToken');
this.props.navigation.navigate(userToken ? 'App' : 'Auth');
};
Run Code Online (Sandbox Code Playgroud)
我试过这些:
await Task.Delay(3);
Run Code Online (Sandbox Code Playgroud)
和
await timeout(5000);
Run Code Online (Sandbox Code Playgroud)
和
await sleep(2000);
Run Code Online (Sandbox Code Playgroud) 我试试这个
<Input placeholder="search...."
ref={(ref) => { this.SearchInput = ref; }}
/>
<Button transparent onPress={this.clear}>
<Ionicons name="ios-close" />
</Button>
Run Code Online (Sandbox Code Playgroud)
和功能:
clear = () => {
this.SearchInput.clear();
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
this.SearchInput.clear() 不是函数
laravel ×4
react-native ×4
php ×3
android ×1
async-await ×1
javascript ×1
laravel-5 ×1
laravel-5.7 ×1
laravel-mix ×1
mysql ×1
native-base ×1
npm ×1
sweetalert2 ×1