小编Gor*_*fex的帖子

React Native FlatList水平模式根本不起作用

我正在使用React Native 0.44.0,我正在尝试使用卡式布局制作水平FlatList.无论出于何种原因,无论我做什么,我都无法启动水平模式.似乎总是垂直呈现......

这是我正在使用的代码:

 <FlatList
    horizontal={true}
    data={this.state.newsFeed}
    refreshing={this.state.refreshing}
    ref={ref => {
        this.newsFeedListRef = ref;
    }}
    renderItem={this.renderNewsFeedRow.bind(this)}
    keyExtractor={(item, index) => `feed_${index}`}
    onRefresh={this.__handleNewsFeedOnRefresh.bind(this)}
    renderScrollComponent={this.renderScrollComponent.bind(this)}
    ListHeaderComponent={this.renderListHeaderComponent.bind(this)}
    getItemLayout={(data, index) => ({
        index,
        length: ITEM_HEIGHT,
        offset: ITEM_HEIGHT * index + headerBarHeight
    })} />;
Run Code Online (Sandbox Code Playgroud)

我可以发布我的组件渲染的代码,但它们都没有使用任何东西,除了样式的填充和边距,所以flexflexDirection东西.

javascript reactjs react-native react-native-flatlist

7
推荐指数
2
解决办法
4615
查看次数

在渲染到屏幕之前在内存中响应视频加载

我很难弄清楚如何在加载视频时加载微调器。我不想做 DOM 加载器,我希望在加载视频时加载页面上的所有内容。到目前为止,当我使用onLoadStartand 时onLoadedData,它们似乎在整个页面加载完成的同时触发。没有帮助。

有没有办法异步加载它并在加载时显示微调器?也许加载到虚拟内存中?

这是我当前的代码:

“渲染”功能

    const { isLoading } = this.state;

    return (
        <React.Fragment>
            {isLoading && (
                <CircularProgress />
            )}

            <video
                loop
                muted
                autoPlay
                src={WaveVideo}
                preload={'auto'}
                type={'video/mp4'}
                className={classes.video}
                ref={ref => this.headerVideo}
                onLoadStart={() => {
                    console.log('...I am loading...')
                    this.setState({ isLoading: true });
                }}
                onLoadedData={() => {
                    console.log('Data is loaded!')
                    this.setState({ isLoading: false });
                }}>
            </video>
        </React.Fragment>
    );
Run Code Online (Sandbox Code Playgroud)

asynchronous loading html5-video reactjs

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

OBJ-C操作方法:应用程序在同一设备中使用BLE连接和iBeacon

我有一个用例,我的objective-c应用程序需要在终止之后立即使用iBeacon,以便从终止状态唤醒应用程序,连接到BLE并向设备发送命令.我在这里找到了一个更长的运行帖子,如果需要你可以查看我的代码.

问题

到目前为止,问题发生在我运行应用程序,搜索以前配对的设备和/或扫描外围设备,找到我的BLE设备并连接时.连接后,用户将BLE连接配对,以便它们可以通过BLE连接发送加密的特征数据.如果没有配对(在设备的命名约定中也称为auth/bond),用户根本无法将数据发送到设备.它永远不会在那里.你配对后就可以发送命令......

当我终止应用程序时,在applicationWillTerminate方法中,我运行此代码...

- (void)applicationWillTerminate:(UIApplication *)application {
    NSLog(@"*** Application Will Terminate.");

    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    NSNumber *mode = [userDefaults objectForKey:@"deviceConnectedMode"];

    if([mode intValue] == CONNECTED_MODE_INDICATOR) {
        [self.bluetoothManager sendCodeToBTDevice:@"magiccommand1"
                                   characteristic:self.bluetoothManager.wipeCharacteristic];

//I have been turning this command on and off in testing to see if I can get it to work better while disconnecting in the device rather than in the app...
//The command magiccommand2 wipes the auth/bond inside of the device           
//        [self.bluetoothManager sendCodeToBTDevice:@"magiccommand2" …
Run Code Online (Sandbox Code Playgroud)

bluetooth objective-c ios bluetooth-lowenergy ibeacon

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

Laravel API 端点在服务器上“401 未经授权”,但在本地主机上运行良好

背景

我开发了一个使用 Laravel 作为 API 的 React 应用程序。我已经通过 Passport 添加了登录信息,并且非常成功地使用了个人访问客户端方法。我可以添加新用户和令牌,我可以撤销令牌,我可以重置密码...所有 API 调用(登录和注册除外)都由 API 中间件保护并且可以正常工作。如果我从任何这些调用的标头中删除 ,Bearer ${token}由于 ->middleware('auth:api') 包装器,它会返回 401 unauthenticated。

问题

一切都完全按预期进行......直到我将所有内容移至我的 Raspberry Pi 服务器。当我移动所有东西时,问题就开始了。我可以登录并且可以注册,但是一旦我在流程中后续的任何端点调用上使用新的不记名令牌(我从登录或注册调用中收到的),它就会失败并显示 401 未经身份验证,立即地。我运行了php artisan passport:client --personal命令并像往常一样成功地将 id 和密钥输入到我的 .env 文件中。我安装了所有的作曲家和供应商包。我安装了所有的 Passport 包和 CLI 命令。

它仅在使用 auth 中间件的调用上失败

我做了一些挖掘,似乎我能发现的唯一(显着的)变化是 Pi 运行 32 位 PHP,而我的本地主机运行 64 位 PHP。除此之外,它的代码、数据库、Laravel 和 PHP 版本都相同。

我尝试使用该命令php artisan passport:client --personal --name="app-name" --redirect_uri="http://192.168.1.1/"将记录放入“oauth_clients”表中,但将重定向显示为http://localhost/. 然后,我尝试使用 SQL 手动将名为“redirect”的列的值更改为http://localhost/......但更改又没有任何作用。调用仍会返回 401 未经身份验证。

我能发现的唯一可能存在问题的其他事情是:

  1. 事实上,数据库表“oauth_access_tokens”中“redirect”列下的所有令牌都是使用 of …

apache authentication laravel laravel-passport raspberry-pi4

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